Mesa (master): mesa: Allow generic attributes for glGetActiveAttrib and GL_ACTIVE_ATTRIBUTES

Ian Romanick idr at kemper.freedesktop.org
Tue Nov 29 19:15:02 UTC 2011


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Nov 21 20:47:57 2011 -0800

mesa: Allow generic attributes for glGetActiveAttrib and GL_ACTIVE_ATTRIBUTES

Page 77 (page 91 of the PDF) says about glGetActiveAttrib:

    "The returned attribute name can be the name of a generic
    attribute or a conventional attribute (which begin with the prefix
    "gl_", see the OpenGL Shading Language specification for a
    complete list)."

Page 261 (page 275 of the PDF) says about glGetProgramiv:

    "If pname is ACTIVE_ATTRIBUTES, the number of active attributes in
    program is returned."

It doesn't say anything about built-in vs. user-defined attributes.
>From the language around glGetActiveAttrib and the lack of an
exclusion of built-in attributes, which exists other places (e.g.,
around glBindAttribLocation), we can infer that GL_ACTIVE_ATTRIBUTES
should include the active attribute count.  It should also be included
in the values returned by glGetActiveAttrib.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43138
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Tested-by: Yi Sun <yi.sun at intel.com>

---

 src/mesa/main/shader_query.cpp |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 38bacdb..8ab1812 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -107,8 +107,7 @@ _mesa_GetActiveAttribARB(GLhandleARB program, GLuint desired_index,
 
       if (var == NULL
 	  || var->mode != ir_var_in
-	  || var->location == -1
-	  || var->location < VERT_ATTRIB_GENERIC0)
+	  || var->location == -1)
 	 continue;
 
       if (current_index == desired_index) {
@@ -199,8 +198,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
 
       if (var == NULL
 	  || var->mode != ir_var_in
-	  || var->location == -1
-	  || var->location < VERT_ATTRIB_GENERIC0)
+	  || var->location == -1)
 	 continue;
 
       i++;
@@ -226,8 +224,7 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
 
       if (var == NULL
 	  || var->mode != ir_var_in
-	  || var->location == -1
-	  || var->location < VERT_ATTRIB_GENERIC0)
+	  || var->location == -1)
 	 continue;
 
       const size_t len = strlen(var->name);




More information about the mesa-commit mailing list