[Mesa-dev] [PATCH v2] nir: fix output offset compute for dvec3/4

Jason Ekstrand jason at jlekstrand.net
Fri Nov 9 16:12:17 UTC 2018


Cool.  1-3 are

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Fri, Nov 9, 2018 at 7:09 AM Alejandro PiƱeiro <apinheiro at igalia.com>
wrote:

> The offset compute was working fine for the case of attrib_slots=1,
> and updating the offset for the following varying.
>
> But in the case of attrib_slots=2 (so dvec3/4), we are basically
> splitting the comp_slots needed in two outputs. In that case we can't
> add to the offset the full size of the type.
>
> v2: added assert and some parenthesis to improve readability (Jason)
> ---
>  src/compiler/nir/nir_gather_xfb_info.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir_gather_xfb_info.c
> b/src/compiler/nir/nir_gather_xfb_info.c
> index f8d4cd833c7..f4f597da4f5 100644
> --- a/src/compiler/nir/nir_gather_xfb_info.c
> +++ b/src/compiler/nir/nir_gather_xfb_info.c
> @@ -81,7 +81,12 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
>           output->component_mask = (comp_mask >> (s * 4)) & 0xf;
>
>           (*location)++;
> -         *offset += comp_slots * 4;
> +         /* attrib_slots would be only > 1 for doubles. On that case
> +          * comp_slots will be a multiple of 2, so the following doesn't
> need
> +          * to use DIV_ROUND_UP or similar
> +          */
> +         assert(comp_slots % attrib_slots == 0);
> +         *offset += (comp_slots / attrib_slots) * 4;
>        }
>     }
>  }
> --
> 2.14.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181109/3bd0a41e/attachment.html>


More information about the mesa-dev mailing list