summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c13
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c13
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tex.c29
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c5
4 files changed, 31 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 9e13ba6871a..dd436becab2 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -340,11 +340,8 @@ intelTexImage(GLcontext * ctx,
if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
- texImage->CompressedSize =
- ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
- texImage->Height, texImage->Depth,
- texImage->TexFormat);
- } else {
+ }
+ else {
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
@@ -495,7 +492,11 @@ intelTexImage(GLcontext * ctx,
else {
/* Allocate regular memory and store the image there temporarily. */
if (_mesa_is_format_compressed(texImage->TexFormat)) {
- sizeInBytes = texImage->CompressedSize;
+ sizeInBytes = ctx->Driver.CompressedTextureSize(ctx,
+ texImage->Width,
+ texImage->Height,
+ texImage->Depth,
+ texImage->TexFormat);
dstRowStride =
_mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index ce393ffeb6c..2c28011057d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -547,13 +547,7 @@ static void radeon_teximage(
if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
- texImage->CompressedSize =
- ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
- texImage->Height, texImage->Depth,
- texImage->TexFormat);
} else {
- texImage->CompressedSize = 0;
-
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
@@ -590,7 +584,12 @@ static void radeon_teximage(
} else {
int size;
if (_mesa_is_format_compressed(texImage->TexFormat)) {
- size = texImage->CompressedSize;
+ size = ctx->Driver.CompressedTextureSize(ctx,
+ texImage->Width,
+ texImage->Height,
+ texImage->Depth,
+ texImage->TexFormat);
+
} else {
size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat);
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
index 8b68137eedf..5e9421aa2ac 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
@@ -1409,13 +1409,13 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
if (_mesa_is_format_compressed(texImage->TexFormat)) {
- texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
- mml->width,
- mml->height,
- 1,
- mesaFormat);
+ GLuint compressedSize = ctx->Driver.CompressedTextureSize(ctx,
+ mml->width,
+ mml->height,
+ 1,
+ mesaFormat);
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width);
- texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize);
+ texImage->Data = _mesa_alloc_texmemory(compressedSize);
} else {
dstRowStride = mml->width * texelBytes;
texImage->Data = _mesa_alloc_texmemory(mml->width * mml->height * texelBytes);
@@ -1580,7 +1580,8 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
tdfxTexInfo *ti;
tdfxMipMapLevel *mml;
- GLuint mesaFormat;
+ gl_format mesaFormat;
+ GLuint compressedSize;
if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) {
fprintf(stderr, "tdfxCompressedTexImage2D: id=%d int 0x%x %dx%d\n",
@@ -1637,12 +1638,12 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
/* allocate new storage for texture image, if needed */
if (!texImage->Data) {
- texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
- mml->width,
- mml->height,
- 1,
- mesaFormat);
- texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize);
+ compressedSize = ctx->Driver.CompressedTextureSize(ctx,
+ mml->width,
+ mml->height,
+ 1,
+ mesaFormat);
+ texImage->Data = _mesa_alloc_texmemory(compressedSize);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
return;
@@ -1677,7 +1678,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
texImage->Data);
ti->padded = GL_TRUE;
} else {
- MEMCPY(texImage->Data, data, texImage->CompressedSize);
+ MEMCPY(texImage->Data, data, compressedSize);
}
RevalidateTexture(ctx, texObj);
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 13458aba1c2..a99aa9debc9 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -674,6 +674,7 @@ static void viaTexImage(GLcontext *ctx,
struct via_texture_object *viaObj = (struct via_texture_object *)texObj;
struct via_texture_image *viaImage = (struct via_texture_image *)texImage;
int heaps[3], nheaps, i;
+ GLuint compressedSize;
if (!is_empty_list(&vmesa->freed_tex_buffers)) {
viaCheckBreadcrumb(vmesa, 0);
@@ -697,7 +698,7 @@ static void viaTexImage(GLcontext *ctx,
if (texelBytes == 0) {
/* compressed format */
- texImage->CompressedSize =
+ compressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
texImage->TexFormat);
@@ -714,7 +715,7 @@ static void viaTexImage(GLcontext *ctx,
/* allocate memory */
if (_mesa_is_format_compressed(texImage->TexFormat))
- sizeInBytes = texImage->CompressedSize;
+ sizeInBytes = compressedSize;
else
sizeInBytes = postConvWidth * postConvHeight * texelBytes;