* flat."
*
* From section 4.3.4 of the GLSL 3.00 ES spec:
- * "Fragment shader inputs that are signed or unsigned integers or
- * integer vectors must be qualified with the interpolation qualifier
- * flat."
+ * "Fragment shader inputs that are, or contain, signed or unsigned
+ * integers or integer vectors must be qualified with the
+ * interpolation qualifier flat."
*
* Since vertex outputs and fragment inputs must have matching
* qualifiers, these two requirements are equivalent.
if (state->is_version(130, 300)
&& state->target == vertex_shader
&& state->current_function == NULL
- && var->type->is_integer()
+ && var->type->contains_integer()
&& var->mode == ir_var_shader_out
&& var->interpolation != INTERP_QUALIFIER_FLAT) {
- _mesa_glsl_error(&loc, state, "If a vertex output is an integer, "
- "then it must be qualified with 'flat'");
+ _mesa_glsl_error(&loc, state, "If a vertex output is (or contains) "
+ "an integer, then it must be qualified with 'flat'");
}
}
}
+
+bool
+glsl_type::contains_integer() const
+{
+ if (this->is_array()) {
+ return this->fields.array->contains_integer();
+ } else if (this->is_record()) {
+ for (unsigned int i = 0; i < this->length; i++) {
+ if (this->fields.structure[i].type->contains_integer())
+ return true;
+ }
+ return false;
+ } else {
+ return this->is_integer();
+ }
+}
+
+
gl_texture_index
glsl_type::sampler_index() const
{
return (base_type == GLSL_TYPE_UINT) || (base_type == GLSL_TYPE_INT);
}
+ /**
+ * Query whether or not type is an integral type, or for struct and array
+ * types, contains an integral type.
+ */
+ bool contains_integer() const;
+
/**
* Query whether or not a type is a float type
*/