From a880f97d593a461bdcce27e526423a9b1d6834b4 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 28 Jul 2020 18:01:19 -0500 Subject: [PATCH] compiler/types: Allow interfaces in get_explicit_type_for_size_align Reviewed-by: Jesse Natalie Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- src/compiler/glsl_types.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index e093034aa9f..b631de5f354 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -2439,7 +2439,7 @@ glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info, *size = stride * (this->length - 1) + elem_size; *alignment = elem_align; return glsl_type::get_array_instance(explicit_element, this->length, stride); - } else if (this->is_struct()) { + } else if (this->is_struct() || this->is_interface()) { struct glsl_struct_field *fields = (struct glsl_struct_field *) malloc(sizeof(struct glsl_struct_field) * this->length); @@ -2458,7 +2458,15 @@ glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info, *alignment = MAX2(*alignment, field_align); } - const glsl_type *type = glsl_type::get_struct_instance(fields, this->length, this->name, false); + const glsl_type *type; + if (this->is_struct()) { + type = get_struct_instance(fields, this->length, this->name, false); + } else { + type = get_interface_instance(fields, this->length, + (enum glsl_interface_packing)this->interface_packing, + this->interface_row_major, + this->name); + } free(fields); return type; } else if (this->is_matrix()) { -- 2.30.2