[Mesa-dev] [PATCH 3/4] mesa: simplify Driver.CompressedTex[Sub]Image function parameters

Brian Paul brian.e.paul at gmail.com
Mon Dec 26 15:09:37 PST 2011


From: Brian Paul <brianp at vmware.com>

As with previous commits, the target, level and texObj info can be
obtained through the texImage pointer.
---
 src/mesa/main/dd.h                     |   95 +++++++++++---------------------
 src/mesa/main/teximage.c               |   30 ++++------
 src/mesa/main/texstore.c               |   64 +++++++--------------
 src/mesa/main/texstore.h               |   51 +++++++----------
 src/mesa/state_tracker/st_cb_texture.c |   28 ++++-----
 5 files changed, 98 insertions(+), 170 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 05e6d35..5a306e3 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -336,96 +336,65 @@ struct dd_function_table {
 
    /**
     * Called by glCompressedTexImage1D().
-    *
-    * \param target user specified.
-    * \param format user specified.
-    * \param type user specified.
-    * \param pixels user specified.
-    * \param packing indicates the image packing of pixels.
-    * \param texObj is the target texture object.
-    * \param texImage is the target texture image.  It will have the texture \p
-    * width, \p height, \p depth, \p border and \p internalFormat information.
-    *      
-    * \a retainInternalCopy is returned by this function and indicates whether
-    * core Mesa should keep an internal copy of the texture image.
-    */
-   void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target,
-                                 GLint level, GLint internalFormat,
-                                 GLsizei width, GLint border,
-                                 GLsizei imageSize, const GLvoid *data,
-                                 struct gl_texture_object *texObj,
-                                 struct gl_texture_image *texImage );
+    * The parameters are the same as for glCompressedTexImage1D(), plus a
+    * pointer to the destination texure image.
+    */
+   void (*CompressedTexImage1D)(struct gl_context *ctx,
+                                struct gl_texture_image *texImage,
+                                GLint internalFormat,
+                                GLsizei width, GLint border,
+                                GLsizei imageSize, const GLvoid *data);
    /**
     * Called by glCompressedTexImage2D().
     *
     * \sa dd_function_table::CompressedTexImage1D.
     */
-   void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target,
-                                 GLint level, GLint internalFormat,
-                                 GLsizei width, GLsizei height, GLint border,
-                                 GLsizei imageSize, const GLvoid *data,
-                                 struct gl_texture_object *texObj,
-                                 struct gl_texture_image *texImage );
+   void (*CompressedTexImage2D)(struct gl_context *ctx,
+                                struct gl_texture_image *texImage,
+                                GLint internalFormat,
+                                GLsizei width, GLsizei height, GLint border,
+                                GLsizei imageSize, const GLvoid *data);
+
    /**
     * Called by glCompressedTexImage3D().
     *
     * \sa dd_function_table::CompressedTexImage3D.
     */
-   void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target,
-                                 GLint level, GLint internalFormat,
-                                 GLsizei width, GLsizei height, GLsizei depth,
-                                 GLint border,
-                                 GLsizei imageSize, const GLvoid *data,
-                                 struct gl_texture_object *texObj,
-                                 struct gl_texture_image *texImage );
+   void (*CompressedTexImage3D)(struct gl_context *ctx,
+                                struct gl_texture_image *texImage,
+                                GLint internalFormat,
+                                GLsizei width, GLsizei height, GLsizei depth,
+                                GLint border,
+                                GLsizei imageSize, const GLvoid *data);
 
    /**
     * Called by glCompressedTexSubImage1D().
-    * 
-    * \param target user specified.
-    * \param level user specified.
-    * \param xoffset user specified.
-    * \param yoffset user specified.
-    * \param zoffset user specified.
-    * \param width user specified.
-    * \param height user specified.
-    * \param depth user specified.
-    * \param imageSize user specified.
-    * \param data user specified.
-    * \param texObj is the target texture object.
-    * \param texImage is the target texture image.  It will have the texture \p
-    * width, \p height, \p depth, \p border and \p internalFormat information.
-    */
-   void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level,
+    */
+   void (*CompressedTexSubImage1D)(struct gl_context *ctx,
+                                   struct gl_texture_image *texImage,
                                    GLint xoffset, GLsizei width,
                                    GLenum format,
-                                   GLsizei imageSize, const GLvoid *data,
-                                   struct gl_texture_object *texObj,
-                                   struct gl_texture_image *texImage);
+                                   GLsizei imageSize, const GLvoid *data);
+
    /**
     * Called by glCompressedTexSubImage2D().
-    *
-    * \sa dd_function_table::CompressedTexImage3D.
     */
-   void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level,
+   void (*CompressedTexSubImage2D)(struct gl_context *ctx,
+                                   struct gl_texture_image *texImage,
                                    GLint xoffset, GLint yoffset,
                                    GLsizei width, GLint height,
                                    GLenum format,
-                                   GLsizei imageSize, const GLvoid *data,
-                                   struct gl_texture_object *texObj,
-                                   struct gl_texture_image *texImage);
+                                   GLsizei imageSize, const GLvoid *data);
+
    /**
     * Called by glCompressedTexSubImage3D().
-    *
-    * \sa dd_function_table::CompressedTexImage3D.
     */
-   void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level,
+   void (*CompressedTexSubImage3D)(struct gl_context *ctx,
+                                   struct gl_texture_image *texImage,
                                    GLint xoffset, GLint yoffset, GLint zoffset,
                                    GLsizei width, GLint height, GLint depth,
                                    GLenum format,
-                                   GLsizei imageSize, const GLvoid *data,
-                                   struct gl_texture_object *texObj,
-                                   struct gl_texture_image *texImage);
+                                   GLsizei imageSize, const GLvoid *data);
 
 
    /**
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 3dfe6df..d6275bb 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3446,27 +3446,24 @@ compressedteximage(struct gl_context *ctx, GLuint dims,
                switch (dims) {
                case 1:
                   ASSERT(ctx->Driver.CompressedTexImage1D);
-                  ctx->Driver.CompressedTexImage1D(ctx, target, level,
+                  ctx->Driver.CompressedTexImage1D(ctx, texImage,
                                                    internalFormat,
                                                    width,
-                                                   border, imageSize, data,
-                                                   texObj, texImage);
+                                                   border, imageSize, data);
                   break;
                case 2:
                   ASSERT(ctx->Driver.CompressedTexImage2D);
-                  ctx->Driver.CompressedTexImage2D(ctx, target, level,
+                  ctx->Driver.CompressedTexImage2D(ctx, texImage,
                                                    internalFormat,
                                                    width, height,
-                                                   border, imageSize, data,
-                                                   texObj, texImage);
+                                                   border, imageSize, data);
                   break;
                case 3:
                   ASSERT(ctx->Driver.CompressedTexImage3D);
-                  ctx->Driver.CompressedTexImage3D(ctx, target, level,
+                  ctx->Driver.CompressedTexImage3D(ctx, texImage,
                                                    internalFormat,
                                                    width, height, depth,
-                                                   border, imageSize, data,
-                                                   texObj, texImage);
+                                                   border, imageSize, data);
                   break;
                default:
                   _mesa_problem(ctx, "bad dims in compressedteximage");
@@ -3564,28 +3561,25 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
          switch (dims) {
          case 1:
             if (ctx->Driver.CompressedTexSubImage1D) {
-               ctx->Driver.CompressedTexSubImage1D(ctx, target, level,
+               ctx->Driver.CompressedTexSubImage1D(ctx, texImage,
                                                    xoffset, width,
-                                                   format, imageSize, data,
-                                                   texObj, texImage);
+                                                   format, imageSize, data);
             }
             break;
          case 2:
             if (ctx->Driver.CompressedTexSubImage2D) {
-               ctx->Driver.CompressedTexSubImage2D(ctx, target, level,
+               ctx->Driver.CompressedTexSubImage2D(ctx, texImage,
                                                    xoffset, yoffset,
                                                    width, height,
-                                                   format, imageSize, data,
-                                                   texObj, texImage);
+                                                   format, imageSize, data);
             }
             break;
          case 3:
             if (ctx->Driver.CompressedTexSubImage3D) {
-               ctx->Driver.CompressedTexSubImage3D(ctx, target, level,
+               ctx->Driver.CompressedTexSubImage3D(ctx, texImage,
                                                    xoffset, yoffset, zoffset,
                                                    width, height, depth,
-                                                   format, imageSize, data,
-                                                   texObj, texImage);
+                                                   format, imageSize, data);
             }
             break;
          default:
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 5e18b8a..1625ed9 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4834,20 +4834,16 @@ _mesa_store_texsubimage3d(struct gl_context *ctx,
  */
 void
 _mesa_store_compressed_teximage1d(struct gl_context *ctx,
-                                  GLenum target, GLint level,
+                                  struct gl_texture_image *texImage,
                                   GLint internalFormat,
                                   GLint width, GLint border,
-                                  GLsizei imageSize, const GLvoid *data,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage)
+                                  GLsizei imageSize, const GLvoid *data)
 {
-   /* this space intentionally left blank */
+   /* no compressed 1D image formats at this time */
    (void) ctx;
-   (void) target; (void) level;
    (void) internalFormat;
    (void) width; (void) border;
    (void) imageSize; (void) data;
-   (void) texObj;
    (void) texImage;
 }
 
@@ -4858,18 +4854,15 @@ _mesa_store_compressed_teximage1d(struct gl_context *ctx,
  */
 void
 _mesa_store_compressed_teximage2d(struct gl_context *ctx,
-                                  GLenum target, GLint level,
+                                  struct gl_texture_image *texImage,
                                   GLint internalFormat,
                                   GLint width, GLint height, GLint border,
-                                  GLsizei imageSize, const GLvoid *data,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage)
+                                  GLsizei imageSize, const GLvoid *data)
 {
    /* This is pretty simple, because unlike the general texstore path we don't
     * have to worry about the usual image unpacking or image transfer
     * operations.
     */
-   ASSERT(texObj);
    ASSERT(texImage);
    ASSERT(texImage->Width > 0);
    ASSERT(texImage->Height > 0);
@@ -4882,12 +4875,11 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx,
       return;
    }
 
-   _mesa_store_compressed_texsubimage2d(ctx, target, level,
+   _mesa_store_compressed_texsubimage2d(ctx, texImage,
 					0, 0,
 					width, height,
 					texImage->TexFormat,
-					imageSize, data,
-					texObj, texImage);
+					imageSize, data);
 }
 
 
@@ -4897,22 +4889,18 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx,
  */
 void
 _mesa_store_compressed_teximage3d(struct gl_context *ctx,
-                                  GLenum target, GLint level,
+                                  struct gl_texture_image *texImage,
                                   GLint internalFormat,
                                   GLint width, GLint height, GLint depth,
                                   GLint border,
-                                  GLsizei imageSize, const GLvoid *data,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage)
+                                  GLsizei imageSize, const GLvoid *data)
 {
    /* this space intentionally left blank */
    (void) ctx;
-   (void) target; (void) level;
    (void) internalFormat;
    (void) width; (void) height; (void) depth;
    (void) border;
    (void) imageSize; (void) data;
-   (void) texObj;
    (void) texImage;
 }
 
@@ -4922,21 +4910,17 @@ _mesa_store_compressed_teximage3d(struct gl_context *ctx,
  * Fallback for Driver.CompressedTexSubImage1D()
  */
 void
-_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
-                                     GLint level,
+_mesa_store_compressed_texsubimage1d(struct gl_context *ctx,
+                                     struct gl_texture_image *texImage,
                                      GLint xoffset, GLsizei width,
                                      GLenum format,
-                                     GLsizei imageSize, const GLvoid *data,
-                                     struct gl_texture_object *texObj,
-                                     struct gl_texture_image *texImage)
+                                     GLsizei imageSize, const GLvoid *data)
 {
    /* there are no compressed 1D texture formats yet */
    (void) ctx;
-   (void) target; (void) level;
    (void) xoffset; (void) width;
    (void) format;
    (void) imageSize; (void) data;
-   (void) texObj;
    (void) texImage;
 }
 
@@ -4945,14 +4929,12 @@ _mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
  * Fallback for Driver.CompressedTexSubImage2D()
  */
 void
-_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
-                                     GLint level,
+_mesa_store_compressed_texsubimage2d(struct gl_context *ctx,
+                                     struct gl_texture_image *texImage,
                                      GLint xoffset, GLint yoffset,
                                      GLsizei width, GLsizei height,
                                      GLenum format,
-                                     GLsizei imageSize, const GLvoid *data,
-                                     struct gl_texture_object *texObj,
-                                     struct gl_texture_image *texImage)
+                                     GLsizei imageSize, const GLvoid *data)
 {
    GLint bytesPerRow, dstRowStride, srcRowStride;
    GLint i, rows;
@@ -5010,22 +4992,18 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
  * Fallback for Driver.CompressedTexSubImage3D()
  */
 void
-_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target,
-                                GLint level,
-                                GLint xoffset, GLint yoffset, GLint zoffset,
-                                GLsizei width, GLsizei height, GLsizei depth,
-                                GLenum format,
-                                GLsizei imageSize, const GLvoid *data,
-                                struct gl_texture_object *texObj,
-                                struct gl_texture_image *texImage)
+_mesa_store_compressed_texsubimage3d(struct gl_context *ctx,
+                                     struct gl_texture_image *texImage,
+                                     GLint xoffset, GLint yoffset, GLint zoffset,
+                                     GLsizei width, GLsizei height, GLsizei depth,
+                                     GLenum format,
+                                     GLsizei imageSize, const GLvoid *data)
 {
    /* there are no compressed 3D texture formats yet */
    (void) ctx;
-   (void) target; (void) level;
    (void) xoffset; (void) yoffset; (void) zoffset;
    (void) width; (void) height; (void) depth;
    (void) format;
    (void) imageSize; (void) data;
-   (void) texObj;
    (void) texImage;
 }
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index 2a9b177..a9d3c06 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -144,59 +144,50 @@ _mesa_store_texsubimage3d(struct gl_context *ctx,
 
 
 extern void
-_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage1d(struct gl_context *ctx,
+                                  struct gl_texture_image *texImage,
                                   GLint internalFormat,
                                   GLint width, GLint border,
-                                  GLsizei imageSize, const GLvoid *data,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage);
+                                  GLsizei imageSize, const GLvoid *data);
 
 extern void
-_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage2d(struct gl_context *ctx,
+                                  struct gl_texture_image *texImage,
                                   GLint internalFormat,
                                   GLint width, GLint height, GLint border,
-                                  GLsizei imageSize, const GLvoid *data,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage);
+                                  GLsizei imageSize, const GLvoid *data);
 
 extern void
-_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage3d(struct gl_context *ctx,
+                                  struct gl_texture_image *texImage,
                                   GLint internalFormat,
                                   GLint width, GLint height, GLint depth,
                                   GLint border,
-                                  GLsizei imageSize, const GLvoid *data,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage);
+                                  GLsizei imageSize, const GLvoid *data);
 
 
 extern void
-_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
-                                     GLint level,
+_mesa_store_compressed_texsubimage1d(struct gl_context *ctx,
+                                     struct gl_texture_image *texImage,
                                      GLint xoffset, GLsizei width,
                                      GLenum format,
-                                     GLsizei imageSize, const GLvoid *data,
-                                     struct gl_texture_object *texObj,
-                                     struct gl_texture_image *texImage);
+                                     GLsizei imageSize, const GLvoid *data);
 
 extern void
-_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
-                                     GLint level,
+_mesa_store_compressed_texsubimage2d(struct gl_context *ctx,
+                                     struct gl_texture_image *texImage,
                                      GLint xoffset, GLint yoffset,
                                      GLsizei width, GLsizei height,
                                      GLenum format,
-                                     GLsizei imageSize, const GLvoid *data,
-                                     struct gl_texture_object *texObj,
-                                     struct gl_texture_image *texImage);
+                                     GLsizei imageSize, const GLvoid *data);
 
 extern void
-_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target,
-                                GLint level,
-                                GLint xoffset, GLint yoffset, GLint zoffset,
-                                GLsizei width, GLsizei height, GLsizei depth,
-                                GLenum format,
-                                GLsizei imageSize, const GLvoid *data,
-                                struct gl_texture_object *texObj,
-                                struct gl_texture_image *texImage);
+_mesa_store_compressed_texsubimage3d(struct gl_context *ctx,
+                                     struct gl_texture_image *texImage,
+                                     GLint xoffset, GLint yoffset, GLint zoffset,
+                                     GLsizei width, GLsizei height, GLsizei depth,
+                                     GLenum format,
+                                     GLsizei imageSize, const GLvoid *data);
 
 
 #endif
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 8597dff..ecd21ad 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -776,12 +776,11 @@ st_TexImage1D(struct gl_context * ctx,
 
 
 static void
-st_CompressedTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
+st_CompressedTexImage2D(struct gl_context *ctx,
+                        struct gl_texture_image *texImage,
                         GLint internalFormat,
                         GLint width, GLint height, GLint border,
-                        GLsizei imageSize, const GLvoid *data,
-                        struct gl_texture_object *texObj,
-                        struct gl_texture_image *texImage)
+                        GLsizei imageSize, const GLvoid *data)
 {
    st_TexImage(ctx, 2, texImage, internalFormat, width, height, 1, border,
                0, 0, data, &ctx->Unpack, imageSize, GL_TRUE);
@@ -924,25 +923,23 @@ st_GetTexImage(struct gl_context * ctx,
 
 
 static void
-st_CompressedTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
+st_CompressedTexSubImage1D(struct gl_context *ctx,
+                           struct gl_texture_image *texImage,
                            GLint xoffset, GLsizei width,
                            GLenum format,
-                           GLsizei imageSize, const GLvoid *data,
-                           struct gl_texture_object *texObj,
-                           struct gl_texture_image *texImage)
+                           GLsizei imageSize, const GLvoid *data)
 {
    assert(0);
 }
 
 
 static void
-st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
+st_CompressedTexSubImage2D(struct gl_context *ctx,
+                           struct gl_texture_image *texImage,
                            GLint xoffset, GLint yoffset,
                            GLsizei width, GLint height,
                            GLenum format,
-                           GLsizei imageSize, const GLvoid *data,
-                           struct gl_texture_object *texObj,
-                           struct gl_texture_image *texImage)
+                           GLsizei imageSize, const GLvoid *data)
 {
    struct st_context *st = st_context(ctx);
    struct st_texture_image *stImage = st_texture_image(texImage);
@@ -991,13 +988,12 @@ st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
 
 
 static void
-st_CompressedTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
+st_CompressedTexSubImage3D(struct gl_context *ctx,
+                           struct gl_texture_image *texImage,
                            GLint xoffset, GLint yoffset, GLint zoffset,
                            GLsizei width, GLint height, GLint depth,
                            GLenum format,
-                           GLsizei imageSize, const GLvoid *data,
-                           struct gl_texture_object *texObj,
-                           struct gl_texture_image *texImage)
+                           GLsizei imageSize, const GLvoid *data)
 {
    assert(0);
 }
-- 
1.7.1



More information about the mesa-dev mailing list