diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-06-04 22:28:04 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-06-04 22:28:19 +0300 |
commit | b168c255aae848f730a12b9cb16e88681a0c6809 (patch) | |
tree | cda10a67f906d91607cdc597fcf3c4692a02cf57 /source/blender | |
parent | ba5b303c8886c9266309bada1cdeb71bcd8e59a3 (diff) |
GPUTexture: Make GPU_texture_unbind_all faster on newer opengl version
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 1d870ed2fdc..ca0d633aa9e 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -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) \ |