summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2016-09-06 21:48:42 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2016-10-07 00:18:57 +0200
commitdd2bda70022d6d80aee47cea718bab43e5586fe8 (patch)
tree8e98b0db1683e566f527dea028cdd6f7f4ef412b /src/compiler
parentd5c8481d577030f21524ab6e0501d75ba401c887 (diff)
downloadexternal_mesa3d-dd2bda70022d6d80aee47cea718bab43e5586fe8.zip
external_mesa3d-dd2bda70022d6d80aee47cea718bab43e5586fe8.tar.gz
external_mesa3d-dd2bda70022d6d80aee47cea718bab43e5586fe8.tar.bz2
glsl: process local_size_variable input qualifier
This is the new layout qualifier introduced by ARB_compute_variable_group_size which allows to use a variable work group size. v4: - add missing '%s' in the monster format string Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/ast.h5
-rw-r--r--src/compiler/glsl/ast_type.cpp8
-rw-r--r--src/compiler/glsl/glsl_parser.yy13
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp6
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h6
5 files changed, 37 insertions, 1 deletions
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 4c648d0..55f009a 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -553,6 +553,11 @@ struct ast_type_qualifier {
*/
unsigned local_size:3;
+ /** \name Layout qualifiers for ARB_compute_variable_group_size. */
+ /** \{ */
+ unsigned local_size_variable:1;
+ /** \} */
+
/** \name Layout and memory qualifiers for ARB_shader_image_load_store. */
/** \{ */
unsigned early_fragment_tests:1;
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index b586f94..06b4550 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -497,6 +497,7 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
state->in_qualifier->flags.q.local_size == 0;
valid_in_mask.flags.q.local_size = 7;
+ valid_in_mask.flags.q.local_size_variable = 1;
break;
default:
_mesa_glsl_error(loc, state,
@@ -573,6 +574,10 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
this->point_mode = q.point_mode;
}
+ if (q.flags.q.local_size_variable) {
+ state->cs_input_local_size_variable_specified = true;
+ }
+
if (create_node) {
if (create_gs_ast) {
node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type);
@@ -607,7 +612,7 @@ ast_type_qualifier::validate_flags(YYLTYPE *loc,
"%s '%s':"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
- "%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
message, name,
bad.flags.q.invariant ? " invariant" : "",
bad.flags.q.precise ? " precise" : "",
@@ -646,6 +651,7 @@ ast_type_qualifier::validate_flags(YYLTYPE *loc,
bad.flags.q.prim_type ? " prim_type" : "",
bad.flags.q.max_vertices ? " max_vertices" : "",
bad.flags.q.local_size ? " local_size" : "",
+ bad.flags.q.local_size_variable ? " local_size_variable" : "",
bad.flags.q.early_fragment_tests ? " early_fragment_tests" : "",
bad.flags.q.explicit_image_format ? " image_format" : "",
bad.flags.q.coherent ? " coherent" : "",
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 9e1fd9e..38cbd3f 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1491,6 +1491,19 @@ layout_qualifier_id:
}
}
+ /* Layout qualifiers for ARB_compute_variable_group_size. */
+ if (!$$.flags.i) {
+ if (match_layout_qualifier($1, "local_size_variable", state) == 0) {
+ $$.flags.q.local_size_variable = 1;
+ }
+
+ if ($$.flags.i && !state->ARB_compute_variable_group_size_enable) {
+ _mesa_glsl_error(& @1, state,
+ "qualifier `local_size_variable` requires "
+ "ARB_compute_variable_group_size");
+ }
+ }
+
if (!$$.flags.i) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'", $1);
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 35f7da5..6270e8e 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -297,6 +297,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
sizeof(this->atomic_counter_offsets));
this->allow_extension_directive_midshader =
ctx->Const.AllowGLSLExtensionDirectiveMidShader;
+
+ this->cs_input_local_size_variable_specified = false;
}
/**
@@ -1676,6 +1678,7 @@ set_shader_inout_layout(struct gl_shader *shader,
if (shader->Stage != MESA_SHADER_COMPUTE) {
/* Should have been prevented by the parser. */
assert(!state->cs_input_local_size_specified);
+ assert(!state->cs_input_local_size_variable_specified);
}
if (shader->Stage != MESA_SHADER_FRAGMENT) {
@@ -1791,6 +1794,9 @@ set_shader_inout_layout(struct gl_shader *shader,
for (int i = 0; i < 3; i++)
shader->info.Comp.LocalSize[i] = 0;
}
+
+ shader->info.Comp.LocalSizeVariable =
+ state->cs_input_local_size_variable_specified;
break;
case MESA_SHADER_FRAGMENT:
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 3abeb9f..5bdebf6 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -405,6 +405,12 @@ struct _mesa_glsl_parse_state {
unsigned cs_input_local_size[3];
/**
+ * True if a compute shader input local variable size was specified using
+ * a layout directive as specified by ARB_compute_variable_group_size.
+ */
+ bool cs_input_local_size_variable_specified;
+
+ /**
* Output layout qualifiers from GLSL 1.50 (geometry shader controls),
* and GLSL 4.00 (tessellation control shader).
*/