Ensure that shader_in and shader_out are correctly set in declarations
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 19 Jun 2010 01:57:31 +0000 (18:57 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 19 Jun 2010 02:02:45 +0000 (19:02 -0700)
ast_to_hir.cpp

index 3414da00eb672070eecbbd54a30020465942420f..dbc36660697e2d430b6a09f82369a83ec9a3ea05 100644 (file)
@@ -1471,11 +1471,27 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 
    if (qual->uniform)
       var->shader_in = true;
-   if (qual->varying) {
-      if (qual->in)
+
+   /* Any 'in' or 'inout' variables at global scope must be marked as being
+    * shader inputs.  Likewise, any 'out' or 'inout' variables at global scope
+    * must be marked as being shader outputs.
+    */
+   if (state->current_function == NULL) {
+      switch (var->mode) {
+      case ir_var_in:
+      case ir_var_uniform:
+        var->shader_in = true;
+        break;
+      case ir_var_out:
+        var->shader_out = true;
+        break;
+      case ir_var_inout:
         var->shader_in = true;
-      if (qual->out)
         var->shader_out = true;
+        break;
+      default:
+        break;
+      }
    }
 
    if (qual->flat)