summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2021-05-07 10:33:07 +0300
committerTapani Pälli <tapani.palli@intel.com>2021-05-10 08:07:29 +0300
commit181beece3c01cd98a57673846936d0f2686c96d9 (patch)
tree9030d4ec4fdd7a23cca98088d461050b8bdb1b4f
parent15b557319400424579dcb62c70ed8c72882b44bd (diff)
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>
-rw-r--r--src/compiler/nir/nir_lower_io.c6
1 files changed, 5 insertions, 1 deletions
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;