Mesa (master): mesa: Return -1 for glGetUniformLocation on UBOs.

Eric Anholt anholt at kemper.freedesktop.org
Tue Jul 31 19:21:42 UTC 2012


Module: Mesa
Branch: master
Commit: fa08b8ad549ef0ad0ee46f525f6f5dd0d6332f99
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa08b8ad549ef0ad0ee46f525f6f5dd0d6332f99

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jun 25 10:10:26 2012 -0700

mesa: Return -1 for glGetUniformLocation on UBOs.

Fixes piglit ARB_uniform_buffer_object/getuniformlocation.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/uniforms.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index b5aaa1b..f43d0fb 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -522,6 +522,16 @@ _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
    if (index == GL_INVALID_INDEX)
       return -1;
 
+   /* From the GL_ARB_uniform_buffer_object spec:
+    *
+    *     "The value -1 will be returned if <name> does not correspond to an
+    *      active uniform variable name in <program>, if <name> is associated
+    *      with a named uniform block, or if <name> starts with the reserved
+    *      prefix "gl_"."
+    */
+   if (shProg->UniformStorage[index].block_index != -1)
+      return -1;
+
    return _mesa_uniform_merge_location_offset(index, offset);
 }
 




More information about the mesa-commit mailing list