mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
ac/nir: round components when lowering 8/16-bit loads to 32-bit
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34162>
This commit is contained in:
parent
f538cae743
commit
ddef4bddf8
2 changed files with 8 additions and 0 deletions
|
|
@ -103,8 +103,10 @@ lower_mem_access_cb(nir_intrinsic_op intrin, uint8_t bytes, uint8_t bit_size, ui
|
|||
}
|
||||
|
||||
res.num_components = DIV_ROUND_UP(bytes, 4);
|
||||
res.num_components = nir_round_down_components(res.num_components);
|
||||
} else {
|
||||
res.num_components = DIV_ROUND_UP(bytes + max_pad, 4);
|
||||
res.num_components = nir_round_up_components(res.num_components);
|
||||
}
|
||||
res.num_components = MIN2(res.num_components, max_components);
|
||||
res.bit_size = 32;
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ nir_round_up_components(unsigned n)
|
|||
return (n > 5) ? util_next_power_of_two(n) : n;
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
nir_round_down_components(unsigned n)
|
||||
{
|
||||
return (n > 5) ? MAX2(1 << util_logbase2(n), 5) : n;
|
||||
}
|
||||
|
||||
static inline nir_component_mask_t
|
||||
nir_component_mask(unsigned num_components)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue