Module: Mesa Branch: main Commit: 01d15d8a38b02330945de2d2240cdff353ad0bc0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=01d15d8a38b02330945de2d2240cdff353ad0bc0
Author: Faith Ekstrand <faith.ekstr...@collabora.com> Date: Mon Nov 27 21:16:48 2023 -0600 nak: Revert "nak: Handle non-DW-aligned UBO loads" This reverts commit 70c9fc66ffab8cb85b37c74b507201097e16da85. We're now handling non-DW-aligned UBO loads in NIR where we can handle it a bit more completely, we don't need to carry the nak_from_nir code. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26412> --- src/nouveau/compiler/nak_from_nir.rs | 21 +++------------------ src/nouveau/compiler/nak_ir.rs | 5 ++--- 2 files changed, 5 insertions(+), 21 deletions(-) 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, } } }