Mesa (main): nouveau/nir: Use natural alignment for scalars

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 1 16:27:11 UTC 2021


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

Author: M Henning <drawoc at darkrefraction.com>
Date:   Thu Nov 18 01:08:43 2021 -0500

nouveau/nir: Use natural alignment for scalars

We used to request vec4 alignment for everything on the nir codepath,
but this triggers an assertion failure since a0b82c24b6, which prohibits
vec4 alignment on scalars. Since requiring vec4 alignment on scalars is a
little silly anyway, this patch relaxes the alignment to naturally aligned
for scalars.

Fixes about 27 crashing tests in piglit and deqp on kepler, including eg
piglit/tests/spec/glsl-1.30/execution/fs-large-local-array.shader_test

Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13883>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index ff835fdb773..487a1e49b47 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -64,11 +64,15 @@ function_temp_type_info(const struct glsl_type *type, unsigned *size, unsigned *
 {
    assert(glsl_type_is_vector_or_scalar(type));
 
-   unsigned comp_size = glsl_type_is_boolean(type) ? 4 : glsl_get_bit_size(type) / 8;
-   unsigned length = glsl_get_vector_elements(type);
+   if (glsl_type_is_scalar(type)) {
+      glsl_get_natural_size_align_bytes(type, size, align);
+   } else {
+      unsigned comp_size = glsl_type_is_boolean(type) ? 4 : glsl_get_bit_size(type) / 8;
+      unsigned length = glsl_get_vector_elements(type);
 
-   *size = comp_size * length;
-   *align = 0x10;
+      *size = comp_size * length;
+      *align = 0x10;
+   }
 }
 
 class Converter : public ConverterCommon



More information about the mesa-commit mailing list