Mesa (master): tgsi_to_nir: Make the TGSI IF translation code more readable.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 5 19:14:04 UTC 2019


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

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Thu Feb 14 01:01:04 2019 +0200

tgsi_to_nir: Make the TGSI IF translation code more readable.

This patch is a minor cleanup that only intends to make the
TGSI IF translation a bit easier to read.

Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Tested-by: Andre Heider <a.heider at gmail.com>
Tested-by: Rob Clark <robdclark at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

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

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 545051e84ff..bd2aaaed0dc 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -949,14 +949,15 @@ static void
 ttn_if(struct ttn_compile *c, nir_ssa_def *src, bool is_uint)
 {
    nir_builder *b = &c->build;
-
-   src = ttn_channel(b, src, X);
+   nir_ssa_def *src_x = ttn_channel(b, src, X);
 
    nir_if *if_stmt = nir_if_create(b->shader);
    if (is_uint) {
-      if_stmt->condition = nir_src_for_ssa(nir_ine(b, src, nir_imm_int(b, 0)));
+      /* equivalent to TGSI UIF, src is interpreted as integer */
+      if_stmt->condition = nir_src_for_ssa(nir_ine(b, src_x, nir_imm_int(b, 0)));
    } else {
-      if_stmt->condition = nir_src_for_ssa(nir_fne(b, src, nir_imm_int(b, 0)));
+      /* equivalent to TGSI IF, src is interpreted as float */
+      if_stmt->condition = nir_src_for_ssa(nir_fne(b, src_x, nir_imm_float(b, 0.0)));
    }
    nir_builder_cf_insert(b, &if_stmt->cf_node);
 




More information about the mesa-commit mailing list