From: Boris Brezillon Date: Fri, 26 Jun 2020 08:27:16 +0000 (+0200) Subject: glsl: Propagate packed info in get_explicit_type_for_size_align() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=be68de81abb3cf2d6944c4c5273c453a61437208;p=mesa.git glsl: Propagate packed info in get_explicit_type_for_size_align() Right now, when calling get_explicit_type_for_size_align() on a packed struct, the packed attribute is lost and field offsets are wrong. Signed-off-by: Boris Brezillon Reviewed-by: Jason Ekstrand Reviewed-by: Jesse Natalie Part-of: --- diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index a5f5f5854e4..ab4c2954864 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -2465,6 +2465,7 @@ glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info, unsigned field_size, field_align; fields[i].type = fields[i].type->get_explicit_type_for_size_align(type_info, &field_size, &field_align); + field_align = this->packed ? 1 : field_align; fields[i].offset = align(*size, field_align); *size = fields[i].offset + field_size; @@ -2473,8 +2474,10 @@ glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info, const glsl_type *type; if (this->is_struct()) { - type = get_struct_instance(fields, this->length, this->name, false); + type = get_struct_instance(fields, this->length, this->name, + this->packed); } else { + assert(!this->packed); type = get_interface_instance(fields, this->length, (enum glsl_interface_packing)this->interface_packing, this->interface_row_major,