glsl: Eliminate the global check in validate_explicit_location
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 25 Sep 2013 18:01:07 +0000 (11:01 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 30 Oct 2013 20:49:29 +0000 (13:49 -0700)
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@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/glsl/ast_to_hir.cpp

index e1f987b4e518f43790fb898cb3ed88786c1b8553..d30463aa61367e7cc5ba577eb8118294aa9f8a50 100644 (file)
@@ -2052,7 +2052,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 = "";
 
@@ -2064,7 +2063,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";
       }
@@ -2077,7 +2076,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
       return;
 
    case fragment_shader:
-      if (!global_scope || (var->mode != ir_var_shader_out)) {
+      if (var->mode != ir_var_shader_out) {
          fail = true;
          string = "output";
       }