diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-24 23:25:48 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-24 23:25:53 +0300 |
commit | 4d799db72f9213dbd44b02d0cb24acf856aa2325 (patch) | |
tree | e4ad2bd7d5a13be9d7e1552d1099ace23d2821c9 /source/blender/gpu/opengl | |
parent | 5a0c5912a41eacd443a121177f607446f909564e (diff) |
LShaderInterface: Fix interface binding with UBO containing arrays
To avoid the issue we search using the name in the `name_buffer_` which
already have the array suffix stripped out.
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r-- | source/blender/gpu/opengl/gl_shader_interface.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index c5a8d34c047..772d0888823 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -385,7 +385,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI if (res.bind_type == ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER) { copy_input_name(input, res.uniformbuf.name, name_buffer_, name_buffer_offset); if (true || !GLContext::explicit_location_support) { - input->location = glGetUniformBlockIndex(program, res.uniformbuf.name.c_str()); + input->location = glGetUniformBlockIndex(program, name_buffer_ + input->name_offset); glUniformBlockBinding(program, input->location, res.slot); } input->binding = res.slot; @@ -424,7 +424,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI copy_input_name(input, uni.name, name_buffer_, name_buffer_offset); /* Until we make use of explicit uniform location. */ if (true || !GLContext::explicit_location_support) { - input->location = glGetUniformLocation(program, uni.name.c_str()); + input->location = glGetUniformLocation(program, name_buffer_ + input->name_offset); } input->binding = -1; input++; |