Module: Mesa
Branch: main
Commit: 63e2bba592860eee99f38e436948ade86130ac69
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=63e2bba592860eee99f38e436948ade86130ac69

Author: Faith Ekstrand <faith.ekstr...@collabora.com>
Date:   Tue Dec 12 09:45:59 2023 -0600

nak: Don't set both FTZ and DNZ at the same time

Fixes: 3955e596df06 ("nak: Implement fmulz and ffmaz")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26654>

---

 src/nouveau/compiler/nak/from_nir.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/nouveau/compiler/nak/from_nir.rs 
b/src/nouveau/compiler/nak/from_nir.rs
index 1ca331ca603..63150ab426c 100644
--- a/src/nouveau/compiler/nak/from_nir.rs
+++ b/src/nouveau/compiler/nak/from_nir.rs
@@ -712,7 +712,9 @@ impl<'a> ShaderFromNir<'a> {
                     srcs: [srcs[0], srcs[1], srcs[2]],
                     saturate: self.try_saturate_alu_dst(&alu.def),
                     rnd_mode: self.float_ctl[ftype].rnd_mode,
-                    ftz: self.float_ctl[ftype].ftz,
+                    // The hardware doesn't like FTZ+DNZ and DNZ implies FTZ
+                    // anyway so only set one of the two bits.
+                    ftz: alu.op != nir_op_ffmaz && self.float_ctl[ftype].ftz,
                     dnz: alu.op == nir_op_ffmaz,
                 });
                 dst
@@ -741,7 +743,9 @@ impl<'a> ShaderFromNir<'a> {
                     srcs: [srcs[0], srcs[1]],
                     saturate: self.try_saturate_alu_dst(&alu.def),
                     rnd_mode: self.float_ctl[ftype].rnd_mode,
-                    ftz: self.float_ctl[ftype].ftz,
+                    // The hardware doesn't like FTZ+DNZ and DNZ implies FTZ
+                    // anyway so only set one of the two bits.
+                    ftz: alu.op != nir_op_fmulz && self.float_ctl[ftype].ftz,
                     dnz: alu.op == nir_op_fmulz,
                 });
                 dst

Reply via email to