Like you told me in a similar patch, we should keep "if (!name) return;" in the helper. :-)

I suggest to add a no_error bool to bind_frag_data_location and always inline it.

With that fixed, patch is:

Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>

On 06/28/2017 08:13 AM, Timothy Arceri wrote:
---
  src/mesa/main/shader_query.cpp | 30 +++++++++++++++++++-----------
  1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6efbc37..d571846 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -233,6 +233,24 @@ _mesa_longest_attribute_name_length(struct 
gl_shader_program *shProg)
     return longest;
  }
+void static
+bind_frag_data_location(struct gl_shader_program *const shProg,
+                        const char *name, unsigned colorNumber,
+                        unsigned index)
+{
+   /* Replace the current value if it's already in the list.  Add
+    * FRAG_RESULT_DATA0 because that's how the linker differentiates
+    * between built-in attributes and user-defined attributes.
+    */
+   shProg->FragDataBindings->put(colorNumber + FRAG_RESULT_DATA0, name);
+   shProg->FragDataIndexBindings->put(index, name);
+
+   /*
+    * Note that this binding won't go into effect until
+    * glLinkProgram is called again.
+    */
+}
+
  void GLAPIENTRY
  _mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
                           const GLchar *name)
@@ -274,17 +292,7 @@ _mesa_BindFragDataLocationIndexed(GLuint program, GLuint 
colorNumber,
        return;
     }
- /* Replace the current value if it's already in the list. Add
-    * FRAG_RESULT_DATA0 because that's how the linker differentiates
-    * between built-in attributes and user-defined attributes.
-    */
-   shProg->FragDataBindings->put(colorNumber + FRAG_RESULT_DATA0, name);
-   shProg->FragDataIndexBindings->put(index, name);
-   /*
-    * Note that this binding won't go into effect until
-    * glLinkProgram is called again.
-    */
-
+   bind_frag_data_location(shProg, name, colorNumber, index);
  }
GLint GLAPIENTRY

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to