mesa: minor improvements to _mesa_compute_compressed_pixelstore()
authorBrian Paul <brianp@vmware.com>
Fri, 15 Aug 2014 21:21:01 +0000 (15:21 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 16 Aug 2014 12:48:44 +0000 (06:48 -0600)
Replace the gl_texture_image parameter with mesa_format since we only
used the image's format.

Add some comments.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/main/texgetimage.c
src/mesa/main/texstore.c
src/mesa/main/texstore.h

index f1e09c986aa63c97f8c0b1cfb90f66b897594919..9b2f72150ec21b38de2e8992035516bff72be317 100644 (file)
@@ -693,7 +693,7 @@ _mesa_get_compressed_teximage(struct gl_context *ctx,
    GLuint i, slice;
    GLubyte *dest;
 
-   _mesa_compute_compressed_pixelstore(dimensions, texImage,
+   _mesa_compute_compressed_pixelstore(dimensions, texImage->TexFormat,
                                        texImage->Width, texImage->Height,
                                        texImage->Depth,
                                        &ctx->Pack,
index f2eb0def233d795c3c10d01c4dc55b3707be293d..d2aba8ba1e30ae40a578d556933817bac148ca2e 100644 (file)
@@ -2191,14 +2191,23 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
 }
 
 
+/**
+ * Compute compressed_pixelstore parameters for copying compressed
+ * texture data.
+ * \param dims  number of texture image dimensions: 1, 2 or 3
+ * \param texFormat  the compressed texture format
+ * \param width, height, depth  size of image to copy
+ * \param packing  pixelstore parameters describing user-space image packing
+ * \param store  returns the compressed_pixelstore parameters
+ */
 void
-_mesa_compute_compressed_pixelstore(GLuint dims, struct gl_texture_image *texImage,
-                              GLsizei width, GLsizei height, GLsizei depth,
-                              const struct gl_pixelstore_attrib *packing,
-                              struct compressed_pixelstore *store)
+_mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat,
+                                    GLsizei width, GLsizei height,
+                                    GLsizei depth,
+                                    const struct gl_pixelstore_attrib *packing,
+                                    struct compressed_pixelstore *store)
 {
    GLuint bw, bh;
-   const mesa_format texFormat = texImage->TexFormat;
 
    _mesa_get_format_block_size(texFormat, &bw, &bh);
 
@@ -2268,8 +2277,9 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
       return;
    }
 
-   _mesa_compute_compressed_pixelstore(dims, texImage, width, height, depth,
-                                 &ctx->Unpack, &store);
+   _mesa_compute_compressed_pixelstore(dims, texImage->TexFormat,
+                                       width, height, depth,
+                                       &ctx->Unpack, &store);
 
    /* get pointer to src pixels (may be in a pbo which we'll map here) */
    data = _mesa_validate_pbo_compressed_teximage(ctx, dims, imageSize, data,
index dd1e1d0156226d33dd5527aae83b814520d93088..4c41d1fcd9a8c2e9ae878a3f9a259be1942e8456 100644 (file)
@@ -150,10 +150,11 @@ struct compressed_pixelstore {
 
 
 extern void
-_mesa_compute_compressed_pixelstore(GLuint dims, struct gl_texture_image *texImage,
-                              GLsizei width, GLsizei height, GLsizei depth,
-                              const struct gl_pixelstore_attrib *packing,
-                              struct compressed_pixelstore *store);
+_mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat,
+                                    GLsizei width, GLsizei height,
+                                    GLsizei depth,
+                                    const struct gl_pixelstore_attrib *packing,
+                                    struct compressed_pixelstore *store);
 
 
 #endif