diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/dd.h | 2 | ||||
-rw-r--r-- | src/mesa/main/mipmap.c | 23 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 3 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 42 |
5 files changed, 17 insertions, 55 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 9131f20f52..64bf9cba19 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -481,7 +481,7 @@ struct dd_function_table { */ GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, - GLenum format ); + GLuint mesaFormat ); /*@}*/ /** diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index f6d6ce33c8..e24e7285c3 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1614,24 +1614,19 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstImage->TexFormat = srcImage->TexFormat; dstImage->FetchTexelc = srcImage->FetchTexelc; dstImage->FetchTexelf = srcImage->FetchTexelf; + + /* Alloc new teximage data buffer. + * Setup src and dest data pointers. + */ if (_mesa_is_format_compressed(dstImage->TexFormat)) { - dstImage->CompressedSize + GLuint dstCompressedSize = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, dstImage->Height, dstImage->Depth, dstImage->TexFormat); - ASSERT(dstImage->CompressedSize > 0); - } - - ASSERT(dstImage->TexFormat); - ASSERT(dstImage->FetchTexelc); - ASSERT(dstImage->FetchTexelf); + ASSERT(dstCompressedSize > 0); - /* Alloc new teximage data buffer. - * Setup src and dest data pointers. - */ - if (_mesa_is_format_compressed(dstImage->TexFormat)) { - dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize); + dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; @@ -1653,6 +1648,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstData = (GLubyte *) dstImage->Data; } + ASSERT(dstImage->TexFormat); + ASSERT(dstImage->FetchTexelc); + ASSERT(dstImage->FetchTexelf); + _mesa_generate_mipmap_level(target, datatype, comps, border, srcWidth, srcHeight, srcDepth, srcData, srcImage->RowStride, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f084edb840..8e6e0d09be 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1173,8 +1173,6 @@ struct gl_texture_image FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */ FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */ - GLuint CompressedSize; /**< GL_ARB_texture_compression */ - 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 */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 86f46b9551..438a316b9c 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -903,7 +903,6 @@ clear_teximage_fields(struct gl_texture_image *img) img->TexFormat = MESA_FORMAT_NONE; img->FetchTexelc = NULL; img->FetchTexelf = NULL; - img->CompressedSize = 0; } @@ -966,8 +965,6 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); - img->CompressedSize = 0; - if ((width == 1 || _mesa_is_pow_two(img->Width2)) && (height == 1 || _mesa_is_pow_two(img->Height2)) && (depth == 1 || _mesa_is_pow_two(img->Depth2))) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 0fa8c44817..133b0370c8 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3159,34 +3159,12 @@ _mesa_unmap_teximage_pbo(GLcontext *ctx, } -static void -compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) -{ - if (_mesa_is_format_compressed(texImage->TexFormat)) { - texImage->CompressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); - } - else { - /* non-compressed format */ - texImage->CompressedSize = 0; - } -} - - /** Return texture size in bytes */ static GLuint texture_size(const struct gl_texture_image *texImage) { - GLuint sz; - - if (_mesa_is_format_compressed(texImage->TexFormat)) - sz = texImage->CompressedSize; - else - sz = texImage->Width * texImage->Height * texImage->Depth * - _mesa_get_format_bytes(texImage->TexFormat); - + GLuint sz = _mesa_format_image_size(texImage->TexFormat, texImage->Width, + texImage->Height, texImage->Depth); return sz; } @@ -3228,7 +3206,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLint sizeInBytes; + GLuint sizeInBytes; (void) border; texImage->TexFormat @@ -3236,11 +3214,9 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 1); - compute_texture_size(ctx, texImage); /* allocate memory */ sizeInBytes = texture_size(texImage); - texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); @@ -3293,7 +3269,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLint texelBytes, sizeInBytes; + GLuint sizeInBytes; (void) border; texImage->TexFormat @@ -3301,9 +3277,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 2); - compute_texture_size(ctx, texImage); - - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ sizeInBytes = texture_size(texImage); @@ -3355,7 +3328,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLint texelBytes, sizeInBytes; + GLuint sizeInBytes; (void) border; texImage->TexFormat @@ -3363,9 +3336,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 3); - compute_texture_size(ctx, texImage); - - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ sizeInBytes = texture_size(texImage); @@ -3570,7 +3540,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 2); - compute_texture_size(ctx, texImage); /* allocate storage */ texImage->Data = _mesa_alloc_texmemory(imageSize); @@ -3586,7 +3555,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, return; /* copy the data */ - ASSERT(texImage->CompressedSize == (GLuint) imageSize); MEMCPY(texImage->Data, data, imageSize); _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); |