From 1fb74672a91b28cc62f2bcb881047135f0258a8c Mon Sep 17 00:00:00 2001 From: M Henning Date: Wed, 21 Feb 2024 08:32:09 -0500 Subject: [PATCH] nak: Use undef for unset FSOut components Part-of: --- src/nouveau/compiler/nak/builder.rs | 6 ++++++ src/nouveau/compiler/nak/from_nir.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/builder.rs b/src/nouveau/compiler/nak/builder.rs index 4be2438afd5..1b85a385b4f 100644 --- a/src/nouveau/compiler/nak/builder.rs +++ b/src/nouveau/compiler/nak/builder.rs @@ -652,6 +652,12 @@ pub trait SSABuilder: Builder { } } + fn undef(&mut self) -> SSARef { + let dst = self.alloc_ssa(RegFile::GPR, 1); + self.push_op(OpUndef { dst: dst.into() }); + dst + } + fn copy(&mut self, src: Src) -> SSARef { let dst = if src.is_predicate() { self.alloc_ssa(RegFile::Pred, 1) diff --git a/src/nouveau/compiler/nak/from_nir.rs b/src/nouveau/compiler/nak/from_nir.rs index 9d967e49e59..303aa6d2b4f 100644 --- a/src/nouveau/compiler/nak/from_nir.rs +++ b/src/nouveau/compiler/nak/from_nir.rs @@ -2249,7 +2249,7 @@ impl<'a> ShaderFromNir<'a> { for c in 0..4 { let reg = self.fs_out_regs[i * 4 + c]; if reg.is_none() { - srcs.push(0.into()); + srcs.push(b.undef().into()); } else { srcs.push(reg.into()); } @@ -2262,7 +2262,7 @@ impl<'a> ShaderFromNir<'a> { if info.writes_sample_mask { srcs.push(self.fs_out_regs[mask_idx].into()); } else { - srcs.push(0.into()); + srcs.push(b.undef().into()); } if info.writes_depth { // Saturate depth writes.