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>
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 9d9e320..318e2a0 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -1889,6 +1889,7 @@
if (explicit_type != var->type)
var->type = explicit_type;
+ assert(util_is_power_of_two_nonzero(align));
var->data.driver_location = ALIGN_POT(offset, align);
offset = var->data.driver_location + size;
progress = true;