Mesa (master): vc4: Fix FLR for integer values less than 0.

Eric Anholt anholt at kemper.freedesktop.org
Fri Aug 22 17:19:15 UTC 2014


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Aug 20 14:44:36 2014 -0700

vc4: Fix FLR for integer values less than 0.

If we didn't truncate at all, then we don't need to fix for truncation
happening in the wrong direction.

Fixes piglit builtin-functions/*-floor-*

---

 src/gallium/drivers/vc4/vc4_program.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index c11ee5a..9f59bdf 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -431,8 +431,14 @@ tgsi_to_qir_flr(struct tgsi_to_qir *trans,
 {
         struct qcompile *c = trans->c;
         struct qreg trunc = qir_ITOF(c, qir_FTOI(c, src[0 * 4 + i]));
+
+        /* This will be < 0 if we truncated and the truncation was of a value
+         * that was < 0 in the first place.
+         */
+        struct qreg diff = qir_FSUB(c, src[0 * 4 + i], trunc);
+
         return qir_CMP(c,
-                       src[0 * 4 + i],
+                       diff,
                        qir_FSUB(c, trunc, qir_uniform_f(trans, 1.0)),
                        trunc);
 }




More information about the mesa-commit mailing list