mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-23 04:00:23 +01:00
nak: Handle negative cbuf offset immediates
This can happen with indirect UBO pulls because we just try go find an iadd in NIR and one side may be negative. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26615>
This commit is contained in:
parent
7bfb7a2b81
commit
eabd8cd470
1 changed files with 11 additions and 2 deletions
|
|
@ -2190,13 +2190,22 @@ impl<'a> ShaderFromNir<'a> {
|
|||
let size_B =
|
||||
(intrin.def.bit_size() / 8) * intrin.def.num_components();
|
||||
let idx = srcs[0];
|
||||
|
||||
let (off, off_imm) = self.get_io_addr_offset(&srcs[1], 16);
|
||||
let (off, off_imm) =
|
||||
if let Ok(off_imm_u16) = u16::try_from(off_imm) {
|
||||
(off, off_imm_u16)
|
||||
} else {
|
||||
(self.get_src(&srcs[1]), 0)
|
||||
};
|
||||
|
||||
let dst = b.alloc_ssa(RegFile::GPR, size_B.div_ceil(4));
|
||||
|
||||
if let Some(idx_imm) = idx.as_uint() {
|
||||
let idx_imm: u8 = idx_imm.try_into().unwrap();
|
||||
let cb = CBufRef {
|
||||
buf: CBuf::Binding(idx_imm.try_into().unwrap()),
|
||||
offset: off_imm.try_into().unwrap(),
|
||||
buf: CBuf::Binding(idx_imm),
|
||||
offset: off_imm,
|
||||
};
|
||||
if off.is_zero() {
|
||||
for (i, comp) in dst.iter().enumerate() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue