glsl: Mark 'in' variables at global scope as read-only
authorChad Versace <chad.versace@intel.com>
Thu, 20 Jan 2011 22:12:16 +0000 (14:12 -0800)
committerChad Versace <chad.versace@intel.com>
Fri, 21 Jan 2011 22:06:28 +0000 (14:06 -0800)
Fixes Piglit tests:
spec/glsl-1.30/compiler/storage-qualifiers/static-write-centroid-in-01.frag
spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-01.frag
spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-02.frag

src/glsl/ast_to_hir.cpp

index 7a171f3a2bbb627008c2d6abb704559e2495acbb..dfb016cf7d8ff9f3ab279c64355b64dc871435ae 100644 (file)
@@ -1809,7 +1809,6 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
       }
    }
 
-   /* FINISHME: Mark 'in' variables at global scope as read-only. */
    if (qual->flags.q.constant || qual->flags.q.attribute
        || qual->flags.q.uniform
        || (qual->flags.q.varying && (state->target == fragment_shader)))
@@ -2206,6 +2205,8 @@ ast_declarator_list::hir(exec_list *instructions,
                             mode, var->name, extra);
         }
       } else if (var->mode == ir_var_in) {
+         var->read_only = true;
+
         if (state->target == vertex_shader) {
            bool error_emitted = false;