From 7b77c64254109ff1d59a8937f8f15216c10c8cb7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 22 Jun 2012 13:31:56 -0700 Subject: glsl: Merge UBO layout qualifiers in a qualifier list. Yes, you get to say things like "layout(row_major, column_major)" and get column major. Part of fixing piglit ARB_uniform_buffer_object/row_major. Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/glsl/glsl_parser.yy | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/glsl/glsl_parser.yy') diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index b7e1a5b16e1..ba21b5479cd 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1113,13 +1113,35 @@ layout_qualifier_id_list: layout_qualifier_id | layout_qualifier_id_list ',' layout_qualifier_id { - if (($1.flags.i & $3.flags.i) != 0) { + ast_type_qualifier ubo_mat_mask; + ubo_mat_mask.flags.i = 0; + ubo_mat_mask.flags.q.row_major = 1; + ubo_mat_mask.flags.q.column_major = 1; + + ast_type_qualifier ubo_layout_mask; + ubo_layout_mask.flags.i = 0; + ubo_layout_mask.flags.q.std140 = 1; + ubo_layout_mask.flags.q.packed = 1; + ubo_layout_mask.flags.q.shared = 1; + + /* Uniform block layout qualifiers get to overwrite each + * other (rightmost having priority), while all other + * qualifiers currently don't allow duplicates. + */ + if (($1.flags.i & $3.flags.i & ~(ubo_mat_mask.flags.i | + ubo_layout_mask.flags.i)) != 0) { _mesa_glsl_error(& @3, state, "duplicate layout qualifiers used\n"); YYERROR; } $$ = $1; + + if (($3.flags.i & ubo_mat_mask.flags.i) != 0) + $$.flags.i &= ~ubo_mat_mask.flags.i; + if (($3.flags.i & ubo_layout_mask.flags.i) != 0) + $$.flags.i &= ~ubo_layout_mask.flags.i; + $$.flags.i |= $3.flags.i; if ($3.flags.q.explicit_location) -- cgit v1.2.3