aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-03-26 00:04:57 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-04-08 19:29:32 -0700
commit3c5ddaeacd2c52bc11f9cda451fe640cff629bdd (patch)
tree47586c1451345101c711cae5d72e270b025727a6 /src/compiler/glsl/glsl_parser.yy
parentca60f0b7baeb95caf5d6e0ab4d83c6bb1d3e0eaa (diff)
glsl: Parse and propagate derivative_group to shader_info
NV_compute_shader_derivatives allow selecting between two possible arrangements (quads and linear) when calculating derivatives and certain subgroup operations in case of Vulkan. So parse and propagate those up to shader_info.h. v2: Do not fail when ARB_compute_variable_group_size is being used, since we are still clarifying what is the right thing to do here. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r--src/compiler/glsl/glsl_parser.yy31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index ddb54f4a4d6..8d6c47fb6a3 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1655,6 +1655,37 @@ layout_qualifier_id:
$$.flags.q.non_coherent = 1;
}
+ // Layout qualifiers for NV_compute_shader_derivatives.
+ if (!$$.flags.i) {
+ if (match_layout_qualifier($1, "derivative_group_quadsNV", state) == 0) {
+ $$.flags.q.derivative_group = 1;
+ $$.derivative_group = DERIVATIVE_GROUP_QUADS;
+ } else if (match_layout_qualifier($1, "derivative_group_linearNV", state) == 0) {
+ $$.flags.q.derivative_group = 1;
+ $$.derivative_group = DERIVATIVE_GROUP_LINEAR;
+ }
+
+ if ($$.flags.i) {
+ if (!state->has_compute_shader()) {
+ _mesa_glsl_error(& @1, state,
+ "qualifier `%s' requires "
+ "a compute shader", $1);
+ }
+
+ if (!state->NV_compute_shader_derivatives_enable) {
+ _mesa_glsl_error(& @1, state,
+ "qualifier `%s' requires "
+ "NV_compute_shader_derivatives", $1);
+ }
+
+ if (state->NV_compute_shader_derivatives_warn) {
+ _mesa_glsl_warning(& @1, state,
+ "NV_compute_shader_derivatives layout "
+ "qualifier `%s' used", $1);
+ }
+ }
+ }
+
if (!$$.flags.i) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'", $1);