diff options
author | Brian Paul <[email protected]> | 2011-10-23 10:44:47 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-10-23 10:44:47 -0600 |
commit | 6e0f9001fe3fb191c2928bd09aa9e9d05ddf4ea9 (patch) | |
tree | 4e2089a6790e76a4210ffc9d0f9aebf5c28adb40 /src/mesa/main | |
parent | 33abbd4fbdb3149df5ecc296b04a79225962e433 (diff) |
mesa: move gl_texture_image::Data, RowStride, ImageOffsets to swrast
Only swrast and the drivers that fall back to swrast need these fields now.
This removes the last of the fields related to software rendering from
gl_texture_image.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 5 | ||||
-rw-r--r-- | src/mesa/main/texcompress.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texcompress_fxt1.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texcompress_rgtc.c | 24 | ||||
-rw-r--r-- | src/mesa/main/texcompress_s3tc.c | 18 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 14 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 1 |
7 files changed, 32 insertions, 38 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 17c645a7ee5..d02bc167643 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1261,11 +1261,6 @@ struct gl_texture_image GLuint Level; /**< Which mipmap level am I? */ /** Cube map face: index into gl_texture_object::Image[] array */ GLuint Face; - - GLuint RowStride; /**< Padded width in units of texels */ - GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to - each 2D slice in 'Data', in texels */ - GLvoid *Data; /**< Image data, accessed via FetchTexel() */ }; diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 03e05d5ef7b..0458b9b689e 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -461,8 +461,8 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height, /* setup dummy texture image info */ memset(&texImage, 0, sizeof(texImage)); - texImage.Base.Data = (void *) src; - texImage.Base.RowStride = srcRowStride; + texImage.Data = (void *) src; + texImage.RowStride = srcRowStride; switch (format) { /* DXT formats */ diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 41630a47c64..d5c73e3b424 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -177,7 +177,7 @@ _mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage, /* just sample as GLubyte and convert to float here */ GLubyte rgba[4]; (void) k; - fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba); + fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba); texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); @@ -192,7 +192,7 @@ _mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage, /* just sample as GLubyte and convert to float here */ GLubyte rgba[4]; (void) k; - fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba); + fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba); texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index b03cd28b858..3586fc39daf 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -325,7 +325,7 @@ _mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) { GLubyte red; - unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data), + unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data, i, j, &red, 1); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = 0.0; @@ -338,7 +338,7 @@ _mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texIm GLint i, GLint j, GLint k, GLfloat *texel) { GLbyte red; - signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data), + signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data), i, j, &red, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); texel[GCOMP] = 0.0; @@ -351,9 +351,9 @@ _mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) { GLubyte red, green; - unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data), + unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data, i, j, &red, 2); - unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8, + unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data + 8, i, j, &green, 2); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = UBYTE_TO_FLOAT(green); @@ -366,9 +366,9 @@ _mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texIma GLint i, GLint j, GLint k, GLfloat *texel) { GLbyte red, green; - signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data), + signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data), i, j, &red, 2); - signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8, + signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8, i, j, &green, 2); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); texel[GCOMP] = BYTE_TO_FLOAT_TEX(green); @@ -381,7 +381,7 @@ _mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) { GLubyte red; - unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data), + unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data, i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = @@ -394,7 +394,7 @@ _mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImag GLint i, GLint j, GLint k, GLfloat *texel) { GLbyte red; - signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data), + signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data), i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = @@ -407,9 +407,9 @@ _mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) { GLubyte red, green; - unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data), + unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data, i, j, &red, 2); - unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8, + unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Data + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = @@ -422,9 +422,9 @@ _mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texIma GLint i, GLint j, GLint k, GLfloat *texel) { GLbyte red, green; - signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data), + signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data), i, j, &red, 2); - signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8, + signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 904aa457ecc..ed7eae4f46d 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -398,8 +398,8 @@ fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage, { (void) k; if (fetch_ext_rgb_dxt1) { - fetch_ext_rgb_dxt1(texImage->Base.RowStride, - (GLubyte *)(texImage)->Base.Data, i, j, texel); + fetch_ext_rgb_dxt1(texImage->RowStride, + texImage->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1"); @@ -426,8 +426,8 @@ fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage, { (void) k; if (fetch_ext_rgba_dxt1) { - fetch_ext_rgba_dxt1(texImage->Base.RowStride, - (GLubyte *)(texImage)->Base.Data, i, j, texel); + fetch_ext_rgba_dxt1(texImage->RowStride, + texImage->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n"); @@ -454,9 +454,8 @@ fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage, { (void) k; if (fetch_ext_rgba_dxt3) { - fetch_ext_rgba_dxt3(texImage->Base.RowStride, - (GLubyte *)(texImage)->Base.Data, - i, j, texel); + fetch_ext_rgba_dxt3(texImage->RowStride, + texImage->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n"); @@ -483,9 +482,8 @@ fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage, { (void) k; if (fetch_ext_rgba_dxt5) { - fetch_ext_rgba_dxt5(texImage->Base.RowStride, - (GLubyte *)(texImage)->Base.Data, - i, j, texel); + fetch_ext_rgba_dxt5(texImage->RowStride, + texImage->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n"); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2d06f84bf68..69b95850536 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -612,12 +612,14 @@ _mesa_free_texture_image_data(struct gl_context *ctx, { (void) ctx; +#if 0 if (texImage->Data) { /* free the old texture data */ _mesa_free_texmemory(texImage->Data); } texImage->Data = NULL; +#endif } @@ -639,10 +641,12 @@ _mesa_delete_texture_image(struct gl_context *ctx, ASSERT(ctx->Driver.FreeTextureImageBuffer); ctx->Driver.FreeTextureImageBuffer( ctx, texImage ); +#if 0 ASSERT(texImage->Data == NULL); if (texImage->ImageOffsets) free(texImage->ImageOffsets); free(texImage); +#endif } @@ -1084,18 +1088,19 @@ clear_teximage_fields(struct gl_texture_image *img) img->Width = 0; img->Height = 0; img->Depth = 0; +#if 0 img->RowStride = 0; if (img->ImageOffsets) { free(img->ImageOffsets); img->ImageOffsets = NULL; } +#endif img->Width2 = 0; img->Height2 = 0; img->Depth2 = 0; img->WidthLog2 = 0; img->HeightLog2 = 0; img->DepthLog2 = 0; - img->Data = NULL; img->TexFormat = MESA_FORMAT_NONE; } @@ -1123,8 +1128,6 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, GLint border, GLenum internalFormat, gl_format format) { - GLint i; - ASSERT(img); ASSERT(width >= 0); ASSERT(height >= 0); @@ -1161,6 +1164,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); +#if 0 /* RowStride and ImageOffsets[] describe how to address texels in 'Data' */ img->RowStride = width; /* Allocate the ImageOffsets array and initialize to typical values. @@ -1173,6 +1177,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, for (i = 0; i < depth; i++) { img->ImageOffsets[i] = i * width * height; } +#endif img->TexFormat = format; } @@ -2409,7 +2414,6 @@ teximage(struct gl_context *ctx, GLuint dims, ctx->Driver.FreeTextureImageBuffer(ctx, texImage); - ASSERT(texImage->Data == NULL); texFormat = _mesa_choose_texture_format(ctx, texObj, target, level, internalFormat, format, type); @@ -2548,7 +2552,6 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) } else { ctx->Driver.FreeTextureImageBuffer(ctx, texImage); - ASSERT(texImage->Data == NULL); ctx->Driver.EGLImageTargetTexture2D(ctx, target, texObj, texImage, image); @@ -3370,7 +3373,6 @@ compressedteximage(struct gl_context *ctx, GLuint dims, gl_format texFormat; ctx->Driver.FreeTextureImageBuffer(ctx, texImage); - ASSERT(texImage->Data == NULL); texFormat = _mesa_choose_texture_format(ctx, texObj, target, level, internalFormat, GL_NONE, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index cc9fbc0208f..cd9249630be 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4906,7 +4906,6 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx, ASSERT(texImage->Width > 0); ASSERT(texImage->Height > 0); ASSERT(texImage->Depth == 1); - ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */ /* allocate storage for texture data */ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, |