mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 21:30:09 +01:00
nak/nir: Handle CBuf alignment rules
The NIR lowering is more complete and lets us properly handle 16-bit
loads which, weirdly, require a 4B alignment.
Fixes: bda208665f ("nak: Handle non-DW-aligned UBO loads")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26412>
This commit is contained in:
parent
57acffbba8
commit
67e6ca1924
1 changed files with 22 additions and 1 deletions
|
|
@ -989,7 +989,28 @@ nak_mem_access_size_align(nir_intrinsic_op intrin,
|
|||
if (intrin == nir_intrinsic_load_ubo)
|
||||
chunk_bytes = MIN2(chunk_bytes, 8);
|
||||
|
||||
if (chunk_bytes < 4) {
|
||||
if (intrin == nir_intrinsic_load_ubo && align < 4) {
|
||||
/* CBufs require 4B alignment unless we're doing a ldc.u8 or ldc.i8.
|
||||
* In particular, this applies to ldc.u16 which means we either have to
|
||||
* fall back to two ldc.u8 or use ldc.u32 and shift stuff around to get
|
||||
* the 16bit value out. Fortunately, nir_lower_mem_access_bit_sizes()
|
||||
* can handle over-alignment for reads.
|
||||
*/
|
||||
if (align == 2 || offset_is_const) {
|
||||
return (nir_mem_access_size_align) {
|
||||
.bit_size = 32,
|
||||
.num_components = 1,
|
||||
.align = 4,
|
||||
};
|
||||
} else {
|
||||
assert(align == 1);
|
||||
return (nir_mem_access_size_align) {
|
||||
.bit_size = 8,
|
||||
.num_components = 1,
|
||||
.align = 1,
|
||||
};
|
||||
}
|
||||
} else if (chunk_bytes < 4) {
|
||||
return (nir_mem_access_size_align) {
|
||||
.bit_size = chunk_bytes * 8,
|
||||
.num_components = 1,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue