vkd3d-shader/hlsl: Emit an error when min16uint is used in d3dbc target profiles.

Fixes: 18ca7affad
This commit is contained in:
Elizabeth Figura
2025-03-12 21:52:46 -05:00
committed by Henri Verbeet
parent 8f6616993b
commit cdc74a9377
Notes: Henri Verbeet 2025-05-14 15:27:07 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1496
4 changed files with 26 additions and 22 deletions

View File

@@ -319,6 +319,28 @@ bool hlsl_type_is_shader(const struct hlsl_type *type)
return false;
}
bool hlsl_type_is_minimum_precision(const struct hlsl_type *type)
{
if (!hlsl_is_numeric_type(type))
return false;
switch (type->e.numeric.type)
{
case HLSL_TYPE_BOOL:
case HLSL_TYPE_DOUBLE:
case HLSL_TYPE_FLOAT:
case HLSL_TYPE_HALF:
case HLSL_TYPE_INT:
case HLSL_TYPE_UINT:
return false;
case HLSL_TYPE_MIN16UINT:
return true;
}
vkd3d_unreachable();
}
bool hlsl_type_is_patch_array(const struct hlsl_type *type)
{
return type->class == HLSL_CLASS_ARRAY && (type->e.array.array_type == HLSL_ARRAY_PATCH_INPUT

View File

@@ -1775,6 +1775,7 @@ unsigned int hlsl_type_minor_size(const struct hlsl_type *type);
unsigned int hlsl_type_major_size(const struct hlsl_type *type);
unsigned int hlsl_type_element_count(const struct hlsl_type *type);
bool hlsl_type_is_integer(const struct hlsl_type *type);
bool hlsl_type_is_minimum_precision(const struct hlsl_type *type);
bool hlsl_type_is_resource(const struct hlsl_type *type);
bool hlsl_type_is_shader(const struct hlsl_type *type);
bool hlsl_type_is_patch_array(const struct hlsl_type *type);

View File

@@ -8177,14 +8177,14 @@ type_no_void:
| TYPE_IDENTIFIER
{
$$ = hlsl_get_type(ctx->cur_scope, $1, true, true);
if ($$->is_minimum_precision)
if ($$->is_minimum_precision || hlsl_type_is_minimum_precision($$))
{
if (hlsl_version_lt(ctx, 4, 0))
{
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
"Target profile doesn't support minimum-precision types.");
}
else
else if ($$->is_minimum_precision)
{
FIXME("Reinterpreting type %s.\n", $$->name);
}

View File

@@ -11838,25 +11838,6 @@ static void generate_vsir_scan_required_features(struct hlsl_ctx *ctx, struct vs
* STENCIL_REF, and TYPED_UAV_LOAD_ADDITIONAL_FORMATS. */
}
static bool is_minimum_precision(enum hlsl_base_type type)
{
switch (type)
{
case HLSL_TYPE_BOOL:
case HLSL_TYPE_DOUBLE:
case HLSL_TYPE_FLOAT:
case HLSL_TYPE_HALF:
case HLSL_TYPE_INT:
case HLSL_TYPE_UINT:
return false;
case HLSL_TYPE_MIN16UINT:
return true;
}
vkd3d_unreachable();
}
static void generate_vsir_scan_global_flags(struct hlsl_ctx *ctx,
struct vsir_program *program, const struct hlsl_ir_function_decl *entry_func)
{
@@ -11894,7 +11875,7 @@ static void generate_vsir_scan_global_flags(struct hlsl_ctx *ctx,
/* Note that it doesn't matter if the semantic is unused or doesn't
* generate a signature element (e.g. SV_DispatchThreadID). */
if ((var->is_input_semantic || var->is_output_semantic)
&& (type->is_minimum_precision || is_minimum_precision(type->e.numeric.type)))
&& (type->is_minimum_precision || hlsl_type_is_minimum_precision(type)))
{
program->global_flags |= VKD3DSGF_ENABLE_MINIMUM_PRECISION;
break;