diff --git a/src/nouveau/compiler/nak_from_nir.rs b/src/nouveau/compiler/nak_from_nir.rs index a19e248754e..71ef1f30be3 100644 --- a/src/nouveau/compiler/nak_from_nir.rs +++ b/src/nouveau/compiler/nak_from_nir.rs @@ -2010,24 +2010,9 @@ impl<'a> ShaderFromNir<'a> { offset: off_imm.try_into().unwrap(), }; if off.is_zero() { - if off_imm % 4 == 0 { - for (i, comp) in dst.iter().enumerate() { - let i = i16::try_from(i).unwrap(); - b.copy_to( - (*comp).into(), - cb.offset(i * 4).into(), - ); - } - } else { - let delta: u8 = (off_imm % 4).try_into().unwrap(); - let aligned_cb = cb.offset(-i16::from(delta)); - let tmp = b.copy(aligned_cb.into()); - let prmt = match size_B { - 1 => [delta, 4, 4, 4], - 2 => [delta, delta + 1, 4, 4], - _ => panic!("Invalid load_ubo"), - }; - b.prmt_to(dst.into(), tmp.into(), 0.into(), prmt); + for (i, comp) in dst.iter().enumerate() { + let i = u16::try_from(i).unwrap(); + b.copy_to((*comp).into(), cb.offset(i * 4).into()); } } else { b.push_op(OpLdc { diff --git a/src/nouveau/compiler/nak_ir.rs b/src/nouveau/compiler/nak_ir.rs index 3533f65461f..89bcaac929a 100644 --- a/src/nouveau/compiler/nak_ir.rs +++ b/src/nouveau/compiler/nak_ir.rs @@ -742,11 +742,10 @@ pub struct CBufRef { } impl CBufRef { - pub fn offset(self, offset: i16) -> CBufRef { + pub fn offset(self, offset: u16) -> CBufRef { CBufRef { buf: self.buf, - offset: (i32::from(self.offset) + - i32::from(offset)).try_into().unwrap(), + offset: self.offset + offset, } } }