[Mesa-dev] [PATCH 3/8] nir/spirv: Restrict the number of channels in texture coordinates

Eric Anholt eric at anholt.net
Thu Mar 9 00:32:51 UTC 2017


Jason Ekstrand <jason at jlekstrand.net> writes:

> Some SPIR-V texturing instructions pack more than the texture coordinate
> into the coordinate source.  We need to mask off the unused channels.
> ---
>  src/compiler/spirv/spirv_to_nir.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
> index 1dd6651..fa28576 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -1567,7 +1567,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
>           coord_components++;
>  
>        coord = vtn_ssa_value(b, w[idx++])->def;
> -      p->src = nir_src_for_ssa(coord);
> +      p->src = nir_src_for_ssa(nir_channels(&b->nb, coord,
> +                                            (1 << coord_components) - 1));

All nir_channels() calls are using a mask without holes or bottom bits
missing, so it would be nice to rewrite it to take a number of channels
instead, I think.  That's a cleanup for later, though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170308/f8a2f535/attachment.sig>


More information about the mesa-dev mailing list