Mesa (master): tgsi_to_nir: Fix the TGSI ARR translation by converting the result to int.

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


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

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Thu Feb  7 18:01:24 2019 +0100

tgsi_to_nir: Fix the TGSI ARR translation by converting the result to int.

According to the TGSI spec, ARR needs to do a rounding and then
a float-to-integer conversion which was missing. This patch also
makes the rounding a bit more efficient by using nir_fround_even
instead of the previous nir_ffloor+nir_fadd trick.

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: Eric Anholt <eric at anholt.net>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index cee98444290..b35950289b9 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -906,7 +906,7 @@ ttn_umad(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
 static void
 ttn_arr(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
 {
-   ttn_move_dest(b, dest, nir_ffloor(b, nir_fadd(b, src[0], nir_imm_float(b, 0.5))));
+   ttn_move_dest(b, dest, nir_f2i32(b, nir_fround_even(b, src[0])));
 }
 
 static void




More information about the mesa-commit mailing list