diff options
author | Robert Bragg <robert@linux.intel.com> | 2010-04-16 10:31:32 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-01-16 13:45:27 +0000 |
commit | 4e4e4c8ba1e7569b0a9ab0ae9b73ef0e18c5357f (patch) | |
tree | 2d6be1e9b3cfc5524ea86c65633cb9634575effb /src | |
parent | 455090c4c42cc7003594a750105980b125e140d4 (diff) |
glBindTexture: Bail out earlier for redundant binds
Commit 7f8000db8bd4 made it possible to bail out of glBindTexture early
in single context environments when the user is rebinding the same
texture name. This makes the early exit even earlier by comparing the
given texName with texUnit->CurrentTex[targetIndex]->Name instead of
waiting until we have validated the given texture name and found the
corresponding gl_texture_object. If it matches then it's implicitly
validated.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/texobj.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 1b61d3a63f..5ea2ad733d 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1065,6 +1065,20 @@ _mesa_BindTexture( GLenum target, GLuint texName ) } assert(targetIndex < NUM_TEXTURE_TARGETS); + /* Check if this texture is only used by this context and is already bound. + * If so, just return. + */ + { + GLboolean early_out; + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + early_out = ((ctx->Shared->RefCount == 1) + && (newTexObj == texUnit->CurrentTex[targetIndex])); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + if (early_out) { + return; + } + } + /* * Get pointer to new texture object (newTexObj) */ @@ -1105,20 +1119,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) assert(valid_texture_object(newTexObj)); - /* Check if this texture is only used by this context and is already bound. - * If so, just return. - */ - { - GLboolean early_out; - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - early_out = ((ctx->Shared->RefCount == 1) - && (newTexObj == texUnit->CurrentTex[targetIndex])); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - if (early_out) { - return; - } - } - /* flush before changing binding */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); |