[Mesa-dev] [PATCH 05/13] nir: Preserve offsets in lower_io_to_scalar_early

Timothy Arceri tarceri at itsqueeze.com
Sun Oct 14 21:29:33 UTC 2018


For xfb in glsl we just set always_active_io for varyings on each side 
of the interface which should avoid this and the linking problems from 
the two patches before this.

Trying to lower/split xfb varyings just seems like asking for trouble, I 
suggested Samuel create a linking helper to set always_active_io where 
needed [1].

[1] https://lists.freedesktop.org/archives/mesa-dev/2018-October/206750.html

On 14/10/18 12:09 am, Jason Ekstrand wrote:
> ---
>   src/compiler/nir/nir_lower_io_to_scalar.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c
> index f0c2a6a95d6..a7373d0e791 100644
> --- a/src/compiler/nir/nir_lower_io_to_scalar.c
> +++ b/src/compiler/nir/nir_lower_io_to_scalar.c
> @@ -192,6 +192,10 @@ lower_load_to_scalar_early(nir_builder *b, nir_intrinsic_instr *intr,
>            chan_var = nir_variable_clone(var, b->shader);
>            chan_var->data.location_frac =  var->data.location_frac + i;
>            chan_var->type = glsl_channel_type(chan_var->type);
> +         if (var->data.explicit_offset) {
> +            unsigned comp_size = glsl_get_bit_size(chan_var->type) / 8;
> +            chan_var->data.offset = var->data.offset + i * comp_size;
> +         }
>   
>            chan_vars[var->data.location_frac + i] = chan_var;
>   
> @@ -246,6 +250,10 @@ lower_store_output_to_scalar_early(nir_builder *b, nir_intrinsic_instr *intr,
>            chan_var = nir_variable_clone(var, b->shader);
>            chan_var->data.location_frac =  var->data.location_frac + i;
>            chan_var->type = glsl_channel_type(chan_var->type);
> +         if (var->data.explicit_offset) {
> +            unsigned comp_size = glsl_get_bit_size(chan_var->type) / 8;
> +            chan_var->data.offset = var->data.offset + i * comp_size;
> +         }
>   
>            chan_vars[var->data.location_frac + i] = chan_var;
>   
> 


More information about the mesa-dev mailing list