aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Perry <[email protected]>2020-06-18 16:41:00 +0100
committerMarge Bot <[email protected]>2020-06-22 10:28:40 +0000
commit9a389322c444846e22bd2244c8df1c120aa47706 (patch)
treefa51b3f55ee5301d6a6710f333b2038b13d05cb1
parentc95d258d1bcde8d29e28aa182050a5da33a74456 (diff)
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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5547>
-rw-r--r--src/compiler/nir/nir_opcodes.py4
1 files 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, """