mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/ir: Introduce a helper for validating DCL_HS_MAX_TESSFACTOR.
This commit is contained in:
committed by
Henri Verbeet
parent
e1c3266793
commit
0f07a2c512
Notes:
Henri Verbeet
2024-09-16 14:22:01 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1074
@@ -6197,6 +6197,17 @@ static void vsir_validate_branch(struct validation_context *ctx, const struct vk
|
|||||||
ctx->inside_block = false;
|
ctx->inside_block = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_dcl_hs_max_tessfactor(struct validation_context *ctx,
|
||||||
|
const struct vkd3d_shader_instruction *instruction)
|
||||||
|
{
|
||||||
|
/* Exclude non-finite values. */
|
||||||
|
if (!(instruction->declaration.max_tessellation_factor >= 1.0f
|
||||||
|
&& instruction->declaration.max_tessellation_factor <= 64.0f))
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
|
||||||
|
"Max tessellation factor %f is invalid.",
|
||||||
|
instruction->declaration.max_tessellation_factor);
|
||||||
|
}
|
||||||
|
|
||||||
static void vsir_validate_dcl_temps(struct validation_context *ctx,
|
static void vsir_validate_dcl_temps(struct validation_context *ctx,
|
||||||
const struct vkd3d_shader_instruction *instruction)
|
const struct vkd3d_shader_instruction *instruction)
|
||||||
{
|
{
|
||||||
@@ -6434,6 +6445,7 @@ struct vsir_validator_instruction_desc
|
|||||||
static const struct vsir_validator_instruction_desc vsir_validator_instructions[] =
|
static const struct vsir_validator_instruction_desc vsir_validator_instructions[] =
|
||||||
{
|
{
|
||||||
[VKD3DSIH_BRANCH] = {0, ~0u, vsir_validate_branch},
|
[VKD3DSIH_BRANCH] = {0, ~0u, vsir_validate_branch},
|
||||||
|
[VKD3DSIH_DCL_HS_MAX_TESSFACTOR] = {0, 0, vsir_validate_dcl_hs_max_tessfactor},
|
||||||
[VKD3DSIH_DCL_TEMPS] = {0, 0, vsir_validate_dcl_temps},
|
[VKD3DSIH_DCL_TEMPS] = {0, 0, vsir_validate_dcl_temps},
|
||||||
[VKD3DSIH_ELSE] = {0, 0, vsir_validate_else},
|
[VKD3DSIH_ELSE] = {0, 0, vsir_validate_else},
|
||||||
[VKD3DSIH_ENDIF] = {0, 0, vsir_validate_endif},
|
[VKD3DSIH_ENDIF] = {0, 0, vsir_validate_endif},
|
||||||
@@ -6492,14 +6504,6 @@ static void vsir_validate_instruction(struct validation_context *ctx)
|
|||||||
ctx->dcl_temps_found = false;
|
ctx->dcl_temps_found = false;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case VKD3DSIH_DCL_HS_MAX_TESSFACTOR:
|
|
||||||
/* Exclude non-finite values. */
|
|
||||||
if (!(instruction->declaration.max_tessellation_factor >= 1.0f
|
|
||||||
&& instruction->declaration.max_tessellation_factor <= 64.0f))
|
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION, "Max tessellation factor %f is invalid.",
|
|
||||||
instruction->declaration.max_tessellation_factor);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case VKD3DSIH_DCL_INPUT_PRIMITIVE:
|
case VKD3DSIH_DCL_INPUT_PRIMITIVE:
|
||||||
if (instruction->declaration.primitive_type.type == VKD3D_PT_UNDEFINED
|
if (instruction->declaration.primitive_type.type == VKD3D_PT_UNDEFINED
|
||||||
|| instruction->declaration.primitive_type.type >= VKD3D_PT_COUNT)
|
|| instruction->declaration.primitive_type.type >= VKD3D_PT_COUNT)
|
||||||
|
Reference in New Issue
Block a user