* operation is done component-wise resulting in the same size
* vector."
*/
- if (is_glsl_type_vector(type_a) && is_glsl_type_vector(type_b)) {
+ if (type_a->is_vector() && type_b->is_vector()) {
if (type_a->vector_elements == type_b->vector_elements)
return type_a;
else
* wise to the vector, resulting in the same type as the vector. If both
* are vectors of the same size, the result is computed component-wise."
*/
- if (is_glsl_type_vector(type_a)) {
- if (!is_glsl_type_vector(type_b)
+ if (type_a->is_vector()) {
+ if (!type_b->is_vector()
|| (type_a->vector_elements == type_b->vector_elements))
return type_a;
} else
&& (base_type >= GLSL_TYPE_UINT)
&& (base_type <= GLSL_TYPE_BOOL);
}
-};
-#define is_glsl_type_vector(t) \
- (((t)->vector_elements > 0) \
- && ((t)->matrix_rows == 0) \
- && ((t)->base_type >= GLSL_TYPE_UINT) \
- && ((t)->base_type <= GLSL_TYPE_BOOL))
+ /**
+ * Query whether or not a type is a vector
+ */
+ bool is_vector() const
+ {
+ return (vector_elements > 0)
+ && (matrix_rows == 0)
+ && (base_type >= GLSL_TYPE_UINT)
+ && (base_type <= GLSL_TYPE_BOOL);
+ }
+};
#define is_glsl_type_matrix(t) \
(((t)->matrix_rows > 0) \
* being applied.
*/
loc = expr->get_location();
- if (is_glsl_type_vector(op->type)) {
+ if (op->type->is_vector()) {
if (generate_swizzle(expr->primary_expression.identifier,
& deref->selector.swizzle,
op->type->vector_elements)) {