[Mesa-dev] [PATCH 08/19] mesa: Add a texUnit parameter to dd_function_table::BindTexture

Fredrik Höglund fredrik at kde.org
Mon Apr 21 14:57:46 PDT 2014


This is for glBindTextures(), since it doesn't change the active
texture unit.
---
 src/mesa/drivers/dri/nouveau/nouveau_texture.c | 8 ++++----
 src/mesa/main/dd.h                             | 6 +++---
 src/mesa/main/texobj.c                         | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index ae8dbd4..e7d5c02 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -575,11 +575,11 @@ nouveau_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
 }
 
 static void
-nouveau_bind_texture(struct gl_context *ctx, GLenum target,
-		     struct gl_texture_object *t)
+nouveau_bind_texture(struct gl_context *ctx, GLuint texUnit,
+                     GLenum target, struct gl_texture_object *t)
 {
-	context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
-	context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
+	context_dirty_i(ctx, TEX_OBJ, texUnit);
+	context_dirty_i(ctx, TEX_ENV, texUnit);
 }
 
 static mesa_format
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 9715241..633ea2c 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -314,10 +314,10 @@ struct dd_function_table {
    /*@{*/
 
    /**
-    * Called by glBindTexture().
+    * Called by glBindTexture() and glBindTextures().
     */
-   void (*BindTexture)( struct gl_context *ctx, GLenum target,
-                        struct gl_texture_object *tObj );
+   void (*BindTexture)( struct gl_context *ctx, GLuint texUnit,
+                        GLenum target, struct gl_texture_object *tObj );
 
    /**
     * Called to allocate a new texture object.  Drivers will usually
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2153b94..4fcf35c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1388,7 +1388,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
 
    /* Pass BindTexture call to device driver */
    if (ctx->Driver.BindTexture)
-      ctx->Driver.BindTexture(ctx, target, newTexObj);
+      ctx->Driver.BindTexture(ctx, ctx->Texture.CurrentUnit, target, newTexObj);
 }
 
 
-- 
1.8.5.3



More information about the mesa-dev mailing list