nir/types: Add glsl_float16_type() helper
This returns the float16 version of a float type. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3822>
This commit is contained in:
parent
c822460f85
commit
6c750d9c4d
|
@ -462,6 +462,16 @@ const glsl_type *glsl_type::get_bare_type() const
|
|||
unreachable("Invalid base type");
|
||||
}
|
||||
|
||||
const glsl_type *glsl_type::get_float16_type() const
|
||||
{
|
||||
assert(this->base_type == GLSL_TYPE_FLOAT);
|
||||
|
||||
return get_instance(GLSL_TYPE_FLOAT16,
|
||||
this->vector_elements,
|
||||
this->matrix_columns,
|
||||
this->explicit_stride,
|
||||
this->interface_row_major);
|
||||
}
|
||||
|
||||
static void
|
||||
hash_free_type_function(struct hash_entry *entry)
|
||||
|
|
|
@ -394,6 +394,11 @@ public:
|
|||
*/
|
||||
const glsl_type *get_bare_type() const;
|
||||
|
||||
/**
|
||||
* Gets the float16 version of this type.
|
||||
*/
|
||||
const glsl_type *get_float16_type() const;
|
||||
|
||||
/**
|
||||
* Get the instance of a built-in scalar, vector, or matrix type
|
||||
*/
|
||||
|
|
|
@ -620,6 +620,12 @@ glsl_channel_type(const glsl_type *t)
|
|||
}
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
glsl_float16_type(const struct glsl_type *type)
|
||||
{
|
||||
return type->get_float16_type();
|
||||
}
|
||||
|
||||
void
|
||||
glsl_get_natural_size_align_bytes(const struct glsl_type *type,
|
||||
unsigned *size, unsigned *align)
|
||||
|
|
|
@ -198,6 +198,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);
|
||||
|
||||
void glsl_get_natural_size_align_bytes(const struct glsl_type *type,
|
||||
unsigned *size, unsigned *align);
|
||||
|
||||
|
|
Loading…
Reference in New Issue