[Mesa-dev] [PATCH 3/4] linker: Slight code rearrange to prevent duplication in the next commit

Ian Romanick idr at freedesktop.org
Tue Nov 8 05:50:40 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/glsl/link_uniforms.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index fdcbd36..d70614f 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -928,13 +928,12 @@ link_update_uniform_buffer_variables(struct gl_linked_shader *shader)
                if ((ptrdiff_t) l != (end - begin))
                   continue;
 
-               if (strncmp(var->name, begin, l) == 0) {
-                  found = true;
-                  var->data.location = j;
-                  break;
-               }
-            } else if (!strcmp(var->name, blks[i]->Uniforms[j].Name)) {
-               found = true;
+               found = strncmp(var->name, begin, l) == 0;
+            } else {
+               found = strcmp(var->name, blks[i]->Uniforms[j].Name) == 0;
+            }
+
+            if (found) {
                var->data.location = j;
                break;
             }
-- 
2.5.5



More information about the mesa-dev mailing list