compiler/types: Flip wrapping of base_type checks

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25470>
This commit is contained in:
Caio Oliveira 2023-09-01 22:35:26 -07:00 committed by Marge Bot
parent 68f3b0100f
commit dd9ced45f5
3 changed files with 30 additions and 91 deletions

View file

@ -1162,20 +1162,25 @@ glsl_get_bit_size(const struct glsl_type *t)
return glsl_base_type_get_bit_size(glsl_get_base_type(t));
}
bool glsl_type_is_boolean(const struct glsl_type *t);
bool glsl_type_is_sampler(const struct glsl_type *t);
bool glsl_type_is_texture(const struct glsl_type *t);
bool glsl_type_is_image(const struct glsl_type *t);
bool glsl_type_is_atomic_uint(const struct glsl_type *t);
bool glsl_type_is_struct(const struct glsl_type *t);
bool glsl_type_is_interface(const struct glsl_type *t);
bool glsl_type_is_array(const struct glsl_type *t);
bool glsl_type_is_cmat(const struct glsl_type *t);
bool glsl_type_is_void(const struct glsl_type *t);
bool glsl_type_is_subroutine(const struct glsl_type *t);
bool glsl_type_is_error(const struct glsl_type *t);
static inline bool glsl_type_is_boolean(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_BOOL; }
static inline bool glsl_type_is_sampler(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_SAMPLER; }
static inline bool glsl_type_is_texture(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_TEXTURE; }
static inline bool glsl_type_is_image(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_IMAGE; }
static inline bool glsl_type_is_atomic_uint(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_ATOMIC_UINT; }
static inline bool glsl_type_is_struct(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_STRUCT; }
static inline bool glsl_type_is_interface(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_INTERFACE; }
static inline bool glsl_type_is_array(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_ARRAY; }
static inline bool glsl_type_is_cmat(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_COOPERATIVE_MATRIX; }
static inline bool glsl_type_is_void(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_VOID; }
static inline bool glsl_type_is_subroutine(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_SUBROUTINE; }
static inline bool glsl_type_is_error(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_ERROR; }
static inline bool
glsl_type_is_struct_or_ifc(const struct glsl_type *t)
{
return glsl_type_is_struct(t) || glsl_type_is_interface(t);
}
bool glsl_type_is_struct_or_ifc(const struct glsl_type *t);
bool glsl_type_is_packed(const struct glsl_type *t);
bool glsl_type_is_16bit(const struct glsl_type *t);
bool glsl_type_is_32bit(const struct glsl_type *t);

View file

@ -12,19 +12,18 @@
#include "compiler/builtin_types_cpp.h"
#undef BUILTIN_TYPES_CPP_DEFINITIONS
inline bool glsl_type::is_boolean() const { return base_type == GLSL_TYPE_BOOL; }
inline bool glsl_type::is_sampler() const { return base_type == GLSL_TYPE_SAMPLER; }
inline bool glsl_type::is_texture() const { return base_type == GLSL_TYPE_TEXTURE; }
inline bool glsl_type::is_image() const { return base_type == GLSL_TYPE_IMAGE; }
inline bool glsl_type::is_array() const { return base_type == GLSL_TYPE_ARRAY; }
inline bool glsl_type::is_struct() const { return base_type == GLSL_TYPE_STRUCT; }
inline bool glsl_type::is_interface() const { return base_type == GLSL_TYPE_INTERFACE; }
inline bool glsl_type::is_cmat() const { return base_type == GLSL_TYPE_COOPERATIVE_MATRIX; }
inline bool glsl_type::is_void() const { return base_type == GLSL_TYPE_VOID; }
inline bool glsl_type::is_error() const { return base_type == GLSL_TYPE_ERROR; }
inline bool glsl_type::is_subroutine() const { return base_type == GLSL_TYPE_SUBROUTINE; }
inline bool glsl_type::is_atomic_uint() const { return base_type == GLSL_TYPE_ATOMIC_UINT; }
inline bool glsl_type::is_boolean() const { return glsl_type_is_boolean(this); }
inline bool glsl_type::is_sampler() const { return glsl_type_is_sampler(this); }
inline bool glsl_type::is_texture() const { return glsl_type_is_texture(this); }
inline bool glsl_type::is_image() const { return glsl_type_is_image(this); }
inline bool glsl_type::is_array() const { return glsl_type_is_array(this); }
inline bool glsl_type::is_struct() const { return glsl_type_is_struct(this); }
inline bool glsl_type::is_interface() const { return glsl_type_is_interface(this); }
inline bool glsl_type::is_cmat() const { return glsl_type_is_cmat(this); }
inline bool glsl_type::is_void() const { return glsl_type_is_void(this); }
inline bool glsl_type::is_error() const { return glsl_type_is_error(this); }
inline bool glsl_type::is_subroutine() const { return glsl_type_is_subroutine(this); }
inline bool glsl_type::is_atomic_uint() const { return glsl_type_is_atomic_uint(this); }
inline bool
glsl_type::is_scalar() const

View file

@ -268,18 +268,6 @@ glsl_type_is_64bit(const struct glsl_type *type)
return type->is_64bit();
}
bool
glsl_type_is_void(const struct glsl_type *type)
{
return type->is_void();
}
bool
glsl_type_is_error(const struct glsl_type *type)
{
return type->is_error();
}
bool
glsl_type_is_vector(const struct glsl_type *type)
{
@ -311,12 +299,6 @@ glsl_matrix_type_is_row_major(const struct glsl_type *type)
return type->interface_row_major;
}
bool
glsl_type_is_array(const struct glsl_type *type)
{
return type->is_array();
}
bool
glsl_type_is_unsized_array(const struct glsl_type *type)
{
@ -335,54 +317,12 @@ glsl_type_is_array_or_matrix(const struct glsl_type *type)
return type->is_array() || type->is_matrix();
}
bool
glsl_type_is_cmat(const struct glsl_type *type)
{
return type->is_cmat();
}
bool
glsl_type_is_struct(const struct glsl_type *type)
{
return type->is_struct();
}
bool
glsl_type_is_interface(const struct glsl_type *type)
{
return type->is_interface();
}
bool
glsl_type_is_struct_or_ifc(const struct glsl_type *type)
{
return type->is_struct() || type->is_interface();
}
bool
glsl_type_is_sampler(const struct glsl_type *type)
{
return type->is_sampler();
}
bool
glsl_type_is_bare_sampler(const struct glsl_type *type)
{
return type->is_sampler() && type->sampled_type == GLSL_TYPE_VOID;
}
bool
glsl_type_is_texture(const struct glsl_type *type)
{
return type->is_texture();
}
bool
glsl_type_is_image(const struct glsl_type *type)
{
return type->is_image();
}
bool
glsl_sampler_type_is_shadow(const struct glsl_type *type)
{
@ -418,11 +358,6 @@ glsl_type_is_numeric(const struct glsl_type *type)
return type->is_numeric();
}
bool
glsl_type_is_boolean(const struct glsl_type *type)
{
return type->is_boolean();
}
bool
glsl_type_is_integer(const struct glsl_type *type)
{