+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;
+
+ /** These fields only valid when texture memory is mapped */
+ GLint RowStride; /**< Padded width in units of texels */
+ GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
+ each 2D slice in 'Data', in texels */
+ GLubyte *Map; /**< Pointer to mapped image memory */
+
+ /** Malloc'd texture memory */
+ GLubyte *Buffer;
+
+ FetchTexelFunc FetchTexel;
+};
+
+
+/** 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;
+}
+
+
+