diff options
author | Samuel Iglesias Gonsalvez <[email protected]> | 2014-07-02 09:38:43 +0200 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2014-07-03 10:34:12 -0700 |
commit | 7f0420700c473caee00a84596b22a600a7517b4d (patch) | |
tree | 57d803fa21bf74db6058e3ffa50b799d0d524d86 /src/glsl | |
parent | 986adb90573b1250ec348a210f3d315c8e48c76e (diff) |
glsl: fix duplicated layout qualifier detection for GS
This patch fixes the duplicated layout qualifier detection
for geometry shader's layout qualifiers.
Also it makes the detection code more legible by defining
allowed_duplicates_mask variable.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80778
Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ast_type.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 017f23d0e38..de4c1a410f6 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -122,18 +122,28 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, ubo_binding_mask.flags.q.explicit_binding = 1; ubo_binding_mask.flags.q.explicit_offset = 1; + ast_type_qualifier stream_layout_mask; + stream_layout_mask.flags.i = 0; + stream_layout_mask.flags.q.stream = 1; + /* Uniform block layout qualifiers get to overwrite each * other (rightmost having priority), while all other * qualifiers currently don't allow duplicates. - * - * Geometry shaders can have several layout qualifiers + */ + ast_type_qualifier allowed_duplicates_mask; + allowed_duplicates_mask.flags.i = + ubo_mat_mask.flags.i | + ubo_layout_mask.flags.i | + ubo_binding_mask.flags.i; + + /* Geometry shaders can have several layout qualifiers * assigning different stream values. */ + if (state->stage == MESA_SHADER_GEOMETRY) + allowed_duplicates_mask.flags.i |= + stream_layout_mask.flags.i; - if ((state->stage != MESA_SHADER_GEOMETRY) && - (this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i | - ubo_layout_mask.flags.i | - ubo_binding_mask.flags.i)) != 0) { + if ((this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) { _mesa_glsl_error(loc, state, "duplicate layout qualifiers used"); return false; |