[Mesa-dev] [PATCH 2/4] mesa: simplify Driver.TexImage() parameters

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


From: Brian Paul <brianp at vmware.com>

As with TexSubImage(), the target, level and texObj values can be obtained
through the texImage pointer.
---
 src/mesa/drivers/dri/intel/intel_tex_image.c   |   43 ++++++++------------
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   42 +++++++++----------
 src/mesa/drivers/dri/radeon/radeon_texture.c   |   50 +++++++++++------------
 src/mesa/drivers/dri/radeon/radeon_texture.h   |   23 +----------
 src/mesa/main/dd.h                             |   42 +++++++++-----------
 src/mesa/main/teximage.c                       |   23 +++++------
 src/mesa/main/texobj.c                         |    4 +-
 src/mesa/main/texstore.c                       |   21 ++++------
 src/mesa/main/texstore.h                       |   21 ++++------
 src/mesa/state_tracker/st_cb_texture.c         |   50 ++++++++++-------------
 10 files changed, 134 insertions(+), 185 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index dd0c6d3..53b22e5 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -200,16 +200,16 @@ try_pbo_upload(struct gl_context *ctx,
 static void
 intelTexImage(struct gl_context * ctx,
               GLint dims,
-              GLenum target, GLint level,
+              struct gl_texture_image *texImage,
               GLint internalFormat,
               GLint width, GLint height, GLint depth,
               GLenum format, GLenum type, const void *pixels,
               const struct gl_pixelstore_attrib *unpack,
-              struct gl_texture_object *texObj,
-              struct gl_texture_image *texImage, GLsizei imageSize)
+              GLsizei imageSize)
 {
    DBG("%s target %s level %d %dx%dx%d\n", __FUNCTION__,
-       _mesa_lookup_enum_by_nr(target), level, width, height, depth);
+       _mesa_lookup_enum_by_nr(texImage->TexObject->Target),
+       texImage->Level, width, height, depth);
 
    /* Attempt to use the blitter for PBO image uploads.
     */
@@ -222,59 +222,52 @@ intelTexImage(struct gl_context * ctx,
    DBG("%s: upload image %dx%dx%d pixels %p\n",
        __FUNCTION__, width, height, depth, pixels);
 
-   _mesa_store_teximage3d(ctx, target, level, internalFormat,
+   _mesa_store_teximage3d(ctx, texImage, internalFormat,
 			  width, height, depth, 0,
-			  format, type, pixels,
-			  unpack, texObj, texImage);
+			  format, type, pixels, unpack);
 }
 
 
 static void
 intelTexImage3D(struct gl_context * ctx,
-                GLenum target, GLint level,
+                struct gl_texture_image *texImage,
                 GLint internalFormat,
                 GLint width, GLint height, GLint depth,
                 GLint border,
                 GLenum format, GLenum type, const void *pixels,
-                const struct gl_pixelstore_attrib *unpack,
-                struct gl_texture_object *texObj,
-                struct gl_texture_image *texImage)
+                const struct gl_pixelstore_attrib *unpack)
 {
-   intelTexImage(ctx, 3, target, level,
+   intelTexImage(ctx, 3, texImage,
                  internalFormat, width, height, depth,
-                 format, type, pixels, unpack, texObj, texImage, 0);
+                 format, type, pixels, unpack, 0);
 }
 
 
 static void
 intelTexImage2D(struct gl_context * ctx,
-                GLenum target, GLint level,
+                struct gl_texture_image *texImage,
                 GLint internalFormat,
                 GLint width, GLint height, GLint border,
                 GLenum format, GLenum type, const void *pixels,
-                const struct gl_pixelstore_attrib *unpack,
-                struct gl_texture_object *texObj,
-                struct gl_texture_image *texImage)
+                const struct gl_pixelstore_attrib *unpack)
 {
-   intelTexImage(ctx, 2, target, level,
+   intelTexImage(ctx, 2, texImage,
                  internalFormat, width, height, 1,
-                 format, type, pixels, unpack, texObj, texImage, 0);
+                 format, type, pixels, unpack, 0);
 }
 
 
 static void
 intelTexImage1D(struct gl_context * ctx,
-                GLenum target, GLint level,
+                struct gl_texture_image *texImage,
                 GLint internalFormat,
                 GLint width, GLint border,
                 GLenum format, GLenum type, const void *pixels,
-                const struct gl_pixelstore_attrib *unpack,
-                struct gl_texture_object *texObj,
-                struct gl_texture_image *texImage)
+                const struct gl_pixelstore_attrib *unpack)
 {
-   intelTexImage(ctx, 1, target, level,
+   intelTexImage(ctx, 1, texImage,
                  internalFormat, width, 1, 1,
-                 format, type, pixels, unpack, texObj, texImage, 0);
+                 format, type, pixels, unpack, 0);
 }
 
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index e9f74e8..0fb80ff 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -452,14 +452,15 @@ get_teximage_placement(struct gl_texture_image *ti)
 }
 
 static void
-nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
+nouveau_teximage(struct gl_context *ctx, GLint dims,
+		 struct gl_texture_image *ti,
 		 GLint internalFormat,
 		 GLint width, GLint height, GLint depth, GLint border,
 		 GLenum format, GLenum type, const GLvoid *pixels,
-		 const struct gl_pixelstore_attrib *packing,
-		 struct gl_texture_object *t,
-		 struct gl_texture_image *ti)
+		 const struct gl_pixelstore_attrib *packing)
 {
+	struct gl_texture_object *t = ti->TexObject;
+	const GLuint level = ti->Level;
 	struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
 	struct nouveau_teximage *nti = to_nouveau_teximage(ti);
 	int ret;
@@ -505,45 +506,42 @@ nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
 }
 
 static void
-nouveau_teximage_1d(struct gl_context *ctx, GLenum target, GLint level,
+nouveau_teximage_1d(struct gl_context *ctx,
+		    struct gl_texture_image *ti,
 		    GLint internalFormat,
 		    GLint width, GLint border,
 		    GLenum format, GLenum type, const GLvoid *pixels,
-		    const struct gl_pixelstore_attrib *packing,
-		    struct gl_texture_object *t,
-		    struct gl_texture_image *ti)
+		    const struct gl_pixelstore_attrib *packing)
 {
-	nouveau_teximage(ctx, 1, target, level, internalFormat,
+	nouveau_teximage(ctx, 1, ti, internalFormat,
 			 width, 1, 1, border, format, type, pixels,
-			 packing, t, ti);
+			 packing);
 }
 
 static void
-nouveau_teximage_2d(struct gl_context *ctx, GLenum target, GLint level,
+nouveau_teximage_2d(struct gl_context *ctx,
+		    struct gl_texture_image *ti,
 		    GLint internalFormat,
 		    GLint width, GLint height, GLint border,
 		    GLenum format, GLenum type, const GLvoid *pixels,
-		    const struct gl_pixelstore_attrib *packing,
-		    struct gl_texture_object *t,
-		    struct gl_texture_image *ti)
+		    const struct gl_pixelstore_attrib *packing)
 {
-	nouveau_teximage(ctx, 2, target, level, internalFormat,
+	nouveau_teximage(ctx, 2, ti, internalFormat,
 			 width, height, 1, border, format, type, pixels,
-			 packing, t, ti);
+			 packing);
 }
 
 static void
-nouveau_teximage_3d(struct gl_context *ctx, GLenum target, GLint level,
+nouveau_teximage_3d(struct gl_context *ctx,
+		    struct gl_texture_image *ti,
 		    GLint internalFormat,
 		    GLint width, GLint height, GLint depth, GLint border,
 		    GLenum format, GLenum type, const GLvoid *pixels,
-		    const struct gl_pixelstore_attrib *packing,
-		    struct gl_texture_object *t,
-		    struct gl_texture_image *ti)
+		    const struct gl_pixelstore_attrib *packing)
 {
-	nouveau_teximage(ctx, 3, target, level, internalFormat,
+	nouveau_teximage(ctx, 3, ti, internalFormat,
 			 width, height, depth, border, format, type, pixels,
-			 packing, t, ti);
+			 packing);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 71eff75..78fb1b5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -578,58 +578,56 @@ static void teximage_assign_miptree(radeonContextPtr rmesa,
  */
 static void radeon_teximage(
 	struct gl_context *ctx, int dims,
-	GLenum target, GLint level,
+	struct gl_texture_image *texImage,
 	GLint internalFormat,
 	GLint width, GLint height, GLint depth,
 	GLsizei imageSize,
 	GLenum format, GLenum type, const GLvoid * pixels,
 	const struct gl_pixelstore_attrib *packing,
-	struct gl_texture_object *texObj,
-	struct gl_texture_image *texImage,
 	int compressed)
 {
-	_mesa_store_teximage3d(ctx, target, level, internalFormat,
+	_mesa_store_teximage3d(ctx, texImage, internalFormat,
 			       width, height, depth, 0,
 			       format, type, pixels,
-			       packing, texObj, texImage);
+			       packing);
 }
 
-void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
+static void
+radeonTexImage1D(struct gl_context * ctx,
+		      struct gl_texture_image *texImage,
 		      GLint internalFormat,
 		      GLint width, GLint border,
 		      GLenum format, GLenum type, const GLvoid * pixels,
-		      const struct gl_pixelstore_attrib *packing,
-		      struct gl_texture_object *texObj,
-		      struct gl_texture_image *texImage)
+		      const struct gl_pixelstore_attrib *packing)
 {
-	radeon_teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
-		0, format, type, pixels, packing, texObj, texImage, 0);
+	radeon_teximage(ctx, 1, texImage, internalFormat, width, 1, 1,
+		0, format, type, pixels, packing, 0);
 }
 
-void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
-			   GLint internalFormat,
-			   GLint width, GLint height, GLint border,
-			   GLenum format, GLenum type, const GLvoid * pixels,
-			   const struct gl_pixelstore_attrib *packing,
-			   struct gl_texture_object *texObj,
-			   struct gl_texture_image *texImage)
+static void
+radeonTexImage2D(struct gl_context * ctx,
+		      struct gl_texture_image *texImage,
+		      GLint internalFormat,
+		      GLint width, GLint height, GLint border,
+		      GLenum format, GLenum type, const GLvoid * pixels,
+		      const struct gl_pixelstore_attrib *packing)
 
 {
-	radeon_teximage(ctx, 2, target, level, internalFormat, width, height, 1,
-		0, format, type, pixels, packing, texObj, texImage, 0);
+	radeon_teximage(ctx, 2, texImage, internalFormat, width, height, 1,
+		0, format, type, pixels, packing, 0);
 }
 
-void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
+static void
+radeonTexImage3D(struct gl_context * ctx,
+		      struct gl_texture_image *texImage,
 		      GLint internalFormat,
 		      GLint width, GLint height, GLint depth,
 		      GLint border,
 		      GLenum format, GLenum type, const GLvoid * pixels,
-		      const struct gl_pixelstore_attrib *packing,
-		      struct gl_texture_object *texObj,
-		      struct gl_texture_image *texImage)
+		      const struct gl_pixelstore_attrib *packing)
 {
-	radeon_teximage(ctx, 3, target, level, internalFormat, width, height, depth,
-		0, format, type, pixels, packing, texObj, texImage, 0);
+	radeon_teximage(ctx, 3, texImage, internalFormat, width, height, depth,
+		0, format, type, pixels, packing, 0);
 }
 
 unsigned radeonIsFormatRenderable(gl_format mesa_format)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h
index f1af109..ebe16c0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.h
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.h
@@ -65,34 +65,13 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
                                     GLenum format,
                                     GLenum type, GLboolean fbo);
 
-void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
-		      GLint internalFormat,
-		      GLint width, GLint border,
-		      GLenum format, GLenum type, const GLvoid * pixels,
-		      const struct gl_pixelstore_attrib *packing,
-		      struct gl_texture_object *texObj,
-		      struct gl_texture_image *texImage);
-void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
-		      GLint internalFormat,
-		      GLint width, GLint height, GLint border,
-		      GLenum format, GLenum type, const GLvoid * pixels,
-		      const struct gl_pixelstore_attrib *packing,
-		      struct gl_texture_object *texObj,
-		      struct gl_texture_image *texImage);
 void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
 				GLint level, GLint internalFormat,
 				GLint width, GLint height, GLint border,
 				GLsizei imageSize, const GLvoid * data,
 				struct gl_texture_object *texObj,
 				struct gl_texture_image *texImage);
-void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
-		      GLint internalFormat,
-		      GLint width, GLint height, GLint depth,
-		      GLint border,
-		      GLenum format, GLenum type, const GLvoid * pixels,
-		      const struct gl_pixelstore_attrib *packing,
-		      struct gl_texture_object *texObj,
-		      struct gl_texture_image *texImage);
+
 void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
 			 GLint xoffset,
 			 GLsizei width,
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 5226a68..05e6d35 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -203,42 +203,38 @@ struct dd_function_table {
     * fully initialized.
     * The parameters are the same as glTexImage1D(), plus:
     * \param packing describes how to unpack the source data.
-    * \param texObj is the target texture object.
-    * \param texImage is the target texture image.
+    * \param texImage is the destination texture image.
     */
-   void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
-                       GLint internalFormat,
-                       GLint width, GLint border,
-                       GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage );
+   void (*TexImage1D)(struct gl_context *ctx,
+                      struct gl_texture_image *texImage,
+                      GLint internalFormat,
+                      GLint width, GLint border,
+                      GLenum format, GLenum type, const GLvoid *pixels,
+                      const struct gl_pixelstore_attrib *packing);
 
    /**
     * Called by glTexImage2D().
     * 
     * \sa dd_function_table::TexImage1D.
     */
-   void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
-                       GLint internalFormat,
-                       GLint width, GLint height, GLint border,
-                       GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage );
+   void (*TexImage2D)(struct gl_context *ctx,
+                      struct gl_texture_image *texImage,
+                      GLint internalFormat,
+                      GLint width, GLint height, GLint border,
+                      GLenum format, GLenum type, const GLvoid *pixels,
+                      const struct gl_pixelstore_attrib *packing);
    
    /**
     * Called by glTexImage3D().
     * 
     * \sa dd_function_table::TexImage1D.
     */
-   void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level,
-                       GLint internalFormat,
-                       GLint width, GLint height, GLint depth, GLint border,
-                       GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage );
+   void (*TexImage3D)(struct gl_context *ctx,
+                      struct gl_texture_image *texImage,
+                      GLint internalFormat,
+                      GLint width, GLint height, GLint depth, GLint border,
+                      GLenum format, GLenum type, const GLvoid *pixels,
+                      const struct gl_pixelstore_attrib *packing);
 
    /**
     * Called by glTexSubImage1D().  Replace a subset of the target texture
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ad7a1ea..3dfe6df 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2481,22 +2481,19 @@ teximage(struct gl_context *ctx, GLuint dims,
                ASSERT(ctx->Driver.TexImage3D);
                switch (dims) {
                case 1:
-                  ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+                  ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
                                          width, border, format,
-                                         type, pixels, unpack, texObj,
-                                         texImage);
+                                         type, pixels, unpack);
                   break;
                case 2:
-                  ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+                  ctx->Driver.TexImage2D(ctx, texImage, internalFormat,
                                          width, height, border, format,
-                                         type, pixels, unpack, texObj,
-                                         texImage);
+                                         type, pixels, unpack);
                   break;
                case 3:
-                  ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
+                  ctx->Driver.TexImage3D(ctx, texImage, internalFormat,
                                          width, height, depth, border, format,
-                                         type, pixels, unpack, texObj,
-                                         texImage);
+                                         type, pixels, unpack);
                   break;
                default:
                   _mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
@@ -2820,14 +2817,14 @@ copyteximage(struct gl_context *ctx, GLuint dims,
 
             /* Allocate texture memory (no pixel data yet) */
             if (dims == 1) {
-               ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+               ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
                                       width, border, GL_NONE, GL_NONE, NULL,
-                                      &ctx->Unpack, texObj, texImage);
+                                      &ctx->Unpack);
             }
             else {
-               ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+               ctx->Driver.TexImage2D(ctx, texImage, internalFormat,
                                       width, height, border, GL_NONE, GL_NONE,
-                                      NULL, &ctx->Unpack, texObj, texImage);
+                                      NULL, &ctx->Unpack);
             }
 
             if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 8e447ca..425cb5d 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -799,10 +799,10 @@ _mesa_get_fallback_texture(struct gl_context *ctx)
       ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
 
       /* set image data */
-      ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA,
+      ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA,
                              8, 8, 0,
                              GL_RGBA, GL_UNSIGNED_BYTE, texels,
-                             &ctx->DefaultPacking, texObj, texImage);
+                             &ctx->DefaultPacking);
 
       _mesa_test_texobj_completeness(ctx, texObj);
       assert(texObj->_Complete);
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index e97178d..5e18b8a 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4698,13 +4698,12 @@ store_texsubimage(struct gl_context *ctx,
  * This is the fallback for Driver.TexImage1D().
  */
 void
-_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage1d(struct gl_context *ctx,
+                       struct gl_texture_image *texImage,
                        GLint internalFormat,
                        GLint width, GLint border,
                        GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage)
+                       const struct gl_pixelstore_attrib *packing)
 {
    if (width == 0)
       return;
@@ -4726,13 +4725,12 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
  * This is the fallback for Driver.TexImage2D().
  */
 void
-_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage2d(struct gl_context *ctx,
+                       struct gl_texture_image *texImage,
                        GLint internalFormat,
                        GLint width, GLint height, GLint border,
                        GLenum format, GLenum type, const void *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage)
+                       const struct gl_pixelstore_attrib *packing)
 {
    if (width == 0 || height == 0)
       return;
@@ -4755,13 +4753,12 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
  * This is the fallback for Driver.TexImage3D().
  */
 void
-_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage3d(struct gl_context *ctx,
+                       struct gl_texture_image *texImage,
                        GLint internalFormat,
                        GLint width, GLint height, GLint depth, GLint border,
                        GLenum format, GLenum type, const void *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage)
+                       const struct gl_pixelstore_attrib *packing)
 {
    if (width == 0 || height == 0 || depth == 0)
       return;
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index 83826ce..2a9b177 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -91,33 +91,30 @@ _mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims,
 			    GLbitfield transferOps);
 
 extern void
-_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage1d(struct gl_context *ctx,
+                       struct gl_texture_image *texImage,
                        GLint internalFormat,
                        GLint width, GLint border,
                        GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage);
+                       const struct gl_pixelstore_attrib *packing);
 
 
 extern void
-_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage2d(struct gl_context *ctx,
+                       struct gl_texture_image *texImage,
                        GLint internalFormat,
                        GLint width, GLint height, GLint border,
                        GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage);
+                       const struct gl_pixelstore_attrib *packing);
 
 
 extern void
-_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage3d(struct gl_context *ctx,
+                       struct gl_texture_image *texImage,
                        GLint internalFormat,
                        GLint width, GLint height, GLint depth, GLint border,
                        GLenum format, GLenum type, const GLvoid *pixels,
-                       const struct gl_pixelstore_attrib *packing,
-                       struct gl_texture_object *texObj,
-                       struct gl_texture_image *texImage);
+                       const struct gl_pixelstore_attrib *packing);
 
 
 extern void
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 8d30d7a..8597dff 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -501,19 +501,20 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
 static void
 st_TexImage(struct gl_context * ctx,
             GLint dims,
-            GLenum target, GLint level,
+            struct gl_texture_image *texImage,
             GLint internalFormat,
             GLint width, GLint height, GLint depth,
             GLint border,
             GLenum format, GLenum type, const void *pixels,
             const struct gl_pixelstore_attrib *unpack,
-            struct gl_texture_object *texObj,
-            struct gl_texture_image *texImage,
             GLsizei imageSize, GLboolean compressed_src)
 {
    struct st_context *st = st_context(ctx);
+   struct gl_texture_object *texObj = texImage->TexObject;
    struct st_texture_object *stObj = st_texture_object(texObj);
    struct st_texture_image *stImage = st_texture_image(texImage);
+   const GLenum target = texObj->Target;
+   const GLuint level = texImage->Level;
    GLuint dstRowStride = 0;
    enum pipe_transfer_usage transfer_usage = 0;
    GLubyte *dstMap;
@@ -736,48 +737,41 @@ done:
 
 static void
 st_TexImage3D(struct gl_context * ctx,
-              GLenum target, GLint level,
+              struct gl_texture_image *texImage,
               GLint internalFormat,
               GLint width, GLint height, GLint depth,
               GLint border,
               GLenum format, GLenum type, const void *pixels,
-              const struct gl_pixelstore_attrib *unpack,
-              struct gl_texture_object *texObj,
-              struct gl_texture_image *texImage)
+              const struct gl_pixelstore_attrib *unpack)
 {
-   st_TexImage(ctx, 3, target, level, internalFormat, width, height, depth,
-               border, format, type, pixels, unpack, texObj, texImage,
-               0, GL_FALSE);
+   st_TexImage(ctx, 3, texImage, internalFormat, width, height, depth, border,
+               format, type, pixels, unpack, 0, GL_FALSE);
 }
 
 
 static void
 st_TexImage2D(struct gl_context * ctx,
-              GLenum target, GLint level,
+              struct gl_texture_image *texImage,
               GLint internalFormat,
               GLint width, GLint height, GLint border,
               GLenum format, GLenum type, const void *pixels,
-              const struct gl_pixelstore_attrib *unpack,
-              struct gl_texture_object *texObj,
-              struct gl_texture_image *texImage)
+              const struct gl_pixelstore_attrib *unpack)
 {
-   st_TexImage(ctx, 2, target, level, internalFormat, width, height, 1, border,
-               format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE);
+   st_TexImage(ctx, 2, texImage, internalFormat, width, height, 1, border,
+               format, type, pixels, unpack, 0, GL_FALSE);
 }
 
 
 static void
 st_TexImage1D(struct gl_context * ctx,
-              GLenum target, GLint level,
+              struct gl_texture_image *texImage,
               GLint internalFormat,
               GLint width, GLint border,
               GLenum format, GLenum type, const void *pixels,
-              const struct gl_pixelstore_attrib *unpack,
-              struct gl_texture_object *texObj,
-              struct gl_texture_image *texImage)
+              const struct gl_pixelstore_attrib *unpack)
 {
-   st_TexImage(ctx, 1, target, level, internalFormat, width, 1, 1, border,
-               format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE);
+   st_TexImage(ctx, 1, texImage, internalFormat, width, 1, 1, border,
+               format, type, pixels, unpack, 0, GL_FALSE);
 }
 
 
@@ -789,8 +783,8 @@ st_CompressedTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
                         struct gl_texture_object *texObj,
                         struct gl_texture_image *texImage)
 {
-   st_TexImage(ctx, 2, target, level, internalFormat, width, height, 1, border,
-               0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, GL_TRUE);
+   st_TexImage(ctx, 2, texImage, internalFormat, width, height, 1, border,
+               0, 0, data, &ctx->Unpack, imageSize, GL_TRUE);
 }
 
 
@@ -1644,13 +1638,13 @@ st_get_default_texture(struct st_context *st)
                                  16, 16, 1, 0,  /* w, h, d, border */
                                  GL_RGBA, MESA_FORMAT_RGBA8888);
 
-      st_TexImage(st->ctx, 2, target,
-                  0, GL_RGBA,    /* level, intformat */
+      st_TexImage(st->ctx, 2,
+                  texImg,
+                  GL_RGBA,    /* level, intformat */
                   16, 16, 1, 0,  /* w, h, d, border */
                   GL_RGBA, GL_UNSIGNED_BYTE, pixels,
                   &st->ctx->DefaultPacking,
-                  texObj, texImg,
-                  0, 0);
+                  0, GL_FALSE);
 
       texObj->Sampler.MinFilter = GL_NEAREST;
       texObj->Sampler.MagFilter = GL_NEAREST;
-- 
1.7.1



More information about the mesa-dev mailing list