mesa: change compressed texture size calls
authorBrian Paul <brianp@vmware.com>
Sat, 24 Oct 2009 22:28:24 +0000 (16:28 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 24 Oct 2009 22:28:27 +0000 (16:28 -0600)
Replace calls to ctx->Driver.CompressedTextureSize with calls to
_mesa_format_image_size.  The former always called the later.

src/mesa/drivers/dri/intel/intel_tex_image.c
src/mesa/drivers/dri/radeon/radeon_texture.c
src/mesa/drivers/dri/tdfx/tdfx_tex.c
src/mesa/drivers/dri/unichrome/via_tex.c
src/mesa/main/mipmap.c
src/mesa/state_tracker/st_cb_texture.c

index b159010b8ea10952884b47d0f8f007e55388ff22..cbe29f61a2bac5dc91680a0642981d62be1fb1f1 100644 (file)
@@ -488,11 +488,10 @@ intelTexImage(GLcontext * ctx,
    else {
       /* Allocate regular memory and store the image there temporarily.   */
       if (_mesa_is_format_compressed(texImage->TexFormat)) {
-         sizeInBytes = ctx->Driver.CompressedTextureSize(ctx,
-                                                         texImage->Width,
-                                                         texImage->Height,
-                                                         texImage->Depth,
-                                                         texImage->TexFormat);
+         sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
+                                               texImage->Width,
+                                               texImage->Height,
+                                               texImage->Depth);
          dstRowStride =
             _mesa_compressed_row_stride(texImage->TexFormat, width);
          assert(dims != 3);
index 8e9276c5ae2c50fc3eeb02f2d931fc3f975cd348..1a48e8c95544647eceaade2a6707005974f3f8c0 100644 (file)
@@ -580,12 +580,10 @@ static void radeon_teximage(
        } else {
                int size;
                if (_mesa_is_format_compressed(texImage->TexFormat)) {
-                        size = ctx->Driver.CompressedTextureSize(ctx,
-                                                         texImage->Width,
-                                                         texImage->Height,
-                                                         texImage->Depth,
-                                                         texImage->TexFormat);
-
+                       size = _mesa_format_image_size(texImage->TexFormat,
+                                                      texImage->Width,
+                                                      texImage->Height,
+                                                      texImage->Depth);
                } else {
                        size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat);
                }
index 0cd9051613b04e2053532be8b18d00c2961b0a70..63783d6ecd8167d952a9efb0bec3119ca9584303 100644 (file)
@@ -1408,11 +1408,8 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
     texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
 
     if (_mesa_is_format_compressed(texImage->TexFormat)) {
-       GLuint compressedSize = ctx->Driver.CompressedTextureSize(ctx,
-                                                                 mml->width,
-                                                                 mml->height,
-                                                                 1,
-                                                                 mesaFormat);
+       GLuint compressedSize = _mesa_format_image_size(mesaFormat, mml->width,
+                                                       mml->height, 1);
        dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width);
        texImage->Data = _mesa_alloc_texmemory(compressedSize);
     } else {
@@ -1637,11 +1634,8 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
 
     /* allocate new storage for texture image, if needed */
     if (!texImage->Data) {
-       compressedSize = ctx->Driver.CompressedTextureSize(ctx,
-                                                          mml->width,
-                                                          mml->height,
-                                                          1,
-                                                          mesaFormat);
+       compressedSize = _mesa_format_image_size(mesaFormat, mml->width,
+                                                mml->height, 1);
        texImage->Data = _mesa_alloc_texmemory(compressedSize);
        if (!texImage->Data) {
           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
index a72dcd6be21a1bdb36500a27ab8e9ee6e2af8687..1bc5ddc429ce9a51b1df21849b4545dd25254248 100644 (file)
@@ -672,7 +672,6 @@ 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);
@@ -692,14 +691,6 @@ static void viaTexImage(GLcontext *ctx,
 
    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 */
    if (postConvWidth * texelBytes < 32) {
       postConvWidth = 32 / texelBytes;
@@ -711,7 +702,10 @@ static void viaTexImage(GLcontext *ctx,
 
    /* allocate memory */
    if (_mesa_is_format_compressed(texImage->TexFormat))
-      sizeInBytes = compressedSize;
+      sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
+                                            texImage->Width,
+                                            texImage->Height,
+                                            texImage->Depth);
    else
       sizeInBytes = postConvWidth * postConvHeight * texelBytes;
 
index 694d593330bf049ff90ec16b5014d0fda6faa03f..40cf43dfff0ab418fdc6b73abfcf4f6783cb797d 100644 (file)
@@ -1618,11 +1618,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
        * Setup src and dest data pointers.
        */
       if (_mesa_is_format_compressed(dstImage->TexFormat)) {
-         GLuint dstCompressedSize
-            = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width,
-                                              dstImage->Height,
-                                              dstImage->Depth,
-                                              dstImage->TexFormat);
+         GLuint dstCompressedSize = 
+            _mesa_format_image_size(dstImage->TexFormat, dstImage->Width,
+                                    dstImage->Height, dstImage->Depth);
          ASSERT(dstCompressedSize > 0);
 
          dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize);
index 01b8e5fd777b9c9467956bafcc601fd9ba852b10..f68620aec40554f0ff8be1987cedbe0b423daf19 100644 (file)
@@ -694,11 +694,10 @@ st_TexImage(GLcontext * ctx,
    else {
       /* Allocate regular memory and store the image there temporarily.   */
       if (_mesa_is_format_compressed(texImage->TexFormat)) {
-         sizeInBytes = ctx->Driver.CompressedTextureSize(ctx,
-                                                         texImage->Width,
-                                                         texImage->Height,
-                                                         texImage->Depth,
-                                                         texImage->TexFormat);
+         sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
+                                               texImage->Width,
+                                               texImage->Height,
+                                               texImage->Depth);
          dstRowStride =
             _mesa_compressed_row_stride(texImage->TexFormat, width);
          assert(dims != 3);