Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-06-28 02:44:06 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-06-28 02:44:17 +0300
commitdf8847de6daaecafe6b9b090ca061c8252691bef (patch)
treeca32d5e61e7e1a8c4aa6c99db9d189727249dca9 /source
parent59d2dd2237ce50b84516a6647aac31a50fcf4ae2 (diff)
Fix T77549 GPUTexture: Crash caused by NULL parameter to glBindTextures...
... or glBindSamplers.
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c9
1 files changed, 7 insertions, 2 deletions
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;
}