[Mesa-dev] [PATCH 9/9] glsl: simplified ast_type_qualifier::merge_[in|out]_qualifier API
Timothy Arceri
timothy.arceri at collabora.com
Mon Oct 24 03:09:46 UTC 2016
I'm not sure we can do this see my last commets to patch 3.
On Sat, 2016-10-22 at 23:09 +0300, Andres Gomez wrote:
> Since we modified the way in which multiple repetitions of the same
> layout-qualifier-name in a single declaration collapse into the
> ast_type_qualifier class, we can simplify the
> merge_[in|out]_qualifier
> APIs through removing the create_node parameter.
>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
> src/compiler/glsl/ast.h | 4 ++--
> src/compiler/glsl/ast_type.cpp | 18 +++++++-----------
> src/compiler/glsl/glsl_parser.yy | 4 ++--
> 3 files changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
> index 277266b..c4638c7 100644
> --- a/src/compiler/glsl/ast.h
> +++ b/src/compiler/glsl/ast.h
> @@ -758,12 +758,12 @@ struct ast_type_qualifier {
> bool merge_out_qualifier(YYLTYPE *loc,
> _mesa_glsl_parse_state *state,
> const ast_type_qualifier &q,
> - ast_node* &node, bool create_node);
> + ast_node* &node);
>
> bool merge_in_qualifier(YYLTYPE *loc,
> _mesa_glsl_parse_state *state,
> const ast_type_qualifier &q,
> - ast_node* &node, bool create_node);
> + ast_node* &node);
>
> /**
> * Push pending layout qualifiers to the global values.
> diff --git a/src/compiler/glsl/ast_type.cpp
> b/src/compiler/glsl/ast_type.cpp
> index c0c7ec7..5c75d0b 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -369,7 +369,7 @@ bool
> ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc,
> _mesa_glsl_parse_state
> *state,
> const ast_type_qualifier &q,
> - ast_node* &node, bool
> create_node)
> + ast_node* &node)
> {
> void *mem_ctx = state;
> const bool r = this->merge_qualifier(loc, state, q, false);
> @@ -403,9 +403,7 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE
> *loc,
> valid_out_mask.flags.q.max_vertices = 1;
> valid_out_mask.flags.q.prim_type = 1;
> } else if (state->stage == MESA_SHADER_TESS_CTRL) {
> - if (create_node) {
> - node = new(mem_ctx) ast_tcs_output_layout(*loc);
> - }
> + node = new(mem_ctx) ast_tcs_output_layout(*loc);
> valid_out_mask.flags.q.vertices = 1;
> valid_out_mask.flags.q.explicit_xfb_buffer = 1;
> valid_out_mask.flags.q.xfb_buffer = 1;
> @@ -442,7 +440,7 @@ bool
> ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
> _mesa_glsl_parse_state
> *state,
> const ast_type_qualifier &q,
> - ast_node* &node, bool
> create_node)
> + ast_node* &node)
> {
> void *mem_ctx = state;
> bool create_gs_ast = false;
> @@ -586,12 +584,10 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE
> *loc,
> 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);
> - } else if (create_cs_ast) {
> - node = new(mem_ctx) ast_cs_input_layout(*loc,
> q.local_size);
> - }
> + if (create_gs_ast) {
> + node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type);
> + } else if (create_cs_ast) {
> + node = new(mem_ctx) ast_cs_input_layout(*loc, q.local_size);
> }
>
> return true;
> diff --git a/src/compiler/glsl/glsl_parser.yy
> b/src/compiler/glsl/glsl_parser.yy
> index 39641c8..65d3e30 100644
> --- a/src/compiler/glsl/glsl_parser.yy
> +++ b/src/compiler/glsl/glsl_parser.yy
> @@ -2932,7 +2932,7 @@ layout_defaults:
> {
> $$ = NULL;
> if (!state->in_qualifier->
> - merge_in_qualifier(& @1, state, $1, $$, true)) {
> + merge_in_qualifier(& @1, state, $1, $$)) {
> YYERROR;
> }
> if (!state->in_qualifier->push_to_global(& @1, state)) {
> @@ -2943,7 +2943,7 @@ layout_defaults:
> {
> $$ = NULL;
> if (!state->out_qualifier->
> - merge_out_qualifier(& @1, state, $1, $$, true)) {
> + merge_out_qualifier(& @1, state, $1, $$)) {
> YYERROR;
> }
> if (!state->out_qualifier->push_to_global(& @1, state)) {
More information about the mesa-dev
mailing list