From bc2828a436ada4b1264cb92fe2d50c8b833d83be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Wed, 14 Jun 2023 17:00:22 +0200 Subject: [PATCH] compiler: Allow the explicit_stride of aoa types to be zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The explicit stride doesn't have to be defined to aoa and therefore can be zero in some cases, like in arrays of arrays of uniform blocks. Resolves crash with spec@arb_gl_spirv@execution@ubo@aoa-2.shader_test piglit test for virgl. Signed-off-by: Corentin Noël Reviewed-by: Alejandro Piñeiro Acked-by: Gert Wollny Cc: mesa-stable Part-of: --- src/compiler/glsl_types.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index 64dd8caa71f..3929b95f500 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -2445,7 +2445,7 @@ glsl_type::explicit_size(bool align_to_stride) const assert(this->length > 0); unsigned elem_size = align_to_stride ? this->explicit_stride : this->fields.array->explicit_size(); - assert(this->explicit_stride >= elem_size); + assert(this->explicit_stride == 0 || this->explicit_stride >= elem_size); return this->explicit_stride * (this->length - 1) + elem_size; } else if (this->is_matrix()) {