[Mesa-dev] [PATCH v3 2/9] glsl: Generate error for invalid input layout declarations

Jordan Justen jordan.l.justen at intel.com
Wed Feb 5 00:07:23 CET 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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 7f3737b..f1c59da 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -183,6 +183,17 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
                                        _mesa_glsl_parse_state *state,
                                        ast_type_qualifier q)
 {
+   ast_type_qualifier valid_in_mask;
+   valid_in_mask.flags.i = 0;
+   valid_in_mask.flags.q.prim_type = 1;
+
+   /* 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.8.5.3



More information about the mesa-dev mailing list