Merge pull request #432 from Proudnoob4/fix/uninitialized-sgprs
Shaders: reads of uninitialized SGPRs read as zero, as VGPRs do
This commit is contained in:
3 files changed
+47
-1
No files matched your search
@@ -921,8 +921,16 @@ impl<'a> Lower<'a> {
|
||||
for &(reg, v) in &self.x.p.inputs {
|
||||
let val = match reg {
|
||||
Reg::S(_) if self.params.contains_key(&v) => continue, // loaded on first use
|
||||
Reg::S(_) => match io_inputs.get(&v) {
|
||||
Reg::S(n) => match io_inputs.get(&v) {
|
||||
Some(&input) => self.input(input),
|
||||
// Above the SGPRs the hardware initializes, a register
|
||||
// holds what the last wave left, so no program depends
|
||||
// on it: a read the paths only seem to allow (a branch
|
||||
// past the write, taken only with one past the read)
|
||||
// reads zero, as VGPRs do.
|
||||
None if n <= 105 && self.x.io.initialized_sgprs.is_some_and(|k| n >= k) => {
|
||||
Val::I32(self.s.m.i32(0))
|
||||
}
|
||||
None => Val::Missing("a hardware SGPR input"),
|
||||
},
|
||||
Reg::Scc => Val::Missing("SCC on entry"),
|
||||
|
||||
Reference in new issue
Block a user