diff options
-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); |