diff options
author | Timothy Arceri <[email protected]> | 2016-02-13 16:17:12 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-03-05 19:07:09 +1100 |
commit | 1824ff1c2aa1800fde58e6c4ae2b8405baffc2a4 (patch) | |
tree | d2577c6c7e9ed41141b198103a25318b851e5dd3 /src/compiler | |
parent | bd53cc7b450b288fec707a27fb2902aa83fc2831 (diff) |
glsl: reject invalid input layout qualifiers
Global in validation is already handled, this will do the validation
for variables, blocks and block members.
This fixes some CTS tests for the new enhanced layouts transform
feedback qualifiers.
V2: add some more valid input flags
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/ast_type.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp index dcd83efa6ff..6b446a1d272 100644 --- a/src/compiler/glsl/ast_type.cpp +++ b/src/compiler/glsl/ast_type.cpp @@ -134,6 +134,28 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, stream_layout_mask.flags.i = 0; stream_layout_mask.flags.q.stream = 1; + /* FIXME: We should probably do interface and function param validation + * separately. + */ + ast_type_qualifier input_layout_mask; + input_layout_mask.flags.i = 0; + input_layout_mask.flags.q.centroid = 1; + /* Function params can have constant */ + input_layout_mask.flags.q.constant = 1; + input_layout_mask.flags.q.explicit_location = 1; + input_layout_mask.flags.q.flat = 1; + input_layout_mask.flags.q.in = 1; + input_layout_mask.flags.q.invariant = 1; + input_layout_mask.flags.q.noperspective = 1; + input_layout_mask.flags.q.origin_upper_left = 1; + /* Function params 'inout' will set this */ + input_layout_mask.flags.q.out = 1; + input_layout_mask.flags.q.patch = 1; + input_layout_mask.flags.q.pixel_center_integer = 1; + input_layout_mask.flags.q.precise = 1; + input_layout_mask.flags.q.sample = 1; + input_layout_mask.flags.q.smooth = 1; + /* Uniform block layout qualifiers get to overwrite each * other (rightmost having priority), while all other * qualifiers currently don't allow duplicates. @@ -258,6 +280,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, this->flags.i |= q.flags.i; + if (this->flags.q.in && + (this->flags.i & ~input_layout_mask.flags.i) != 0) { + _mesa_glsl_error(loc, state, + "invalid input layout qualifier used"); + return false; + } + if (q.flags.q.explicit_location) this->location = q.location; |