From 4d799db72f9213dbd44b02d0cb24acf856aa2325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 24 Jan 2022 21:25:48 +0100 Subject: 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. --- source/blender/gpu/opengl/gl_shader_interface.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') 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++; -- cgit v1.2.3