Convert is_glsl_type_scalar to glsl_type::is_scalar
This commit is contained in:
@@ -110,7 +110,7 @@ arithmetic_result_type(const struct glsl_type *type_a,
|
||||
* * The two operands are scalars. In this case the operation is
|
||||
* applied, resulting in a scalar."
|
||||
*/
|
||||
if (is_glsl_type_scalar(type_a) && is_glsl_type_scalar(type_b))
|
||||
if (type_a->is_scalar() && type_b->is_scalar())
|
||||
return type_a;
|
||||
|
||||
/* "* One operand is a scalar, and the other is a vector or matrix.
|
||||
@@ -118,10 +118,10 @@ arithmetic_result_type(const struct glsl_type *type_a,
|
||||
* component of the vector or matrix, resulting in the same size
|
||||
* vector or matrix."
|
||||
*/
|
||||
if (is_glsl_type_scalar(type_a)) {
|
||||
if (!is_glsl_type_scalar(type_b))
|
||||
if (type_a->is_scalar()) {
|
||||
if (!type_b->is_scalar())
|
||||
return type_b;
|
||||
} else if (is_glsl_type_scalar(type_b)) {
|
||||
} else if (type_b->is_scalar()) {
|
||||
return type_a;
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ relational_result_type(const struct glsl_type *type_a,
|
||||
*/
|
||||
if (! is_numeric_base_type(type_a->base_type)
|
||||
|| ! is_numeric_base_type(type_b->base_type)
|
||||
|| ! is_glsl_type_scalar(type_a)
|
||||
|| ! is_glsl_type_scalar(type_b))
|
||||
|| !type_a->is_scalar()
|
||||
|| !type_b->is_scalar())
|
||||
return glsl_error_type;
|
||||
|
||||
/* "Either the operands' types must match, or the conversions from
|
||||
@@ -513,7 +513,7 @@ ast_expression::hir(exec_list *instructions,
|
||||
*/
|
||||
assert((type == glsl_error_type)
|
||||
|| ((type->base_type == GLSL_TYPE_BOOL)
|
||||
&& is_glsl_type_scalar(type)));
|
||||
&& type->is_scalar()));
|
||||
|
||||
result = new ir_expression(operations[this->oper], type,
|
||||
op[0], op[1]);
|
||||
|
15
glsl_types.h
15
glsl_types.h
@@ -135,12 +135,17 @@ struct glsl_type {
|
||||
{
|
||||
this->fields.structure = fields;
|
||||
}
|
||||
};
|
||||
|
||||
#define is_glsl_type_scalar(t) \
|
||||
(((t)->vector_elements == 0) \
|
||||
&& ((t)->base_type >= GLSL_TYPE_UINT) \
|
||||
&& ((t)->base_type <= GLSL_TYPE_BOOL))
|
||||
/**
|
||||
* Query whether or not a type is a scalar (non-vector and non-matrix).
|
||||
*/
|
||||
bool is_scalar() const
|
||||
{
|
||||
return (vector_elements == 0)
|
||||
&& (base_type >= GLSL_TYPE_UINT)
|
||||
&& (base_type <= GLSL_TYPE_BOOL);
|
||||
}
|
||||
};
|
||||
|
||||
#define is_glsl_type_vector(t) \
|
||||
(((t)->vector_elements > 0) \
|
||||
|
Reference in New Issue
Block a user