From 181beece3c01cd98a57673846936d0f2686c96d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Fri, 7 May 2021 10:33:07 +0300 Subject: [PATCH] nir: skip assert check with empty structs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Timothy Arceri Part-of: --- src/compiler/nir/nir_lower_io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 6a6527019b5..025f7eb8be1 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -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;