nak: Use undef for unset FSOut components

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27742>
This commit is contained in:
M Henning
2024-02-21 08:32:09 -05:00
committed by Marge Bot
parent fdfccfa8fa
commit 1fb74672a9
2 changed files with 8 additions and 2 deletions

View File

@@ -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)

View File

@@ -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.