Mesa (master): compiler/types: Allow interfaces in get_explicit_type_for_size_align
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 19 20:02:02 UTC 2020
Module: Mesa
Branch: master
Commit: a880f97d593a461bdcce27e526423a9b1d6834b4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a880f97d593a461bdcce27e526423a9b1d6834b4
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Tue Jul 28 18:01:19 2020 -0500
compiler/types: Allow interfaces in get_explicit_type_for_size_align
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6210>
---
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()) {
More information about the mesa-commit
mailing list