mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 04:50:11 +01:00
nak: Handle non-DW-aligned UBO loads
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26348>
This commit is contained in:
parent
ed535c9d98
commit
bda208665f
2 changed files with 21 additions and 5 deletions
|
|
@ -2010,9 +2010,24 @@ impl<'a> ShaderFromNir<'a> {
|
||||||
offset: off_imm.try_into().unwrap(),
|
offset: off_imm.try_into().unwrap(),
|
||||||
};
|
};
|
||||||
if off.is_zero() {
|
if off.is_zero() {
|
||||||
for (i, comp) in dst.iter().enumerate() {
|
if off_imm % 4 == 0 {
|
||||||
let i = u16::try_from(i).unwrap();
|
for (i, comp) in dst.iter().enumerate() {
|
||||||
b.copy_to((*comp).into(), cb.offset(i * 4).into());
|
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);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
b.push_op(OpLdc {
|
b.push_op(OpLdc {
|
||||||
|
|
|
||||||
|
|
@ -742,10 +742,11 @@ pub struct CBufRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CBufRef {
|
impl CBufRef {
|
||||||
pub fn offset(self, offset: u16) -> CBufRef {
|
pub fn offset(self, offset: i16) -> CBufRef {
|
||||||
CBufRef {
|
CBufRef {
|
||||||
buf: self.buf,
|
buf: self.buf,
|
||||||
offset: self.offset + offset,
|
offset: (i32::from(self.offset) +
|
||||||
|
i32::from(offset)).try_into().unwrap(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue