Mesa (main): nir: skip assert check with empty structs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 10 06:05:47 UTC 2021


Module: Mesa
Branch: main
Commit: 181beece3c01cd98a57673846936d0f2686c96d9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=181beece3c01cd98a57673846936d0f2686c96d9

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Fri May  7 10:33:07 2021 +0300

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 at intel.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10681>

---

 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;



More information about the mesa-commit mailing list