vkd3d-shader/hlsl: Use common hlsl_type_is_integer() and hlsl_base_type_is_integer() helpers.

This commit is contained in:
Elizabeth Figura
2025-02-28 18:50:53 -06:00
committed by Henri Verbeet
parent bd34ec1fb3
commit 3cf4a4e95e
Notes: Henri Verbeet 2025-03-06 17:32:40 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1387
4 changed files with 22 additions and 41 deletions

View File

@@ -298,12 +298,9 @@ bool hlsl_type_is_patch_array(const struct hlsl_type *type)
|| type->e.array.array_type == HLSL_ARRAY_PATCH_OUTPUT);
}
bool hlsl_type_is_integer(const struct hlsl_type *type)
bool hlsl_base_type_is_integer(enum hlsl_base_type type)
{
if (!hlsl_is_numeric_type(type))
return false;
switch (type->e.numeric.type)
switch (type)
{
case HLSL_TYPE_BOOL:
case HLSL_TYPE_INT:
@@ -319,6 +316,12 @@ bool hlsl_type_is_integer(const struct hlsl_type *type)
vkd3d_unreachable();
}
bool hlsl_type_is_integer(const struct hlsl_type *type)
{
VKD3D_ASSERT(hlsl_is_numeric_type(type));
return hlsl_base_type_is_integer(type->e.numeric.type);
}
bool hlsl_type_is_floating_point(const struct hlsl_type *type)
{
if (!hlsl_is_numeric_type(type))