[Mesa-dev] [PATCH 5/5] glsl: simplified ast_type_qualifier::merge_[in|out]_qualifier API
Andres Gomez
agomez at igalia.com
Thu Oct 6 22:52:08 UTC 2016
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 804111f..aee4cd8 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -752,12 +752,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 4dbec59..2a68a83 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -359,7 +359,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);
@@ -393,9 +393,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;
@@ -432,7 +430,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;
@@ -571,12 +569,10 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
this->point_mode = q.point_mode;
}
- 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 225d58b..67516bc 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2914,7 +2914,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)) {
@@ -2925,7 +2925,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)) {
--
2.9.3
More information about the mesa-dev
mailing list