nir: skip assert check with empty structs

Fixes issues with upcoming CTS test testing empty structs.

v2: decorate with UNUSED as only used in assert (Timothy)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10681>
This commit is contained in:
Tapani Pälli
2021-05-07 10:33:07 +03:00
parent 15b5573194
commit 181beece3c
+5 -1
View File
@@ -2264,7 +2264,11 @@ lower_vars_to_explicit(nir_shader *shader,
if (explicit_type != var->type)
var->type = explicit_type;
assert(util_is_power_of_two_nonzero(align));
UNUSED bool is_empty_struct =
glsl_type_is_struct_or_ifc(explicit_type) &&
glsl_get_length(explicit_type) == 0;
assert(util_is_power_of_two_nonzero(align) || is_empty_struct);
var->data.driver_location = ALIGN_POT(offset, align);
offset = var->data.driver_location + size;
progress = true;