glsl: simplified ast_type_qualifier::merge_into_[in|out]_qualifier API
authorAndres Gomez <agomez@igalia.com>
Thu, 6 Oct 2016 22:52:08 +0000 (01:52 +0300)
committerAndres Gomez <agomez@igalia.com>
Fri, 25 Nov 2016 11:18:30 +0000 (13:18 +0200)
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_into_[in|out]_qualifier APIs through removing the create_node
parameter.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
src/compiler/glsl/ast.h
src/compiler/glsl/ast_type.cpp
src/compiler/glsl/glsl_parser.yy

index 7bbb58800a74ffc8466e93aebe9dcae36f7d6178..e40387b8f657657c873eb1152d6e361fa292e7c4 100644 (file)
@@ -767,7 +767,7 @@ struct ast_type_qualifier {
     */
    bool merge_into_out_qualifier(YYLTYPE *loc,
                                  _mesa_glsl_parse_state *state,
-                                 ast_node* &node, bool create_node);
+                                 ast_node* &node);
 
    /**
     * Validate current qualifier against the global in one.
@@ -780,7 +780,7 @@ struct ast_type_qualifier {
     */
    bool merge_into_in_qualifier(YYLTYPE *loc,
                                 _mesa_glsl_parse_state *state,
-                                ast_node* &node, bool create_node);
+                                ast_node* &node);
 
    bool validate_flags(YYLTYPE *loc,
                        _mesa_glsl_parse_state *state,
index 91050a5877acfc1263c4106e05a24a3dd18883fc..bfe1d2faca6dc7176c509e3664770de9a8eaaeed 100644 (file)
@@ -514,7 +514,7 @@ ast_type_qualifier::validate_out_qualifier(YYLTYPE *loc,
 bool
 ast_type_qualifier::merge_into_out_qualifier(YYLTYPE *loc,
                                              _mesa_glsl_parse_state *state,
-                                             ast_node* &node, bool create_node)
+                                             ast_node* &node)
 {
    const bool r = state->out_qualifier->merge_qualifier(loc, state,
                                                         *this, false);
@@ -525,8 +525,7 @@ ast_type_qualifier::merge_into_out_qualifier(YYLTYPE *loc,
       state->out_qualifier->flags.q.explicit_stream = 0;
       break;
    case MESA_SHADER_TESS_CTRL:
-      if (create_node)
-         node = new(state->linalloc) ast_tcs_output_layout(*loc);
+      node = new(state->linalloc) ast_tcs_output_layout(*loc);
       break;
    default:
       break;
@@ -627,7 +626,7 @@ ast_type_qualifier::validate_in_qualifier(YYLTYPE *loc,
 bool
 ast_type_qualifier::merge_into_in_qualifier(YYLTYPE *loc,
                                             _mesa_glsl_parse_state *state,
-                                            ast_node* &node, bool create_node)
+                                            ast_node* &node)
 {
    bool r = true;
    void *lin_ctx = state->linalloc;
@@ -636,8 +635,7 @@ ast_type_qualifier::merge_into_in_qualifier(YYLTYPE *loc,
     * more repeated nodes will be created as we will have the flag set.
     */
    if (state->stage == MESA_SHADER_GEOMETRY
-       && this->flags.q.prim_type && !state->in_qualifier->flags.q.prim_type
-       && create_node) {
+       && this->flags.q.prim_type && !state->in_qualifier->flags.q.prim_type) {
       node = new(lin_ctx) ast_gs_input_layout(*loc, this->prim_type);
    }
 
@@ -653,8 +651,8 @@ ast_type_qualifier::merge_into_in_qualifier(YYLTYPE *loc,
     * into HIR.
     */
    if (state->in_qualifier->flags.q.local_size) {
-      if (create_node)
-         node = new(lin_ctx) ast_cs_input_layout(*loc, state->in_qualifier->local_size);
+      node = new(lin_ctx) ast_cs_input_layout(*loc,
+                                              state->in_qualifier->local_size);
       state->in_qualifier->flags.q.local_size = 0;
       for (int i = 0; i < 3; i++)
          state->in_qualifier->local_size[i] = NULL;
index 5a8f854ece8912607dcae85b8f031972f66dde9f..5529f1116c1bb0cd7b9ed8a1cfd3f770f1ce2e87 100644 (file)
@@ -2957,14 +2957,14 @@ layout_defaults:
    | layout_in_defaults
    {
       $$ = NULL;
-      if (!$1.merge_into_in_qualifier(& @1, state, $$, true)) {
+      if (!$1.merge_into_in_qualifier(& @1, state, $$)) {
          YYERROR;
       }
    }
    | layout_out_defaults
    {
       $$ = NULL;
-      if (!$1.merge_into_out_qualifier(& @1, state, $$, true)) {
+      if (!$1.merge_into_out_qualifier(& @1, state, $$)) {
          YYERROR;
       }
    }