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

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Jul 27 08:07:28 UTC 2017


Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 07/27/2017 09:37 AM, Timothy Arceri wrote:
> ---
>   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;
> 


More information about the mesa-dev mailing list