From: Juan A. Suarez Romero Date: Thu, 27 Oct 2016 10:36:09 +0000 (+0200) Subject: glsl: inspect interfaces in contains_foo() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d83820a1d4f6b2390520d2335848d351db13fd7;p=mesa.git glsl: inspect interfaces in contains_foo() When checking if a type contains doubles, integers, samples, etc. we check if the current type is a record or array, but not if it is an interface. This commit also inspects if the type is an interface. It fixes spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-block-with-double.vert piglit test. Reviewed-by: Timothy Arceri --- diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index 55e5285f6c1..44cd2acb61d 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -248,7 +248,7 @@ glsl_type::contains_sampler() const { if (this->is_array()) { return this->fields.array->contains_sampler(); - } else if (this->is_record()) { + } else if (this->is_record() || this->is_interface()) { for (unsigned int i = 0; i < this->length; i++) { if (this->fields.structure[i].type->contains_sampler()) return true; @@ -265,7 +265,7 @@ glsl_type::contains_integer() const { if (this->is_array()) { return this->fields.array->contains_integer(); - } else if (this->is_record()) { + } else if (this->is_record() || this->is_interface()) { for (unsigned int i = 0; i < this->length; i++) { if (this->fields.structure[i].type->contains_integer()) return true; @@ -281,7 +281,7 @@ glsl_type::contains_double() const { if (this->is_array()) { return this->fields.array->contains_double(); - } else if (this->is_record()) { + } else if (this->is_record() || this->is_interface()) { for (unsigned int i = 0; i < this->length; i++) { if (this->fields.structure[i].type->contains_double()) return true; @@ -302,6 +302,7 @@ glsl_type::contains_opaque() const { case GLSL_TYPE_ARRAY: return fields.array->contains_opaque(); case GLSL_TYPE_STRUCT: + case GLSL_TYPE_INTERFACE: for (unsigned int i = 0; i < length; i++) { if (fields.structure[i].type->contains_opaque()) return true; @@ -317,7 +318,7 @@ glsl_type::contains_subroutine() const { if (this->is_array()) { return this->fields.array->contains_subroutine(); - } else if (this->is_record()) { + } else if (this->is_record() || this->is_interface()) { for (unsigned int i = 0; i < this->length; i++) { if (this->fields.structure[i].type->contains_subroutine()) return true; @@ -363,7 +364,7 @@ glsl_type::contains_image() const { if (this->is_array()) { return this->fields.array->contains_image(); - } else if (this->is_record()) { + } else if (this->is_record() || this->is_interface()) { for (unsigned int i = 0; i < this->length; i++) { if (this->fields.structure[i].type->contains_image()) return true; diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index e5b9f3ba03d..f607dd8bc37 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -473,14 +473,14 @@ struct glsl_type { } /** - * Query whether or not type is an integral type, or for struct and array - * types, contains an integral type. + * Query whether or not type is an integral type, or for struct, interface + * and array types, contains an integral type. */ bool contains_integer() const; /** - * Query whether or not type is a double type, or for struct and array - * types, contains a double type. + * Query whether or not type is a double type, or for struct, interface and + * array types, contains a double type. */ bool contains_double() const; @@ -533,8 +533,8 @@ struct glsl_type { } /** - * Query whether or not type is a sampler, or for struct and array - * types, contains a sampler. + * Query whether or not type is a sampler, or for struct, interface and + * array types, contains a sampler. */ bool contains_sampler() const; @@ -544,8 +544,8 @@ struct glsl_type { gl_texture_index sampler_index() const; /** - * Query whether or not type is an image, or for struct and array - * types, contains an image. + * Query whether or not type is an image, or for struct, interface and + * array types, contains an image. */ bool contains_image() const;