vkd3d-shader/hlsl: Make min16uint into a first-class type.

And properly implement translation into some binary enumerations.
This commit is contained in:
Elizabeth Figura
2025-01-27 16:34:22 -06:00
committed by Henri Verbeet
parent 16be9181a0
commit 18ca7affad
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
7 changed files with 151 additions and 31 deletions

View File

@@ -304,6 +304,7 @@ bool hlsl_base_type_is_integer(enum hlsl_base_type type)
{
case HLSL_TYPE_BOOL:
case HLSL_TYPE_INT:
case HLSL_TYPE_MIN16UINT:
case HLSL_TYPE_UINT:
return true;
@@ -516,6 +517,8 @@ static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, e
{
struct hlsl_type *type;
TRACE("New type %s.\n", name);
if (!(type = hlsl_alloc(ctx, sizeof(*type))))
return NULL;
if (!(type->name = hlsl_strdup(ctx, name)))
@@ -2908,6 +2911,7 @@ static void hlsl_dump_type(struct vkd3d_string_buffer *buffer, const struct hlsl
[HLSL_TYPE_HALF] = "half",
[HLSL_TYPE_DOUBLE] = "double",
[HLSL_TYPE_INT] = "int",
[HLSL_TYPE_MIN16UINT] = "min16uint",
[HLSL_TYPE_UINT] = "uint",
[HLSL_TYPE_BOOL] = "bool",
};
@@ -3375,6 +3379,7 @@ static void dump_ir_constant(struct vkd3d_string_buffer *buffer, const struct hl
vkd3d_string_buffer_printf(buffer, "%d ", value->i);
break;
case HLSL_TYPE_MIN16UINT:
case HLSL_TYPE_UINT:
vkd3d_string_buffer_printf(buffer, "%u ", value->u);
break;
@@ -4401,17 +4406,17 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
static const char * const names[] =
{
[HLSL_TYPE_FLOAT] = "float",
[HLSL_TYPE_HALF] = "half",
[HLSL_TYPE_DOUBLE] = "double",
[HLSL_TYPE_INT] = "int",
[HLSL_TYPE_UINT] = "uint",
[HLSL_TYPE_BOOL] = "bool",
[HLSL_TYPE_FLOAT] = "float",
[HLSL_TYPE_HALF] = "half",
[HLSL_TYPE_DOUBLE] = "double",
[HLSL_TYPE_INT] = "int",
[HLSL_TYPE_UINT] = "uint",
[HLSL_TYPE_BOOL] = "bool",
[HLSL_TYPE_MIN16UINT] = "min16uint",
};
static const char *const variants_float[] = {"min10float", "min16float"};
static const char *const variants_int[] = {"min12int", "min16int"};
static const char *const variants_uint[] = {"min16uint"};
static const char *const sampler_names[] =
{
@@ -4502,11 +4507,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
n_variants = ARRAY_SIZE(variants_int);
break;
case HLSL_TYPE_UINT:
variants = variants_uint;
n_variants = ARRAY_SIZE(variants_uint);
break;
default:
n_variants = 0;
variants = NULL;