Mesa (master): nir/spirv: Restrict the number of channels in texture coordinates

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue Mar 14 15:56:35 UTC 2017


Module: Mesa
Branch: master
Commit: fffa4111dfe6eb10fb478967ca0798331dfd525f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fffa4111dfe6eb10fb478967ca0798331dfd525f

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Mar  2 19:03:01 2017 -0800

nir/spirv: Restrict the number of channels in texture coordinates

Some SPIR-V texturing instructions pack more than the texture coordinate
into the coordinate source.  We need to mask off the unused channels.

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

---

 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 8a02904..5b7d8f9 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1568,7 +1568,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));
       p->src_type = nir_tex_src_coord;
       p++;
       break;




More information about the mesa-commit mailing list