mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 13:10:10 +01:00
Convert is_glsl_type_vector to glsl_type::is_vector
This commit is contained in:
parent
cb36f8aaee
commit
a2dd22fb19
3 changed files with 15 additions and 10 deletions
|
|
@ -136,7 +136,7 @@ arithmetic_result_type(const struct glsl_type *type_a,
|
|||
* 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
|
||||
|
|
@ -261,8 +261,8 @@ modulus_result_type(const struct glsl_type *type_a,
|
|||
* 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
|
||||
|
|
|
|||
17
glsl_types.h
17
glsl_types.h
|
|
@ -145,13 +145,18 @@ struct glsl_type {
|
|||
&& (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) \
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
|
|||
* 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)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue