mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 10:50:16 +01:00
nir_lower_mem_access_bit_sizes: Assert when 0 components or bits are requested
Prevent the accidental passing of 0 components or bits, as it makes no sense.
Cc: mesa-stable
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Suggested-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31103>
(cherry picked from commit 6bf7b5bcd8)
This commit is contained in:
parent
8df5f285f3
commit
49a6ecb59d
2 changed files with 9 additions and 1 deletions
|
|
@ -2454,7 +2454,7 @@
|
|||
"description": "nir_lower_mem_access_bit_sizes: Assert when 0 components or bits are requested",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ lower_mem_load(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
bit_size, align_mul, whole_align_offset,
|
||||
offset_is_const, cb_data);
|
||||
|
||||
assert(requested.num_components > 0);
|
||||
assert(requested.bit_size > 0);
|
||||
assert(util_is_power_of_two_nonzero(align_mul));
|
||||
assert(util_is_power_of_two_nonzero(requested.align));
|
||||
if (requested.num_components == num_components &&
|
||||
|
|
@ -112,6 +114,8 @@ lower_mem_load(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
offset_is_const, cb_data);
|
||||
|
||||
unsigned chunk_bytes;
|
||||
assert(requested.num_components > 0);
|
||||
assert(requested.bit_size > 0);
|
||||
assert(util_is_power_of_two_nonzero(requested.align));
|
||||
if (align_mul < requested.align) {
|
||||
/* For this case, we need to be able to shift the value so we assume
|
||||
|
|
@ -249,6 +253,8 @@ lower_mem_store(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
bit_size, align_mul, whole_align_offset,
|
||||
offset_is_const, cb_data);
|
||||
|
||||
assert(requested.num_components > 0);
|
||||
assert(requested.bit_size > 0);
|
||||
assert(util_is_power_of_two_nonzero(align_mul));
|
||||
assert(util_is_power_of_two_nonzero(requested.align));
|
||||
if (requested.num_components == num_components &&
|
||||
|
|
@ -289,6 +295,8 @@ lower_mem_store(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
|
||||
uint32_t chunk_bytes = requested.num_components * (requested.bit_size / 8);
|
||||
|
||||
assert(requested.num_components > 0);
|
||||
assert(requested.bit_size > 0);
|
||||
assert(util_is_power_of_two_nonzero(requested.align));
|
||||
if (chunk_align < requested.align ||
|
||||
chunk_bytes > max_chunk_bytes) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue