OCIO: GLSL: Avoid undefined behavior

Set ubo binding after shaderinterface creation as GPU_shaderinterface_create
will call glUniformBlockBinding.
This commit is contained in:
Clément Foucault
2020-06-02 12:19:38 +02:00
parent 0749cff957
commit cb59ef1032

View File

@@ -264,14 +264,14 @@ static void updateGLSLShader(OCIO_GLSLShader *shader,
glUseProgram(shader->program);
/* Set UBO binding location. */
GLuint index = glGetUniformBlockIndex(shader->program, "OCIO_GLSLCurveMappingParameters");
glUniformBlockBinding(shader->program, index, UBO_BIND_LOC);
/* TODO(fclem) Remove this. Make caller always assume viewport space and
* specify texco via vertex attribs. */
shader->interface = GPU_shaderinterface_create(shader->program);
/* Set UBO binding location. */
GLuint index = glGetUniformBlockIndex(shader->program, "OCIO_GLSLCurveMappingParameters");
glUniformBlockBinding(shader->program, index, UBO_BIND_LOC);
/* Set texture bind point uniform once. This is saved by the shader. */
glUniform1i(glGetUniformLocation(shader->program, "image_texture"), 0);
glUniform1i(glGetUniformLocation(shader->program, "lut3d_texture"), 2);