compiler/types: Add a contains_32bit helper

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540>
This commit is contained in:
Timothy Arceri 2022-08-05 14:07:11 +10:00 committed by Marge Bot
parent 5f1f6d7496
commit 6fbf336788
2 changed files with 17 additions and 0 deletions

View file

@ -239,6 +239,22 @@ glsl_contains_double(const glsl_type *t)
}
}
bool
glsl_type_contains_32bit(const glsl_type *t)
{
if (glsl_type_is_array(t)) {
return glsl_type_contains_32bit(t->fields.array);
} else if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) {
for (unsigned int i = 0; i < t->length; i++) {
if (glsl_type_contains_32bit(t->fields.structure[i].type))
return true;
}
return false;
} else {
return glsl_type_is_32bit(t);
}
}
bool
glsl_type_contains_64bit(const glsl_type *t)
{

View file

@ -824,6 +824,7 @@ unsigned glsl_atomic_size(const glsl_type *type);
* Type A contains type B if A is B or A is a composite type (struct,
* interface, array) that has an element that contains B.
*/
bool glsl_type_contains_32bit(const glsl_type *t);
bool glsl_type_contains_64bit(const glsl_type *t);
bool glsl_type_contains_image(const glsl_type *t);
bool glsl_contains_atomic(const glsl_type *t);