summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2014-02-04 11:32:56 -0800
committerJordan Justen <[email protected]>2014-02-20 10:33:08 -0800
commit738c9c3c543b985b025a4a60fcc9c2e212e2d821 (patch)
treeb2713b673406dfc719c9aafab02592a3f965efe0 /src/glsl
parent0c558f9ee6cfc412037dc56ad4c3686e0f116852 (diff)
glsl: Generate error for invalid input layout declarations
Fixes various piglit tests: spec/glsl-1.50/compiler/incorrect-in-layout-qualifier-*.geom Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ast_type.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 2f36cf43c11..eba577764b0 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -207,6 +207,8 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
void *mem_ctx = state;
bool create_gs_ast = false;
bool create_cs_ast = false;
+ ast_type_qualifier valid_in_mask;
+ valid_in_mask.flags.i = 0;
switch (state->stage) {
case MESA_SHADER_GEOMETRY:
@@ -229,6 +231,8 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
create_gs_ast |=
q.flags.q.prim_type &&
!state->in_qualifier->flags.q.prim_type;
+
+ valid_in_mask.flags.q.prim_type = 1;
break;
case MESA_SHADER_FRAGMENT:
if (q.flags.q.early_fragment_tests) {
@@ -241,6 +245,8 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
create_cs_ast |=
q.flags.q.local_size != 0 &&
state->in_qualifier->flags.q.local_size == 0;
+
+ valid_in_mask.flags.q.local_size = 1;
break;
default:
_mesa_glsl_error(loc, state,
@@ -249,6 +255,13 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
break;
}
+ /* Generate an error when invalid input layout qualifiers are used. */
+ if ((q.flags.i & ~valid_in_mask.flags.i) != 0) {
+ _mesa_glsl_error(loc, state,
+ "invalid input layout qualifiers used");
+ return false;
+ }
+
/* Input layout qualifiers can be specified multiple
* times in separate declarations, as long as they match.
*/