mesa: change compressed texture size calls

Replace calls to ctx->Driver.CompressedTextureSize with calls to
_mesa_format_image_size.  The former always called the later.
This commit is contained in:
Brian Paul
2009-10-24 16:28:24 -06:00
parent bea245ac2f
commit 35efc6a1b3
6 changed files with 23 additions and 41 deletions

View File

@@ -488,11 +488,10 @@ intelTexImage(GLcontext * ctx,
else { else {
/* Allocate regular memory and store the image there temporarily. */ /* Allocate regular memory and store the image there temporarily. */
if (_mesa_is_format_compressed(texImage->TexFormat)) { if (_mesa_is_format_compressed(texImage->TexFormat)) {
sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
texImage->Width, texImage->Width,
texImage->Height, texImage->Height,
texImage->Depth, texImage->Depth);
texImage->TexFormat);
dstRowStride = dstRowStride =
_mesa_compressed_row_stride(texImage->TexFormat, width); _mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3); assert(dims != 3);

View File

@@ -580,12 +580,10 @@ static void radeon_teximage(
} else { } else {
int size; int size;
if (_mesa_is_format_compressed(texImage->TexFormat)) { if (_mesa_is_format_compressed(texImage->TexFormat)) {
size = ctx->Driver.CompressedTextureSize(ctx, size = _mesa_format_image_size(texImage->TexFormat,
texImage->Width, texImage->Width,
texImage->Height, texImage->Height,
texImage->Depth, texImage->Depth);
texImage->TexFormat);
} else { } else {
size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat);
} }

View File

@@ -1408,11 +1408,8 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
texelBytes = _mesa_get_format_bytes(texImage->TexFormat); texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
if (_mesa_is_format_compressed(texImage->TexFormat)) { if (_mesa_is_format_compressed(texImage->TexFormat)) {
GLuint compressedSize = ctx->Driver.CompressedTextureSize(ctx, GLuint compressedSize = _mesa_format_image_size(mesaFormat, mml->width,
mml->width, mml->height, 1);
mml->height,
1,
mesaFormat);
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width);
texImage->Data = _mesa_alloc_texmemory(compressedSize); texImage->Data = _mesa_alloc_texmemory(compressedSize);
} else { } else {
@@ -1637,11 +1634,8 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
/* allocate new storage for texture image, if needed */ /* allocate new storage for texture image, if needed */
if (!texImage->Data) { if (!texImage->Data) {
compressedSize = ctx->Driver.CompressedTextureSize(ctx, compressedSize = _mesa_format_image_size(mesaFormat, mml->width,
mml->width, mml->height, 1);
mml->height,
1,
mesaFormat);
texImage->Data = _mesa_alloc_texmemory(compressedSize); texImage->Data = _mesa_alloc_texmemory(compressedSize);
if (!texImage->Data) { if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");

View File

@@ -672,7 +672,6 @@ static void viaTexImage(GLcontext *ctx,
struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_object *viaObj = (struct via_texture_object *)texObj;
struct via_texture_image *viaImage = (struct via_texture_image *)texImage; struct via_texture_image *viaImage = (struct via_texture_image *)texImage;
int heaps[3], nheaps, i; int heaps[3], nheaps, i;
GLuint compressedSize;
if (!is_empty_list(&vmesa->freed_tex_buffers)) { if (!is_empty_list(&vmesa->freed_tex_buffers)) {
viaCheckBreadcrumb(vmesa, 0); viaCheckBreadcrumb(vmesa, 0);
@@ -692,14 +691,6 @@ static void viaTexImage(GLcontext *ctx,
texelBytes = _mesa_get_format_bytes(texImage->TexFormat); texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
if (texelBytes == 0) {
/* compressed format */
compressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
texImage->TexFormat);
}
/* Minimum pitch of 32 bytes */ /* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) { if (postConvWidth * texelBytes < 32) {
postConvWidth = 32 / texelBytes; postConvWidth = 32 / texelBytes;
@@ -711,7 +702,10 @@ static void viaTexImage(GLcontext *ctx,
/* allocate memory */ /* allocate memory */
if (_mesa_is_format_compressed(texImage->TexFormat)) if (_mesa_is_format_compressed(texImage->TexFormat))
sizeInBytes = compressedSize; sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
texImage->Width,
texImage->Height,
texImage->Depth);
else else
sizeInBytes = postConvWidth * postConvHeight * texelBytes; sizeInBytes = postConvWidth * postConvHeight * texelBytes;

View File

@@ -1618,11 +1618,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
* Setup src and dest data pointers. * Setup src and dest data pointers.
*/ */
if (_mesa_is_format_compressed(dstImage->TexFormat)) { if (_mesa_is_format_compressed(dstImage->TexFormat)) {
GLuint dstCompressedSize GLuint dstCompressedSize =
= ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, _mesa_format_image_size(dstImage->TexFormat, dstImage->Width,
dstImage->Height, dstImage->Height, dstImage->Depth);
dstImage->Depth,
dstImage->TexFormat);
ASSERT(dstCompressedSize > 0); ASSERT(dstCompressedSize > 0);
dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize); dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize);

View File

@@ -694,11 +694,10 @@ st_TexImage(GLcontext * ctx,
else { else {
/* Allocate regular memory and store the image there temporarily. */ /* Allocate regular memory and store the image there temporarily. */
if (_mesa_is_format_compressed(texImage->TexFormat)) { if (_mesa_is_format_compressed(texImage->TexFormat)) {
sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
texImage->Width, texImage->Width,
texImage->Height, texImage->Height,
texImage->Depth, texImage->Depth);
texImage->TexFormat);
dstRowStride = dstRowStride =
_mesa_compressed_row_stride(texImage->TexFormat, width); _mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3); assert(dims != 3);