mesa: remove mutex locking from a glBindTexture early out path

The locking doesn't seem to be needed. This removes large locking
overhead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>
This commit is contained in:
Marek Olšák 2021-06-07 11:03:10 -04:00
parent cfb43c7e1b
commit 553588194e
1 changed files with 4 additions and 10 deletions

View File

@ -1608,16 +1608,10 @@ bind_texture_object(struct gl_context *ctx, unsigned unit,
* If so, just return. For GL_OES_image_external, rebinding the texture
* always must invalidate cached resources.
*/
if (targetIndex != TEXTURE_EXTERNAL_INDEX) {
bool early_out;
simple_mtx_lock(&ctx->Shared->Mutex);
early_out = ((ctx->Shared->RefCount == 1)
&& (texObj == texUnit->CurrentTex[targetIndex]));
simple_mtx_unlock(&ctx->Shared->Mutex);
if (early_out) {
return;
}
}
if (targetIndex != TEXTURE_EXTERNAL_INDEX &&
ctx->Shared->RefCount == 1 &&
texObj == texUnit->CurrentTex[targetIndex])
return;
/* Flush before changing binding.
*