[Bf-blender-cvs] [b168c255aae] master: GPUTexture: Make GPU_texture_unbind_all faster on newer opengl version

Clément Foucault noreply at git.blender.org
Thu Jun 4 21:28:25 CEST 2020


Commit: b168c255aae848f730a12b9cb16e88681a0c6809
Author: Clément Foucault
Date:   Thu Jun 4 21:28:04 2020 +0200
Branches: master
https://developer.blender.org/rBb168c255aae848f730a12b9cb16e88681a0c6809

GPUTexture: Make GPU_texture_unbind_all faster on newer opengl version

===================================================================

M	source/blender/gpu/intern/gpu_texture.c

===================================================================

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) \



More information about the Bf-blender-cvs mailing list