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@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13883>
This commit is contained in:
M Henning
2021-11-18 01:08:43 -05:00
committed by Marge Bot
parent 698343edc5
commit 17de0841ae

View File

@@ -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