[Bf-blender-cvs] [beef67d1dfc] master: GPUShader: Bind shader for interface creation
Clément Foucault
noreply at git.blender.org
Tue Jun 2 23:47:15 CEST 2020
Commit: beef67d1dfc016a5e682ace28268e898b3556c5d
Author: Clément Foucault
Date: Tue Jun 2 17:29:48 2020 +0200
Branches: master
https://developer.blender.org/rBbeef67d1dfc016a5e682ace28268e898b3556c5d
GPUShader: Bind shader for interface creation
This will fix the bindpoints not being set at interface creation
===================================================================
M source/blender/gpu/intern/gpu_shader.c
M source/blender/gpu/intern/gpu_shader_interface.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index d40b2307ea7..97c2621de6b 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -331,6 +331,8 @@ GPUShader *GPU_shader_load_from_binary(const char *binary,
glGetProgramiv(program, GL_LINK_STATUS, &success);
if (success) {
+ glUseProgram(program);
+
GPUShader *shader = MEM_callocN(sizeof(*shader), __func__);
shader->interface = GPU_shaderinterface_create(program);
shader->program = program;
@@ -572,6 +574,7 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
return NULL;
}
+ glUseProgram(shader->program);
shader->interface = GPU_shaderinterface_create(shader->program);
return shader;
diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c
index 2590d738917..a1d75452458 100644
--- a/source/blender/gpu/intern/gpu_shader_interface.c
+++ b/source/blender/gpu/intern/gpu_shader_interface.c
@@ -220,6 +220,12 @@ static int sampler_binding(int32_t program,
GPUShaderInterface *GPU_shaderinterface_create(int32_t program)
{
+#ifndef NDEBUG
+ GLint curr_program;
+ glGetIntegerv(GL_CURRENT_PROGRAM, &curr_program);
+ BLI_assert(curr_program == program);
+#endif
+
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);
More information about the Bf-blender-cvs
mailing list