summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-04-07 14:34:55 +0200
committerSamuel Pitoiset <[email protected]>2017-05-06 16:40:19 +0200
commit242964ca5c3e6763beca1dbe06feeee129771723 (patch)
tree34033124d86b96b07b8ab63836e64faca7c7bf97 /src/compiler/glsl/glsl_parser.yy
parent48b7882200c58d90b844162cac5a791f8d35e23b (diff)
glsl: allow image qualifiers inside structures
ARB_bindless_texture allows to declare images inside structures which means that qualifiers like writeonly should be allowed. I have a got a confirmation from Jeff Bolz (one author of the spec), because the spec doesn't clearly explain this. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r--src/compiler/glsl/glsl_parser.yy27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 9cdc37eb9a3..7b93d34fa3b 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2409,10 +2409,29 @@ struct_declaration:
ast_fully_specified_type *const type = $1;
type->set_location(@1);
- if (type->qualifier.flags.i != 0)
- _mesa_glsl_error(&@1, state,
- "only precision qualifiers may be applied to "
- "structure members");
+ if (state->has_bindless()) {
+ ast_type_qualifier input_layout_mask;
+
+ /* Allow to declare qualifiers for images. */
+ input_layout_mask.flags.i = 0;
+ input_layout_mask.flags.q.coherent = 1;
+ input_layout_mask.flags.q._volatile = 1;
+ input_layout_mask.flags.q.restrict_flag = 1;
+ input_layout_mask.flags.q.read_only = 1;
+ input_layout_mask.flags.q.write_only = 1;
+ input_layout_mask.flags.q.explicit_image_format = 1;
+
+ if ((type->qualifier.flags.i & ~input_layout_mask.flags.i) != 0) {
+ _mesa_glsl_error(&@1, state,
+ "only precision and image qualifiers may be "
+ "applied to structure members");
+ }
+ } else {
+ if (type->qualifier.flags.i != 0)
+ _mesa_glsl_error(&@1, state,
+ "only precision qualifiers may be applied to "
+ "structure members");
+ }
$$ = new(ctx) ast_declarator_list(type);
$$->set_location(@2);