[Mesa-dev] [PATCH 39/42] mesa: add bind_attrib_location() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jun 27 11:20:42 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/shader_query.cpp | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6efbc379656..98441075551 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -62,6 +62,22 @@ DECL_RESOURCE_FUNC(XFV, gl_transform_feedback_varying_info);
 DECL_RESOURCE_FUNC(XFB, gl_transform_feedback_buffer);
 DECL_RESOURCE_FUNC(SUB, gl_subroutine_function);
 
+static void
+bind_attrib_location(struct gl_shader_program *const shProg, GLuint index,
+                     const GLchar *name)
+{
+   /* Replace the current value if it's already in the list.  Add
+    * VERT_ATTRIB_GENERIC0 because that's how the linker differentiates
+    * between built-in attributes and user-defined attributes.
+    */
+   shProg->AttributeBindings->put(index + VERT_ATTRIB_GENERIC0, name);
+
+   /*
+    * Note that this attribute binding won't go into effect until
+    * glLinkProgram is called again.
+    */
+}
+
 void GLAPIENTRY
 _mesa_BindAttribLocation(GLuint program, GLuint index,
                          const GLchar *name)
@@ -88,16 +104,7 @@ _mesa_BindAttribLocation(GLuint program, GLuint index,
       return;
    }
 
-   /* Replace the current value if it's already in the list.  Add
-    * VERT_ATTRIB_GENERIC0 because that's how the linker differentiates
-    * between built-in attributes and user-defined attributes.
-    */
-   shProg->AttributeBindings->put(index + VERT_ATTRIB_GENERIC0, name);
-
-   /*
-    * Note that this attribute binding won't go into effect until
-    * glLinkProgram is called again.
-    */
+   bind_attrib_location(shProg, index, name);
 }
 
 void GLAPIENTRY
-- 
2.13.2



More information about the mesa-dev mailing list