GPUTexture: Make GPU_texture_unbind_all faster on newer opengl version

This commit is contained in:
Clément Foucault 2020-06-04 21:28:04 +02:00
parent ba5b303c88
commit b168c255aa
Notes: blender-bot 2023-02-14 07:53:51 +01:00
Referenced by issue #77549, Blender 2.90 dailies crash on startup since Thursday 4 June
1 changed files with 8 additions and 0 deletions

View File

@ -1771,6 +1771,12 @@ void GPU_texture_unbind(GPUTexture *tex)
void GPU_texture_unbind_all(void)
{
if (GLEW_ARB_multi_bind) {
glBindTextures(0, GPU_max_textures(), NULL);
glBindSamplers(0, GPU_max_textures(), NULL);
return;
}
for (int i = 0; i < GPU_max_textures(); i++) {
glActiveTexture(GL_TEXTURE0 + i);
glBindTexture(GL_TEXTURE_2D, 0);
@ -1785,6 +1791,8 @@ void GPU_texture_unbind_all(void)
}
glBindSampler(i, 0);
}
glActiveTexture(GL_TEXTURE0);
}
#define WARN_NOT_BOUND(_tex) \