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/intern/gpu_shader.c')
-rw-r--r--source/blender/gpu/intern/gpu_shader.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index fa63dff1458..2a0e434537f 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -467,21 +467,21 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
return NULL;
}
+ shader->interface = ShaderInterface_create(shader->program);
+
#ifdef WITH_OPENSUBDIV
/* TODO(sergey): Find a better place for this. */
if (use_opensubdiv && GLEW_VERSION_4_1) {
glProgramUniform1i(shader->program,
- glGetUniformLocation(shader->program, "FVarDataOffsetBuffer"),
+ ShaderInterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location,
30); /* GL_TEXTURE30 */
glProgramUniform1i(shader->program,
- glGetUniformLocation(shader->program, "FVarDataBuffer"),
+ ShaderInterface_uniform(shader->interface, "FVarDataBuffer")->location,
31); /* GL_TEXTURE31 */
}
#endif
- shader->interface = ShaderInterface_create(shader->program);
-
return shader;
}
@@ -523,8 +523,8 @@ void GPU_shader_free(GPUShader *shader)
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
-
- return glGetUniformLocation(shader->program, name);
+ const ShaderInput *uniform = ShaderInterface_uniform(shader->interface, name);
+ return uniform ? uniform->location : -1;
}
int GPU_shader_get_uniform_block(GPUShader *shader, const char *name)