summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-31 12:26:03 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-31 12:26:03 -0700
commite1c1a3f3bd139da47a1184a8c69af6239973a90c (patch)
tree53dc90d9c88370c2ef197107a6e70a712930121a
parentb82c0c31aea2d02721f162b94b9f591242d9364e (diff)
Slightly refector checks for declarations that must be at global scope
-rw-r--r--ast_to_hir.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 1ebcf45e70..7525461272 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -1176,11 +1176,6 @@ ast_declarator_list::hir(exec_list *instructions,
var = new ir_variable(var_type, decl->identifier);
- /* FINISHME: Variables that are attribute, uniform, varying, in, or
- * FINISHME: out varibles must be declared either at global scope or
- * FINISHME: in a parameter list (in and out only).
- */
-
apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
& loc);
@@ -1212,15 +1207,18 @@ ast_declarator_list::hir(exec_list *instructions,
instructions->push_tail(var);
- if (this->type->qualifier.attribute
- && (state->current_function != NULL)) {
- _mesa_glsl_error(& loc, state,
- "attribute variable `%s' must be declared at global "
- "scope",
- var->name);
- }
-
- if ((var->mode == ir_var_in) && (state->current_function == NULL)) {
+ if (state->current_function != NULL) {
+ /* FINISHME: Variables that are uniform, varying, in, or
+ * FINISHME: out varibles must be declared either at global scope or
+ * FINISHME: in a parameter list (in and out only).
+ */
+ if (this->type->qualifier.attribute) {
+ _mesa_glsl_error(& loc, state,
+ "attribute variable `%s' must be declared at "
+ "global scope",
+ var->name);
+ }
+ } else if (var->mode == ir_var_in) {
if (state->target == vertex_shader) {
bool error_emitted = false;