summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-06-22 13:31:56 -0700
committerEric Anholt <[email protected]>2012-07-31 12:06:20 -0700
commit7b77c64254109ff1d59a8937f8f15216c10c8cb7 (patch)
treeeed2a4749e784b90008e2bf152457b73137e7174 /src/glsl
parenteed967bc9c27ff911c036b1363e5303bf6c7827f (diff)
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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glsl_parser.yy24
1 files changed, 23 insertions, 1 deletions
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)