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
This commit is contained in:
Brecht Van Lommel 2019-04-06 14:23:25 +02:00
parent 4dfa134899
commit cc73d59ad5
Notes: blender-bot 2023-02-14 07:39:44 +01:00
Referenced by issue #65793, Volume voxels visible in compositing (Cycles)
Referenced by issue #63444, Viewport Navigation Canceled Out Due to Menu Free Space
Referenced by issue #63368, Smoke not rendering
Referenced by issue #59014, Black 3D / Corrupted viewport with Intel HD and Windows 8.1 / Windows 7
1 changed files with 11 additions and 2 deletions

View File

@ -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");