summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-02 01:53:57 -1000
committerIan Romanick <ian.d.romanick@intel.com>2010-04-02 11:22:41 -0700
commit3f151509327629ce7d7cbfec42cae987ebf6639f (patch)
treeaf26e51b738ac0ed5cd7fd7f9855afe5bf683ec2 /ast_to_hir.cpp
parentc7da28b4beb3a593f49a6c01a90b123584b421e8 (diff)
Test that invalid quailfiers aren't used on variables in GLSL 1.10.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 8ed56d5800..5e0dcaae22 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -1332,6 +1332,32 @@ ast_declarator_list::hir(exec_list *instructions,
var = new ir_variable(var_type, decl->identifier);
+ /* From page 22 (page 28 of the PDF) of the GLSL 1.10 specification;
+ *
+ * "Global variables can only use the qualifiers const,
+ * attribute, uni form, or varying. Only one may be
+ * specified.
+ *
+ * Local variables can only use the qualifier const."
+ *
+ * This is relaxed in GLSL 1.30.
+ */
+ if (state->language_version < 120) {
+ if (this->type->qualifier.out) {
+ _mesa_glsl_error(& loc, state,
+ "`out' qualifier in declaration of `%s' "
+ "only valid for function parameters in GLSL 1.10.",
+ decl->identifier);
+ }
+ if (this->type->qualifier.in) {
+ _mesa_glsl_error(& loc, state,
+ "`in' qualifier in declaration of `%s' "
+ "only valid for function parameters in GLSL 1.10.",
+ decl->identifier);
+ }
+ /* FINISHME: Test for other invalid qualifiers. */
+ }
+
apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
& loc);