[Mesa-dev] [PATCH 3/6] glsl: Eliminate the global check in validate_explicit_location

Ian Romanick idr at freedesktop.org
Sun Oct 27 22:59:04 CET 2013


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

Since the separation of ir_var_function_in and ir_var_shader_in (similar
for out), this check is no longer necessary.  Previously, global_scope
was the only way to tell which was which.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/ast_to_hir.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 05539b8..9bce893 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2048,7 +2048,6 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
                            struct _mesa_glsl_parse_state *state,
                            YYLTYPE *loc)
 {
-   const bool global_scope = (state->current_function == NULL);
    bool fail = false;
    const char *string = "";
 
@@ -2060,7 +2059,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
     */
    switch (state->target) {
    case vertex_shader:
-      if (!global_scope || (var->mode != ir_var_shader_in)) {
+      if (var->mode != ir_var_shader_in) {
          fail = true;
          string = "input";
       }
@@ -2073,7 +2072,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
       break;
 
    case fragment_shader:
-      if (!global_scope || (var->mode != ir_var_shader_out)) {
+      if (var->mode != ir_var_shader_out) {
          fail = true;
          string = "output";
       }
-- 
1.8.1.4



More information about the mesa-dev mailing list