[Mesa-dev] [PATCH] glsl: properly setting var->data.binding if explicit_binding is true

Alejandro PiƱeiro apinheiro at igalia.com
Sat Apr 25 09:46:14 PDT 2015


There was a typo on commit c0cd5b, doing it when explicit_binding
was false. This prevented to use any binding point different to 0.
---

Taking into account the explanation on the header about the
variable binding (ast.h:553)

   /**
    * Binding specified via GL_ARB_shading_language_420pack's "binding" keyword.
    *
    * \note
    * This field is only valid if \c explicit_binding is set.
    */
   int binding;

The binding is correct (and should be updated) if explicit_binding is true.
But the current behaviour was updating it if it was false. 

This was not detected by piglit because all the calls to
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER are using 0.

I tested this patch by running all piglit on my system, and I didn't
detect regression. I also runned make check without issues.

https://bugs.freedesktop.org/show_bug.cgi?id=90175

 src/glsl/link_atomics.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index 603873a..9528e42 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -201,7 +201,7 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
          gl_uniform_storage *const storage = &prog->UniformStorage[id];
 
          mab.Uniforms[j] = id;
-         if (!var->data.explicit_binding)
+         if (var->data.explicit_binding)
             var->data.binding = i;
 
          storage->atomic_buffer_index = i;
-- 
2.1.0



More information about the mesa-dev mailing list