summaryrefslogtreecommitdiffstats
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-03-31 21:21:20 -1000
committerIan Romanick <[email protected]>2010-04-02 11:22:41 -0700
commit90b7825b0e92375dbe721d2dca1a4a3f1093f4ab (patch)
tree816148cdd75ecea252376cd75c3a0cc37ce744fc /ast_to_hir.cpp
parentaeab105342df8f59af1f1c65078e38dda4d7e521 (diff)
Reject non-float varyings.
Fixes varying2.frag.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 79e04ee7960..456271d3002 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -1252,6 +1252,18 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
"fragment shader");
}
+ /* From page 25 (page 31 of the PDF) of the GLSL 1.10 spec:
+ *
+ * "The varying qualifier can be used only with the data types
+ * float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of
+ * these."
+ */
+ if (qual->varying && var->type->base_type != GLSL_TYPE_FLOAT) {
+ var->type = glsl_type::error_type;
+ _mesa_glsl_error(loc, state,
+ "varying variables must be of base type float");
+ }
+
if (qual->in && qual->out)
var->mode = ir_var_inout;
else if (qual->attribute || qual->in