[Mesa-dev] [PATCH] nir: Add support for scalarizing load_interpolated_input.

Eric Anholt eric at anholt.net
Wed Aug 10 18:04:20 UTC 2016


Kenneth Graunke <kenneth at whitecape.org> writes:

> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/compiler/nir/nir_lower_io_to_scalar.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c
> index f2345d5..8be75e4 100644
> --- a/src/compiler/nir/nir_lower_io_to_scalar.c
> +++ b/src/compiler/nir/nir_lower_io_to_scalar.c
> @@ -48,8 +48,10 @@ lower_load_input_to_scalar(nir_builder *b, nir_intrinsic_instr *intr)
>  
>        nir_intrinsic_set_base(chan_intr, nir_intrinsic_base(intr));
>        nir_intrinsic_set_component(chan_intr, nir_intrinsic_component(intr) + i);
> -      /* offset */
> -      chan_intr->src[0] = intr->src[0];
> +
> +      /* offset and possibly barycentric coordinates */
> +      for (int i = 0; i < nir_intrinsic_infos[intr->intrinsic].num_srcs; i++)
> +         chan_intr->src[i] = intr->src[i];
>  
>        nir_builder_instr_insert(b, &chan_intr->instr);
>  
> @@ -112,6 +114,7 @@ nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask)
>  
>                 switch (intr->intrinsic) {
>                 case nir_intrinsic_load_input:
> +               case nir_intrinsic_load_interpolated_input:
>                    if (mask & nir_var_shader_in)
>                       lower_load_input_to_scalar(&b, intr);
>                    break;

Don't you also need:

if (intr->intrinsic == nir_intrinsic_load_interpolated_input)
    nir_intrinsic_set_interp_mode(chan_intr,
                                  nir_intrinsic_interp_mode(intr));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160810/a9af9fd0/attachment.sig>


More information about the mesa-dev mailing list