compiler: set alignment=1 by default for handling empty struct/interface in glsl_types.cpp

When there is no elements in struct/interface, the alignment of it should be 1 instead of 0.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23841>
This commit is contained in:
Yonggang Luo 2023-06-23 20:31:00 +08:00 committed by Marge Bot
parent 68b9ad0ba7
commit 75ac852253

View file

@ -2697,7 +2697,7 @@ glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info,
malloc(sizeof(struct glsl_struct_field) * this->length);
*size = 0;
*alignment = 0;
*alignment = 1;
for (unsigned i = 0; i < this->length; i++) {
fields[i] = this->fields.structure[i];
assert(fields[i].matrix_layout != GLSL_MATRIX_LAYOUT_ROW_MAJOR);