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>
This commit is contained in:

committed by
Marge Bot

parent
d0c2958f88
commit
be68de81ab
@@ -2465,6 +2465,7 @@ glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info,
|
|||||||
unsigned field_size, field_align;
|
unsigned field_size, field_align;
|
||||||
fields[i].type =
|
fields[i].type =
|
||||||
fields[i].type->get_explicit_type_for_size_align(type_info, &field_size, &field_align);
|
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);
|
fields[i].offset = align(*size, field_align);
|
||||||
|
|
||||||
*size = fields[i].offset + field_size;
|
*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;
|
const glsl_type *type;
|
||||||
if (this->is_struct()) {
|
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 {
|
} else {
|
||||||
|
assert(!this->packed);
|
||||||
type = get_interface_instance(fields, this->length,
|
type = get_interface_instance(fields, this->length,
|
||||||
(enum glsl_interface_packing)this->interface_packing,
|
(enum glsl_interface_packing)this->interface_packing,
|
||||||
this->interface_row_major,
|
this->interface_row_major,
|
||||||
|
Reference in New Issue
Block a user