mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Emit an error when min16uint is used in d3dbc target profiles.
Fixes: 18ca7affad
This commit is contained in:
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
@@ -319,6 +319,28 @@ bool hlsl_type_is_shader(const struct hlsl_type *type)
|
|||||||
return false;
|
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)
|
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
|
return type->class == HLSL_CLASS_ARRAY && (type->e.array.array_type == HLSL_ARRAY_PATCH_INPUT
|
||||||
|
@@ -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_major_size(const struct hlsl_type *type);
|
||||||
unsigned int hlsl_type_element_count(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_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_resource(const struct hlsl_type *type);
|
||||||
bool hlsl_type_is_shader(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);
|
bool hlsl_type_is_patch_array(const struct hlsl_type *type);
|
||||||
|
@@ -8177,14 +8177,14 @@ type_no_void:
|
|||||||
| TYPE_IDENTIFIER
|
| TYPE_IDENTIFIER
|
||||||
{
|
{
|
||||||
$$ = hlsl_get_type(ctx->cur_scope, $1, true, true);
|
$$ = 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))
|
if (hlsl_version_lt(ctx, 4, 0))
|
||||||
{
|
{
|
||||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||||
"Target profile doesn't support minimum-precision types.");
|
"Target profile doesn't support minimum-precision types.");
|
||||||
}
|
}
|
||||||
else
|
else if ($$->is_minimum_precision)
|
||||||
{
|
{
|
||||||
FIXME("Reinterpreting type %s.\n", $$->name);
|
FIXME("Reinterpreting type %s.\n", $$->name);
|
||||||
}
|
}
|
||||||
|
@@ -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. */
|
* 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,
|
static void generate_vsir_scan_global_flags(struct hlsl_ctx *ctx,
|
||||||
struct vsir_program *program, const struct hlsl_ir_function_decl *entry_func)
|
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
|
/* Note that it doesn't matter if the semantic is unused or doesn't
|
||||||
* generate a signature element (e.g. SV_DispatchThreadID). */
|
* generate a signature element (e.g. SV_DispatchThreadID). */
|
||||||
if ((var->is_input_semantic || var->is_output_semantic)
|
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;
|
program->global_flags |= VKD3DSGF_ENABLE_MINIMUM_PRECISION;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user