[Mesa-dev] [PATCH] glsl: small builtin inline tidy up

Timothy Arceri tarceri at itsqueeze.com
Thu Jul 27 07:37:02 UTC 2017


---
 src/compiler/glsl/ast_function.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 2d156ae1da..f7e90fba5b 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -426,22 +426,21 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual, const glsl_type *formal_type,
  *
  * For non-void functions, this returns a dereference of the temporary
  * variable which stores the return value for the call.  For void functions,
  * this returns NULL.
  */
 static ir_rvalue *
 generate_call(exec_list *instructions, ir_function_signature *sig,
               exec_list *actual_parameters,
               ir_variable *sub_var,
               ir_rvalue *array_idx,
-              struct _mesa_glsl_parse_state *state,
-              bool inline_immediately)
+              struct _mesa_glsl_parse_state *state)
 {
    void *ctx = state;
    exec_list post_call_conversions;
 
    /* Perform implicit conversion of arguments.  For out parameters, we need
     * to place them in a temporary variable and do the conversion after the
     * call takes place.  Since we haven't emitted the call yet, we'll place
     * the post-call conversions in a temporary exec_list, and emit them later.
     */
    foreach_two_lists(formal_node, &sig->parameters,
@@ -539,21 +538,22 @@ generate_call(exec_list *instructions, ir_function_signature *sig,
       instructions->push_tail(var);
 
       ralloc_free(name);
 
       deref = new(ctx) ir_dereference_variable(var);
    }
 
    ir_call *call = new(ctx) ir_call(sig, deref,
                                     actual_parameters, sub_var, array_idx);
    instructions->push_tail(call);
-   if (inline_immediately) {
+   if (sig->is_builtin()) {
+      /* inline immediately */
       call->generate_inline(call);
       call->remove();
    }
 
    /* Also emit any necessary out-parameter conversions. */
    instructions->append_list(&post_call_conversions);
 
    return deref ? deref->clone(ctx, NULL) : NULL;
 }
 
@@ -2324,21 +2324,21 @@ ast_function_expression::hir(exec_list *instructions,
                                 "barrier() may not be used after return");
             }
 
             if (instructions != &state->current_function->body) {
                _mesa_glsl_error(&loc, state,
                                 "barrier() may not be used in control flow");
             }
          }
 
          value = generate_call(instructions, sig, &actual_parameters, sub_var,
-                               array_idx, state, sig->is_builtin());
+                               array_idx, state);
          if (!value) {
             ir_variable *const tmp = new(ctx) ir_variable(glsl_type::void_type,
                                                           "void_var",
                                                           ir_var_temporary);
             instructions->push_tail(tmp);
             value = new(ctx) ir_dereference_variable(tmp);
          }
       }
 
       return value;
-- 
2.13.3



More information about the mesa-dev mailing list