mesa: remove _mesa_compressed_texture_size()
authorBrian Paul <brianp@vmware.com>
Sat, 24 Oct 2009 22:49:57 +0000 (16:49 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 24 Oct 2009 22:50:00 +0000 (16:50 -0600)
Use _mesa_format_image_size() instead.

src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
src/mesa/drivers/glide/fxddtex.c
src/mesa/main/texcompress.c
src/mesa/main/texcompress.h
src/mesa/main/texgetimage.c
src/mesa/main/texparam.c

index 86f596deb971a25f42de3dffe17d694fb0b58594..dadc72f4c1b142ade5cd0a834563f192adf7048a 100644 (file)
@@ -37,7 +37,7 @@ static GLuint radeon_compressed_texture_size(GLcontext *ctx,
                GLsizei width, GLsizei height, GLsizei depth,
                GLuint mesaFormat)
 {
-       GLuint size = _mesa_compressed_texture_size(ctx, width, height, depth, mesaFormat);
+       GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth);
 
        if (mesaFormat == MESA_FORMAT_RGB_DXT1 ||
            mesaFormat == MESA_FORMAT_RGBA_DXT1) {
index a820cb818ec40aeae49929cae897e521d547ced0..128c17e08bb3a5f65e52512623247e567a1b31c8 100644 (file)
@@ -1397,11 +1397,9 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
    /* allocate mipmap buffer */
    assert(!texImage->Data);
    if (_mesa_is_format_compressed(texImage->TexFormat)) {
-      texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
-                                                               mml->width,
-                                                               mml->height,
-                                                               1,
-                                                               internalFormat);
+      texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat,
+                                                         mml->width,
+                                                         mml->height, 1);
       dstRowStride = _mesa_compressed_row_stride(internalFormat, mml->width);
       texImage->Data = _mesa_malloc(texImage->CompressedSize);
    } else {
@@ -1664,11 +1662,9 @@ fxDDCompressedTexImage2D (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,
-                                                               internalFormat);
+      texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat,
+                                                         mml->width,
+                                                         mml->height, 1);
       texImage->Data = _mesa_malloc(texImage->CompressedSize);
       if (!texImage->Data) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
index b07265d6d842dcf386b0b0572b0766e090aed844..ad10993307e0dbe6a8ed478129531d6fad9e96f8 100644 (file)
@@ -113,30 +113,6 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all)
 }
 
 
-
-/**
- * Return number of bytes needed to store a texture of the given size
- * using the specified (compressed?) format.
- * This is called via the ctx->Driver.CompressedTextureSize function,
- * unless a device driver overrides it.  A driver might override this
- * if it needs to use an unusual or padded texture memory layout.
- *
- * \param width texture width in texels.
- * \param height texture height in texels.
- * \param depth texture depth in texels.
- * \param mesaFormat  one of the MESA_FORMAT_* compressed formats
- *
- * \return size in bytes, or zero if bad format
- */
-GLuint
-_mesa_compressed_texture_size( GLcontext *ctx,
-                               GLsizei width, GLsizei height, GLsizei depth,
-                               gl_format mesaFormat )
-{
-   return _mesa_format_image_size(mesaFormat, width, height, depth);
-}
-
-
 /**
  * As above, but format is specified by a GLenum (GL_COMPRESSED_*) token.
  *
index 13af1483942e3cb778abcbf199a26594cf0f6a26..70247098b2ae43bb5610f33a627428bd5ddaec6c 100644 (file)
 extern GLuint
 _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all);
 
-extern GLuint
-_mesa_compressed_texture_size( GLcontext *ctx,
-                               GLsizei width, GLsizei height, GLsizei depth,
-                               gl_format mesaFormat );
-
 extern GLuint
 _mesa_compressed_texture_size_glenum(GLcontext *ctx,
                                      GLsizei width, GLsizei height,
@@ -64,7 +59,6 @@ _mesa_init_texture_fxt1( GLcontext *ctx );
 
 /* no-op macros */
 #define _mesa_get_compressed_formats( c, f ) 0
-#define _mesa_compressed_texture_size( c, w, h, d, f ) 0
 #define _mesa_compressed_texture_size_glenum( c, w, h, d, f ) 0
 #define _mesa_compressed_row_stride( f, w) 0
 #define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0
index d5cd4b2b9db7b7fa6233f74bfeccb9841978a6f3..1f0a3d793f7dbc49d35f286667c818daf7ed29ab 100644 (file)
@@ -320,12 +320,10 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
                               struct gl_texture_object *texObj,
                               struct gl_texture_image *texImage)
 {
-   GLuint size;
-
-   /* don't use texImage->CompressedSize since that may be padded out */
-   size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
-                                        texImage->Depth,
-                                        texImage->TexFormat);
+   const GLuint size = _mesa_format_image_size(texImage->TexFormat,
+                                               texImage->Width,
+                                               texImage->Height,
+                                               texImage->Depth);
 
    if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
       /* pack texture image into a PBO */
index a6b611dffb2cf9b8d2c4afdbb2067f9a9367b696..afa66f149ce249817bfd684c72773f70799a26a8 100644 (file)
@@ -853,12 +853,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
       /* GL_ARB_texture_compression */
       case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
         if (_mesa_is_format_compressed(img->TexFormat) && !isProxy) {
-           /* Don't use ctx->Driver.CompressedTextureSize() since that
-            * may returned a padded hardware size.
-            */
-           *params = _mesa_compressed_texture_size(ctx, img->Width,
-                                                   img->Height, img->Depth,
-                                                   texFormat);
+            *params = _mesa_format_image_size(texFormat, img->Width,
+                                              img->Height, img->Depth);
         }
         else {
            _mesa_error(ctx, GL_INVALID_OPERATION,