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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/opengl/gl_shader_interface.cc')
-rw-r--r--source/blender/gpu/opengl/gl_shader_interface.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc
index 2211c2fbb7c..772d0888823 100644
--- a/source/blender/gpu/opengl/gl_shader_interface.cc
+++ b/source/blender/gpu/opengl/gl_shader_interface.cc
@@ -364,6 +364,9 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
name_buffer_ = (char *)MEM_mallocN(info.interface_names_size_, "name_buffer");
uint32_t name_buffer_offset = 0;
+ /* Necessary to make #glUniform works. TODO(fclem) Remove. */
+ glUseProgram(program);
+
/* Attributes */
for (const ShaderCreateInfo::VertIn &attr : info.vertex_inputs_) {
copy_input_name(input, attr.name, name_buffer_, name_buffer_offset);
@@ -382,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;
@@ -421,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++;