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 <timothy.arceri@collabora.com>
This commit is contained in:
Juan A. Suarez Romero
2016-10-27 12:36:09 +02:00
parent 66fcfa6894
commit 5d83820a1d
2 changed files with 14 additions and 13 deletions

View File

@@ -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;

View File

@@ -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;