mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 13:40:11 +01:00
nir/types: Add more type constructor functions
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
f05f576803
commit
7410c60988
2 changed files with 58 additions and 0 deletions
|
|
@ -249,12 +249,44 @@ glsl_vec4_type(void)
|
|||
return glsl_type::vec4_type;
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_int_type(void)
|
||||
{
|
||||
return glsl_type::int_type;
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_uint_type(void)
|
||||
{
|
||||
return glsl_type::uint_type;
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_bool_type(void)
|
||||
{
|
||||
return glsl_type::bool_type;
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_scalar_type(enum glsl_base_type base_type)
|
||||
{
|
||||
return glsl_type::get_instance(base_type, 1, 1);
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_vector_type(enum glsl_base_type base_type, unsigned components)
|
||||
{
|
||||
assert(components > 1 && components <= 4);
|
||||
return glsl_type::get_instance(base_type, components, 1);
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_matrix_type(enum glsl_base_type base_type, unsigned rows, unsigned columns)
|
||||
{
|
||||
assert(rows > 1 && rows <= 4 && columns >= 1 && columns <= 4);
|
||||
return glsl_type::get_instance(base_type, rows, columns);
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_array_type(const glsl_type *base, unsigned elements)
|
||||
{
|
||||
|
|
@ -262,6 +294,12 @@ glsl_array_type(const glsl_type *base, unsigned elements)
|
|||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_struct_type(const glsl_struct_field *fields,
|
||||
unsigned num_fields, const char *name)
|
||||
{
|
||||
return glsl_type::get_record_instance(fields, num_fields, name);
|
||||
}
|
||||
|
||||
const struct glsl_type *
|
||||
glsl_sampler_type(enum glsl_sampler_dim dim, bool is_shadow, bool is_array,
|
||||
enum glsl_base_type base_type)
|
||||
|
|
@ -288,3 +326,11 @@ glsl_function_type(const glsl_type *return_type,
|
|||
{
|
||||
return glsl_type::get_function_instance(return_type, params, num_params);
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_transposed_type(const struct glsl_type *type)
|
||||
{
|
||||
assert(glsl_type_is_matrix(type));
|
||||
return glsl_type::get_instance(type->base_type, type->matrix_columns,
|
||||
type->vector_elements);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,9 +94,19 @@ const struct glsl_type *glsl_void_type(void);
|
|||
const struct glsl_type *glsl_float_type(void);
|
||||
const struct glsl_type *glsl_vec_type(unsigned n);
|
||||
const struct glsl_type *glsl_vec4_type(void);
|
||||
const struct glsl_type *glsl_int_type(void);
|
||||
const struct glsl_type *glsl_uint_type(void);
|
||||
const struct glsl_type *glsl_bool_type(void);
|
||||
|
||||
const struct glsl_type *glsl_scalar_type(enum glsl_base_type base_type);
|
||||
const struct glsl_type *glsl_vector_type(enum glsl_base_type base_type,
|
||||
unsigned components);
|
||||
const struct glsl_type *glsl_matrix_type(enum glsl_base_type base_type,
|
||||
unsigned rows, unsigned columns);
|
||||
const struct glsl_type *glsl_array_type(const struct glsl_type *base,
|
||||
unsigned elements);
|
||||
const struct glsl_type *glsl_struct_type(const struct glsl_struct_field *fields,
|
||||
unsigned num_fields, const char *name);
|
||||
const struct glsl_type *glsl_sampler_type(enum glsl_sampler_dim dim,
|
||||
bool is_shadow, bool is_array,
|
||||
enum glsl_base_type base_type);
|
||||
|
|
@ -108,6 +118,8 @@ const struct glsl_type * glsl_function_type(const struct glsl_type *return_type,
|
|||
const struct glsl_function_param *params,
|
||||
unsigned num_params);
|
||||
|
||||
const struct glsl_type *glsl_transposed_type(const struct glsl_type *type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue