[Mesa-dev] [PATCH] nir: fix lower vars to ssa for larger vector sizes.
Jason Ekstrand
jason at jlekstrand.net
Fri May 3 03:32:11 UTC 2019
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On Thu, May 2, 2019 at 10:25 PM Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This has a couple of hardcoded vec4 limits in it, change them
> to the proper sizing to avoid future issues.
> ---
> src/compiler/nir/nir_lower_vars_to_ssa.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c
> b/src/compiler/nir/nir_lower_vars_to_ssa.c
> index 1e7dc8d3579..a5f4ca53cf9 100644
> --- a/src/compiler/nir/nir_lower_vars_to_ssa.c
> +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
> @@ -534,7 +534,7 @@ rename_variables(struct lower_variables_state *state)
> nir_op_imov);
> mov->src[0].src = nir_src_for_ssa(
> nir_phi_builder_value_get_block_def(node->pb_value,
> block));
> - for (unsigned i = intrin->num_components; i < 4; i++)
> + for (unsigned i = intrin->num_components; i <
> NIR_MAX_VEC_COMPONENTS; i++)
> mov->src[0].swizzle[i] = 0;
>
> assert(intrin->dest.is_ssa);
> @@ -584,8 +584,8 @@ rename_variables(struct lower_variables_state *state)
> * intrin->num_components and value->num_components
> * may differ.
> */
> - unsigned swiz[4];
> - for (unsigned i = 0; i < 4; i++)
> + unsigned swiz[NIR_MAX_VEC_COMPONENTS];
> + for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++)
> swiz[i] = i < intrin->num_components ? i : 0;
>
> new_def = nir_swizzle(&b, value, swiz,
> @@ -597,7 +597,7 @@ rename_variables(struct lower_variables_state *state)
> * written values with the existing contents of unwritten
> * channels, creating a new SSA value for the whole vector.
> */
> - nir_ssa_def *srcs[4];
> + nir_ssa_def *srcs[NIR_MAX_VEC_COMPONENTS];
> for (unsigned i = 0; i < intrin->num_components; i++) {
> if (wrmask & (1 << i)) {
> srcs[i] = nir_channel(&b, value, i);
> --
> 2.21.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190502/28401aac/attachment.html>
More information about the mesa-dev
mailing list