nir: add int16 and uint16 type helpers

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5002>
This commit is contained in:
Marek Olšák 2020-05-11 00:42:51 -04:00 committed by Marge Bot
parent f798513f91
commit 6f2e95f24d
4 changed files with 46 additions and 0 deletions

View file

@ -473,6 +473,28 @@ const glsl_type *glsl_type::get_float16_type() const
this->interface_row_major);
}
const glsl_type *glsl_type::get_int16_type() const
{
assert(this->base_type == GLSL_TYPE_INT);
return get_instance(GLSL_TYPE_INT16,
this->vector_elements,
this->matrix_columns,
this->explicit_stride,
this->interface_row_major);
}
const glsl_type *glsl_type::get_uint16_type() const
{
assert(this->base_type == GLSL_TYPE_UINT);
return get_instance(GLSL_TYPE_UINT16,
this->vector_elements,
this->matrix_columns,
this->explicit_stride,
this->interface_row_major);
}
static void
hash_free_type_function(struct hash_entry *entry)
{

View file

@ -400,6 +400,16 @@ public:
*/
const glsl_type *get_float16_type() const;
/**
* Gets the int16 version of this type.
*/
const glsl_type *get_int16_type() const;
/**
* Gets the uint16 version of this type.
*/
const glsl_type *get_uint16_type() const;
/**
* Get the instance of a built-in scalar, vector, or matrix type
*/

View file

@ -632,6 +632,18 @@ glsl_float16_type(const struct glsl_type *type)
return type->get_float16_type();
}
const glsl_type *
glsl_int16_type(const struct glsl_type *type)
{
return type->get_int16_type();
}
const glsl_type *
glsl_uint16_type(const struct glsl_type *type)
{
return type->get_uint16_type();
}
void
glsl_get_natural_size_align_bytes(const struct glsl_type *type,
unsigned *size, unsigned *align)

View file

@ -210,6 +210,8 @@ const struct glsl_type *glsl_transposed_type(const struct glsl_type *type);
const struct glsl_type *glsl_channel_type(const struct glsl_type *type);
const struct glsl_type *glsl_float16_type(const struct glsl_type *type);
const struct glsl_type *glsl_int16_type(const struct glsl_type *type);
const struct glsl_type *glsl_uint16_type(const struct glsl_type *type);
void glsl_get_natural_size_align_bytes(const struct glsl_type *type,
unsigned *size, unsigned *align);