[Mesa-dev] [PATCH 4/5] glsl: Don't copy array of sampler parameters when inlining functions.

Ian Romanick idr at freedesktop.org
Tue Jun 18 02:05:13 PDT 2013


On 06/03/2013 01:23 PM, Fabian Bieler wrote:
> Remove The parameter from the list of parameters and replace the derefs in the
> function body with the deref of the argument.

It seems like the existing code would break for some uses.  Is there a 
piglit test to go along with this change?

> This is the way scalar sampler variables are handled already.
>
> Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
> ---
>   src/glsl/opt_function_inlining.cpp | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp
> index 0733d51..25a8ff8 100644
> --- a/src/glsl/opt_function_inlining.cpp
> +++ b/src/glsl/opt_function_inlining.cpp
> @@ -123,7 +123,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
>         ir_rvalue *param = (ir_rvalue *) param_iter.get();
>
>         /* Generate a new variable for the parameter. */
> -      if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
> +      if (sig_param->type->get_scalar_type()->is_sampler()) {
>   	 /* For samplers, we want the inlined sampler references
>   	  * referencing the passed in sampler variable, since that
>   	  * will have the location information, which an assignment of
> @@ -178,7 +178,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
>         ir_instruction *const param = (ir_instruction *) param_iter.get();
>         ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
>
> -      if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
> +      if (sig_param->type->get_scalar_type()->is_sampler()) {
>   	 ir_dereference *deref = param->as_dereference();
>
>   	 assert(deref);
>



More information about the mesa-dev mailing list