Mesa (master): nir: slight correction to cube_face_coord constant folding

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 22 10:45:10 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Jun 18 16:41:00 2020 +0100

nir: slight correction to cube_face_coord constant folding

ACO does the division with a rcp and then a multiplication.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5547>

---

 src/compiler/nir/nir_opcodes.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 6a5d025f636..f18668493b2 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -487,8 +487,8 @@ if (src0.y < 0 && absY >= absX && absY >= absZ) { dst.x = src0.x; dst.y = -src0.
 if (src0.z >= 0 && absZ >= absX && absZ >= absY) { dst.x = src0.x; dst.y = -src0.y; }
 if (src0.z < 0 && absZ >= absX && absZ >= absY) { dst.x = -src0.x; dst.y = -src0.y; }
 
-dst.x = dst.x / ma + 0.5;
-dst.y = dst.y / ma + 0.5;
+dst.x = dst.x * (1.0f / ma) + 0.5f;
+dst.y = dst.y * (1.0f / ma) + 0.5f;
 """)
 
 unop_horiz("cube_face_index", 1, tfloat32, 3, tfloat32, """



More information about the mesa-commit mailing list