nir/types: Add array_or_matrix helpers

Reviewed-by: Thomas Helland<thomashelland90@gmail.com>
This commit is contained in:
Jason Ekstrand 2018-07-25 08:53:58 -07:00
parent b03dcb1e5f
commit b489998e63
2 changed files with 17 additions and 0 deletions

View file

@ -50,6 +50,15 @@ glsl_without_array(const glsl_type *type)
return type->without_array();
}
const glsl_type *
glsl_without_array_or_matrix(const glsl_type *type)
{
type = type->without_array();
if (type->is_matrix())
type = type->column_type();
return type;
}
const glsl_type *
glsl_get_array_instance(const glsl_type *type,
unsigned array_size)
@ -230,6 +239,12 @@ glsl_type_is_array_of_arrays(const struct glsl_type *type)
return type->is_array_of_arrays();
}
bool
glsl_type_is_array_or_matrix(const struct glsl_type *type)
{
return type->is_array() || type->is_matrix();
}
bool
glsl_type_is_struct(const struct glsl_type *type)
{

View file

@ -48,6 +48,7 @@ const struct glsl_type *glsl_get_struct_field(const struct glsl_type *type,
const struct glsl_type *glsl_get_array_element(const struct glsl_type *type);
const struct glsl_type *glsl_without_array(const struct glsl_type *type);
const struct glsl_type *glsl_without_array_or_matrix(const struct glsl_type *type);
const struct glsl_type *glsl_get_array_instance(const struct glsl_type *type,
unsigned array_size);
@ -133,6 +134,7 @@ bool glsl_type_is_vector_or_scalar(const struct glsl_type *type);
bool glsl_type_is_matrix(const struct glsl_type *type);
bool glsl_type_is_array(const struct glsl_type *type);
bool glsl_type_is_array_of_arrays(const struct glsl_type *type);
bool glsl_type_is_array_or_matrix(const struct glsl_type *type);
bool glsl_type_is_struct(const struct glsl_type *type);
bool glsl_type_is_sampler(const struct glsl_type *type);
bool glsl_type_is_image(const struct glsl_type *type);