From 9a389322c444846e22bd2244c8df1c120aa47706 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 18 Jun 2020 16:41:00 +0100 Subject: [PATCH] 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 Reviewed-by: Jason Ekstrand Part-of: --- 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, """ -- 2.30.2