diff options
author | marha <marha@users.sourceforge.net> | 2012-08-01 08:04:11 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-01 08:04:11 +0200 |
commit | 949282a6e80256ab56a1e95e484886873c7c0e4a (patch) | |
tree | d1102c4b3abd9dc93a2bf8808e498d10ba095390 /mesalib/src/glsl/ast_type.cpp | |
parent | 83da3ad0287bc51cd16ee6911fe73dc98ebe000b (diff) | |
parent | 49838240b7d4cff1ffed1bd91e495f6919061f90 (diff) | |
download | vcxsrv-949282a6e80256ab56a1e95e484886873c7c0e4a.tar.gz vcxsrv-949282a6e80256ab56a1e95e484886873c7c0e4a.tar.bz2 vcxsrv-949282a6e80256ab56a1e95e484886873c7c0e4a.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/glsl/ast_type.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_type.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mesalib/src/glsl/ast_type.cpp b/mesalib/src/glsl/ast_type.cpp index 6c44f8c41..29493e2f6 100644 --- a/mesalib/src/glsl/ast_type.cpp +++ b/mesalib/src/glsl/ast_type.cpp @@ -71,3 +71,48 @@ ast_type_qualifier::interpolation_string() const else return NULL; } + +bool +ast_type_qualifier::merge_qualifier(YYLTYPE *loc, + _mesa_glsl_parse_state *state, + ast_type_qualifier q) +{ + 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 ((this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i | + ubo_layout_mask.flags.i)) != 0) { + _mesa_glsl_error(loc, state, + "duplicate layout qualifiers used\n"); + return false; + } + + if ((q.flags.i & ubo_mat_mask.flags.i) != 0) + this->flags.i &= ~ubo_mat_mask.flags.i; + if ((q.flags.i & ubo_layout_mask.flags.i) != 0) + this->flags.i &= ~ubo_layout_mask.flags.i; + + this->flags.i |= q.flags.i; + + if (q.flags.q.explicit_location) + this->location = q.location; + + if (q.flags.q.explicit_index) + this->index = q.index; + + return true; +} + |