[Mesa-dev] [PATCH v4 2/9] glsl: Generate error for invalid input layout declarations
Jordan Justen
jordan.l.justen at intel.com
Thu Feb 6 18:28:02 PST 2014
Fixes various piglit tests:
spec/glsl-1.50/compiler/incorrect-in-layout-qualifier-*.geom
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/glsl/ast_type.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 8bc2c46..72de2bf 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -202,6 +202,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:
@@ -224,11 +226,15 @@ 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_COMPUTE:
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,
@@ -237,6 +243,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.
*/
--
1.9.rc1
More information about the mesa-dev
mailing list