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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-06 15:23:25 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-06 15:26:23 +0300
commitcc73d59ad580f9f20286298b0d4547f0b1d87eda (patch)
tree98351167ad9fd315aaba1b75356d3f4ec3cb1020 /source
parent4dfa134899ad958d1c2f7c86592d73f341f33e7b (diff)
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
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/intern/gpu_shader_interface.c13
1 files changed, 11 insertions, 2 deletions
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");