[Mesa-dev] [PATCH 09/18] glsl: Handle patch qualifier on interface blocks.
Timothy Arceri
timothy.arceri at collabora.com
Tue Aug 2 00:58:04 UTC 2016
On Mon, 2016-08-01 at 10:29 -0700, Kenneth Graunke wrote:
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/compiler/glsl/ast_to_hir.cpp | 4 ++++
> src/compiler/glsl/glsl_parser.yy | 11 +++++++++++
> src/compiler/glsl/glsl_parser_extras.cpp | 3 +++
> 3 files changed, 18 insertions(+)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp
> b/src/compiler/glsl/ast_to_hir.cpp
> index d246745..6273528 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -7436,10 +7436,12 @@ ast_interface_block::hir(exec_list
> *instructions,
> _mesa_glsl_error(&loc, state, "geometry shader inputs must be
> arrays");
> } else if ((state->stage == MESA_SHADER_TESS_CTRL ||
> state->stage == MESA_SHADER_TESS_EVAL) &&
> + !this->layout.flags.q.patch &&
> this->array_specifier == NULL &&
> var_mode == ir_var_shader_in) {
> _mesa_glsl_error(&loc, state, "per-vertex tessellation shader
> inputs must be arrays");
> } else if (state->stage == MESA_SHADER_TESS_CTRL &&
> + !this->layout.flags.q.patch &&
> this->array_specifier == NULL &&
> var_mode == ir_var_shader_out) {
> _mesa_glsl_error(&loc, state, "tessellation control shader
> outputs must be arrays");
> @@ -7555,6 +7557,8 @@ ast_interface_block::hir(exec_list
> *instructions,
> if (var_mode == ir_var_shader_in || var_mode ==
> ir_var_uniform)
> var->data.read_only = true;
>
> + var->data.patch = this->layout.flags.q.patch;
> +
> if (state->stage == MESA_SHADER_GEOMETRY && var_mode ==
> ir_var_shader_in)
> handle_geometry_shader_input_decl(state, loc, var);
> else if ((state->stage == MESA_SHADER_TESS_CTRL ||
> diff --git a/src/compiler/glsl/glsl_parser.yy
> b/src/compiler/glsl/glsl_parser.yy
> index 4ab9e14..d90418e 100644
> --- a/src/compiler/glsl/glsl_parser.yy
> +++ b/src/compiler/glsl/glsl_parser.yy
> @@ -2697,6 +2697,17 @@ interface_qualifier:
> memset(& $$, 0, sizeof($$));
> $$.flags.q.buffer = 1;
> }
> + | auxiliary_storage_qualifier interface_qualifier
> + {
> + if (!$1.flags.q.patch) {
> + _mesa_glsl_error(&@1, state, "invalid interface
> qualifier");
> + }
> + if ($2.has_auxiliary_storage()) {
> + _mesa_glsl_error(&@1, state, "duplicate patch qualifier");
> + }
> + $$ = $2;
> + $$.flags.q.patch = 1;
> + }
> ;
>
> instance_name_opt:
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp
> b/src/compiler/glsl/glsl_parser_extras.cpp
> index 14a5540..2211d97 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -929,6 +929,8 @@ _mesa_ast_process_interface_block(YYLTYPE *locp,
> "a fragment shader");
> }
>
> + /* error checking for patch qualifier? */
Is this left over? Everything else in the patch looks ok.
> +
> /* Since block arrays require names, and both features are added
> in
> * the same language versions, we don't have to explicitly
> * version-check both things.
> @@ -950,6 +952,7 @@ _mesa_ast_process_interface_block(YYLTYPE *locp,
> temp_type_qualifier.flags.q.in = true;
> temp_type_qualifier.flags.q.out = true;
> temp_type_qualifier.flags.q.buffer = true;
> + temp_type_qualifier.flags.q.patch = true;
> interface_type_mask = temp_type_qualifier.flags.i;
>
> /* Get the block's interface qualifier. The interface_qualifier
More information about the mesa-dev
mailing list