[Bf-blender-cvs] [cc73d59ad58] master: Fix T59014: black/corrupted viewport with Intel HD on Windows 7/8.
Brecht Van Lommel
noreply at git.blender.org
Sat Apr 6 14:27:05 CEST 2019
Commit: cc73d59ad580f9f20286298b0d4547f0b1d87eda
Author: Brecht Van Lommel
Date: Sat Apr 6 14:23:25 2019 +0200
Branches: master
https://developer.blender.org/rBcc73d59ad580f9f20286298b0d4547f0b1d87eda
Fix T59014: black/corrupted viewport with Intel HD on Windows 7/8.
Work around bug in the Intel driver:
https://software.intel.com/en-us/forums/graphics-driver-bug-reporting/topic/550740
===================================================================
M source/blender/gpu/intern/gpu_shader_interface.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c
index 21e2be03eb9..c5dce2f0da6 100644
--- a/source/blender/gpu/intern/gpu_shader_interface.c
+++ b/source/blender/gpu/intern/gpu_shader_interface.c
@@ -216,14 +216,23 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program)
printf("GPUShaderInterface %p, program %d\n", shaderface, program);
#endif
- GLint max_attr_name_len, attr_len;
+ GLint max_attr_name_len = 0, attr_len = 0;
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_attr_name_len);
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &attr_len);
- GLint max_ubo_name_len, ubo_len;
+ GLint max_ubo_name_len = 0, ubo_len = 0;
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &max_ubo_name_len);
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &ubo_len);
+ /* Work around driver bug with Intel HD 4600 on Windows 7/8, where
+ * GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH does not work. */
+ if (attr_len > 0 && max_attr_name_len == 0) {
+ max_attr_name_len = 256;
+ }
+ if (ubo_len > 0 && max_ubo_name_len == 0) {
+ max_ubo_name_len = 256;
+ }
+
const uint32_t name_buffer_len = attr_len * max_attr_name_len + ubo_len * max_ubo_name_len;
shaderface->name_buffer = MEM_mallocN(name_buffer_len, "name_buffer");
More information about the Bf-blender-cvs
mailing list