summaryrefslogtreecommitdiff
path: root/src/mesa/main/mtypes.h
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-05-20 16:19:48 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-05-20 16:19:48 +0000
commitb0b6d1abe5c7e629baebd4bf3d3ee3b17ba6ff08 (patch)
treeebac2d5b8cf7d29a38beb6bc7854b5f67a8b9524 /src/mesa/main/mtypes.h
parent226d0187b530482684f3a0dddd0934bd015eb986 (diff)
In gl_texture_image, replace ImageStride with an ImageOffsets array.
Some hardware lays out 3D mipmaps in a manner that can't be expressed with a simple image stride. The ImageOffsets array is allocated and initialized to typical defaults in the _mesa_init_teximage_fields() function. If needed, a driver will then have to replace these offsets. TexStore and TexelFetch routines updated to use offsets array.
Diffstat (limited to 'src/mesa/main/mtypes.h')
-rw-r--r--src/mesa/main/mtypes.h54
1 files changed, 38 insertions, 16 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 68dcd63fe3..e52e0bae5e 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1216,22 +1216,40 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
GLint col, GLint row, GLint img,
const void *texel);
+
/**
- * TexImage store function. This is called by the glTex[Sub]Image
- * functions and is responsible for converting the user-specified texture
- * image into a specific (hardware) image format.
+ * This macro defines the (many) parameters to the texstore functions.
+ * \param dims either 1 or 2 or 3
+ * \param baseInternalFormat user-specified base internal format
+ * \param dstFormat destination Mesa texture format
+ * \param dstAddr destination image address
+ * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
+ * \param dstRowStride destination image row stride, in bytes
+ * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels
+ * \param srcWidth/Height/Depth source image size, in pixels
+ * \param srcFormat incoming image format
+ * \param srcType incoming image data type
+ * \param srcAddr source image address
+ * \param srcPacking source image packing parameters
*/
-typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking);
+#define TEXSTORE_PARAMS \
+ GLcontext *ctx, GLuint dims, \
+ GLenum baseInternalFormat, \
+ const struct gl_texture_format *dstFormat, \
+ GLvoid *dstAddr, \
+ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
+ GLint dstRowStride, const GLuint *dstImageOffsets, \
+ GLint srcWidth, GLint srcHeight, GLint srcDepth, \
+ GLenum srcFormat, GLenum srcType, \
+ const GLvoid *srcAddr, \
+ const struct gl_pixelstore_attrib *srcPacking
+
+
+/**
+ * Texture image storage function.
+ */
+typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
/**
@@ -1277,6 +1295,8 @@ struct gl_texture_format
};
+#define MAX_3D_TEXTURE_SIZE (1 << (MAX_3D_TEXTURE_LEVELS - 1))
+
/**
* Texture image state. Describes the dimensions of a texture image,
* the texel format and pointers to Texel Fetch functions.
@@ -1294,8 +1314,6 @@ struct gl_texture_image
GLuint Width; /**< = 2^WidthLog2 + 2*Border */
GLuint Height; /**< = 2^HeightLog2 + 2*Border */
GLuint Depth; /**< = 2^DepthLog2 + 2*Border */
- GLuint RowStride; /**< == Width unless IsClientData and padded */
- GLuint ImageStride; /**< Stride between images, in texels */
GLuint Width2; /**< = Width - 2*Border */
GLuint Height2; /**< = Height - 2*Border */
GLuint Depth2; /**< = Depth - 2*Border */
@@ -1306,7 +1324,6 @@ struct gl_texture_image
GLfloat WidthScale; /**< used for mipmap LOD computation */
GLfloat HeightScale; /**< used for mipmap LOD computation */
GLfloat DepthScale; /**< used for mipmap LOD computation */
- GLvoid *Data; /**< Image data, accessed via FetchTexel() */
GLboolean IsClientData; /**< Data owned by client? */
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
@@ -1320,6 +1337,11 @@ struct gl_texture_image
GLboolean IsCompressed; /**< GL_ARB_texture_compression */
GLuint CompressedSize; /**< GL_ARB_texture_compression */
+ GLuint RowStride; /**< == Width unless IsClientData and padded */
+ GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
+ each 2D slice in 'Data', in texels */
+ GLvoid *Data; /**< Image data, accessed via FetchTexel() */
+
/**
* \name For device driver:
*/