Commit: df8847de6daaecafe6b9b090ca061c8252691bef
Author: Clément Foucault
Date:   Sun Jun 28 01:44:06 2020 +0200
Branches: master
https://developer.blender.org/rBdf8847de6daaecafe6b9b090ca061c8252691bef

Fix T77549 GPUTexture: Crash caused by NULL parameter to glBindTextures...

... or glBindSamplers.

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

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 a985d45162c..fd6d2894f35 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1772,8 +1772,13 @@ 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);
+    /* Some drivers crash because of the NULL array even if that's explicitly
+     * allowed by the spec... *sigh* (see T77549). */
+    GLuint texs[32] = {0};
+    int count = min_ii(32, GPU_max_textures());
+
+    glBindTextures(0, count, texs);
+    glBindSamplers(0, count, texs);
     return;
   }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to