[Mesa-dev,01/19] mesa: Store the target index in gl_texture_object

Submitted by Fredrik Höglund on April 21, 2014, 9:57 p.m.

Details

Message ID 1398117477-10313-2-git-send-email-fredrik@kde.org
State New
Headers show

Not browsing as part of any series.

Commit Message

Fredrik Höglund April 21, 2014, 9:57 p.m.
This will be used by glBindTextures() so we don't have to look it up
for each texture.
---

v2: Store the index as a gl_texture_index

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

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6694383..b07ad58 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1195,6 +1195,7 @@  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 */
 
    struct gl_sampler_object Sampler;
 
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 918dd59..7909907 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));