Mesa (master): ttn: Fix number of components for IF/UIF

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 1 14:06:29 UTC 2020


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Thu Oct  1 11:02:41 2020 +0200

ttn: Fix number of components for IF/UIF

NIR if statements only take one component, but TGSI registers are vec4.
We're supposed to compare the x component, per
https://docs.mesa3d.org/gallium/tgsi.html#opcode-IF.

Fixes: f103bded ("ttn: Use nir control flow insertion helpers")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Tested-by: Leo Liu <leo.liu at amd.com>
Closes: #3585
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6956>

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 4f9705fc95b..37b21fc3804 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -2122,11 +2122,11 @@ ttn_emit_instruction(struct ttn_compile *c)
       break;
 
    case TGSI_OPCODE_IF:
-      nir_push_if(b, nir_fneu(b, src[0], nir_imm_float(b, 0.0)));
+      nir_push_if(b, nir_fneu(b, nir_channel(b, src[0], 0), nir_imm_float(b, 0.0)));
       break;
 
    case TGSI_OPCODE_UIF:
-      nir_push_if(b, nir_ine(b, src[0], nir_imm_int(b, 0)));
+      nir_push_if(b, nir_ine(b, nir_channel(b, src[0], 0), nir_imm_int(b, 0)));
       break;
 
    case TGSI_OPCODE_ELSE:



More information about the mesa-commit mailing list