diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2020-06-26 10:27:16 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-09-03 18:02:50 +0000 |
commit | be68de81abb3cf2d6944c4c5273c453a61437208 (patch) | |
tree | 3696bf0c026c716b817e3de7d4ef806a2c337a62 | |
parent | d0c2958f882a9644d98d61c49f3b8a842ea2c48f (diff) |
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 <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
-rw-r--r-- | src/compiler/glsl_types.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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, |