mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 04:40:09 +01:00
nir/lower_io: Assert non-zero power-of-two alignments
The way the ALIGN_POT macro works, an alignment of 0 may cause ALIGN_POT(x, 0) to return 0 for any x. Throw in an assert to guard against this case. Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069>
This commit is contained in:
parent
589d918a4f
commit
ef68f740a6
1 changed files with 1 additions and 0 deletions
|
|
@ -1889,6 +1889,7 @@ lower_vars_to_explicit(nir_shader *shader,
|
||||||
if (explicit_type != var->type)
|
if (explicit_type != var->type)
|
||||||
var->type = explicit_type;
|
var->type = explicit_type;
|
||||||
|
|
||||||
|
assert(util_is_power_of_two_nonzero(align));
|
||||||
var->data.driver_location = ALIGN_POT(offset, align);
|
var->data.driver_location = ALIGN_POT(offset, align);
|
||||||
offset = var->data.driver_location + size;
|
offset = var->data.driver_location + size;
|
||||||
progress = true;
|
progress = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue