[Bf-blender-cvs] [cb59ef10320] master: OCIO: GLSL: Avoid undefined behavior

Clément Foucault noreply at git.blender.org
Tue Jun 2 16:46:42 CEST 2020


Commit: cb59ef10320e9db95548d9f1586ed7ee7ebafc78
Author: Clément Foucault
Date:   Tue Jun 2 12:19:38 2020 +0200
Branches: master
https://developer.blender.org/rBcb59ef10320e9db95548d9f1586ed7ee7ebafc78

OCIO: GLSL: Avoid undefined behavior

Set ubo binding after shaderinterface creation as GPU_shaderinterface_create
will call glUniformBlockBinding.

===================================================================

M	intern/opencolorio/ocio_impl_glsl.cc

===================================================================

diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc
index 87769a647f6..43416f734c5 100644
--- a/intern/opencolorio/ocio_impl_glsl.cc
+++ b/intern/opencolorio/ocio_impl_glsl.cc
@@ -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);



More information about the Bf-blender-cvs mailing list