+struct swrast_texture_image;
+
+
+/**
+ * Fetch a texel from texture image at given position.
+ */
+typedef void (*FetchTexelFunc)(const struct swrast_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLfloat *texelOut);
+
+
+/**
+ * Subclass of gl_texture_image.
+ * We need extra fields/info to keep tracking of mapped texture buffers,
+ * strides and Fetch functions.
+ */
+struct swrast_texture_image
+{
+ struct gl_texture_image Base;
+
+ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
+
+ /** used for mipmap LOD computation */
+ GLfloat WidthScale, HeightScale, DepthScale;
+
+ /**
+ * Byte stride between rows in ImageSlices.
+ *
+ * For compressed textures, this is the byte stride between one row of
+ * blocks and the next row of blocks.
+ *
+ * Only valid while one of the ImageSlices is mapped, and must be the same
+ * between all slices.
+ */
+ GLint RowStride;
+ /**
+ * When a texture image is mapped for swrast, this array contains pointers
+ * to the beginning of each slice.
+ *
+ * For swrast-allocated textures, these pointers will always stay
+ * initialized to point within Buffer.
+ */
+ void **ImageSlices;
+
+ /** Malloc'd texture memory */
+ GLubyte *Buffer;
+
+ FetchTexelFunc FetchTexel;
+
+ /** For fetching texels from compressed textures */
+ compressed_fetch_func FetchCompressedTexel;
+};
+
+
+/** cast wrapper */
+static inline struct swrast_texture_image *
+swrast_texture_image(struct gl_texture_image *img)
+{
+ return (struct swrast_texture_image *) img;
+}
+
+/** cast wrapper */
+static inline const struct swrast_texture_image *
+swrast_texture_image_const(const struct gl_texture_image *img)
+{
+ return (const struct swrast_texture_image *) img;
+}
+
+
+/**
+ * Subclass of gl_renderbuffer with extra fields needed for software
+ * rendering.
+ */
+struct swrast_renderbuffer
+{
+ struct gl_renderbuffer Base;
+
+ GLubyte *Buffer; /**< The malloc'd memory for buffer */
+
+ /** These fields are only valid while buffer is mapped for rendering */
+ GLubyte *Map;
+ GLint RowStride; /**< in bytes */
+
+ /** For span rendering */
+ GLenum ColorType;
+};
+
+
+/** cast wrapper */
+static inline struct swrast_renderbuffer *
+swrast_renderbuffer(struct gl_renderbuffer *img)
+{
+ return (struct swrast_renderbuffer *) img;
+}
+
+
+