[Mesa-dev] [PATCH 4/7] nir: add component_offset at nir_xfb_info

Jason Ekstrand jason at jlekstrand.net
Thu Nov 8 21:52:58 UTC 2018


This is fine.  For Intel hardware, the component mask is actually what we
need and I figured ffs(component_mask) - 1 and bitcount(component_mask)
wasn't all that onerous.  I don't care all that much though.  Of we're
going this direction, maybe just do size+offset and we can compute the mask
in anv?  I don't know what the radv people are doing; this may be easier
for them.

On Thu, Nov 8, 2018 at 7:22 AM Alejandro PiƱeiro <apinheiro at igalia.com>
wrote:

> Where component_offset here is the offset when accessing components of
> a packed variable. Or in other words, location_frac on
> nir.h. Different places of mesa use different names for it.
>
> Technically nir_xfb_info consumer can get the same from the
> component_mask, it seems somewhat forced to make it to compute it,
> instead of providing it.
> ---
>  src/compiler/nir/nir_gather_xfb_info.c | 3 +++
>  src/compiler/nir/nir_xfb_info.h        | 1 +
>  2 files changed, 4 insertions(+)
>
> diff --git a/src/compiler/nir/nir_gather_xfb_info.c
> b/src/compiler/nir/nir_gather_xfb_info.c
> index 01fc2b26624..cd3afa32661 100644
> --- a/src/compiler/nir/nir_gather_xfb_info.c
> +++ b/src/compiler/nir/nir_gather_xfb_info.c
> @@ -70,6 +70,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
>
>        assert(var->data.location_frac + comp_slots <= 8);
>        uint8_t comp_mask = ((1 << comp_slots) - 1) <<
> var->data.location_frac;
> +      unsigned location_frac = var->data.location_frac;
>
>        assert(attrib_slots <= 2);
>        for (unsigned s = 0; s < attrib_slots; s++) {
> @@ -79,6 +80,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
>           output->offset = *offset;
>           output->location = *location;
>           output->component_mask = (comp_mask >> (s * 4)) & 0xf;
> +         output->component_offset = location_frac;
>
>           (*location)++;
>           /* attrib_slots would be only > 1 for doubles. On that case
> @@ -86,6 +88,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
>            * to use DIV_ROUND_UP or similar
>            */
>           *offset += comp_slots / attrib_slots * 4;
> +         location_frac = 0;
>        }
>     }
>  }
> diff --git a/src/compiler/nir/nir_xfb_info.h
> b/src/compiler/nir/nir_xfb_info.h
> index 9b543df5f47..fef52ba96d8 100644
> --- a/src/compiler/nir/nir_xfb_info.h
> +++ b/src/compiler/nir/nir_xfb_info.h
> @@ -34,6 +34,7 @@ typedef struct {
>     uint16_t offset;
>     uint8_t location;
>     uint8_t component_mask;
> +   uint8_t component_offset;
>  } nir_xfb_output_info;
>
>  typedef struct {
> --
> 2.14.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181108/f1be4942/attachment.html>


More information about the mesa-dev mailing list