Mesa (master): mesa: Store the target index in gl_texture_object

Fredrik Höglund fredrik at kemper.freedesktop.org
Fri May 2 01:21:26 UTC 2014


Module: Mesa
Branch: master
Commit: 6bf8ac846aeb8b6e53b4a3545ee5f8ce94055ae7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6bf8ac846aeb8b6e53b4a3545ee5f8ce94055ae7

Author: Fredrik Höglund <fredrik at kde.org>
Date:   Tue Nov 12 17:23:05 2013 +0100

mesa: Store the target index in gl_texture_object

This will be used by glBindTextures() so we don't have to look it up
for each texture.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/mtypes.h |    2 ++
 src/mesa/main/texobj.c |    2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 5e9c89d..c0a2f86 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1195,6 +1195,8 @@ struct gl_texture_object
    GLuint Name;                /**< the user-visible texture object ID */
    GLchar *Label;               /**< GL_KHR_debug */
    GLenum Target;              /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
+   gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
+                                      Only valid when Target is valid. */
 
    struct gl_sampler_object Sampler;
 
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 85246c8..42d057c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -260,6 +260,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
                            const struct gl_texture_object *src )
 {
    dest->Target = src->Target;
+   dest->TargetIndex = src->TargetIndex;
    dest->Name = src->Name;
    dest->Priority = src->Priority;
    dest->Sampler.BorderColor.f[0] = src->Sampler.BorderColor.f[0];
@@ -1327,6 +1328,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
          mtx_unlock(&ctx->Shared->Mutex);
       }
       newTexObj->Target = target;
+      newTexObj->TargetIndex = targetIndex;
    }
 
    assert(valid_texture_object(newTexObj));




More information about the mesa-commit mailing list