vkd3d-shader/ir: Introduce a helper for validating DCL_OUTPUT_CONTROL_POINT_COUNT.

This commit is contained in:
Giovanni Mascellani 2024-09-12 12:03:29 +02:00 committed by Henri Verbeet
parent 0e9fcb1431
commit 8aa2364381
Notes: Henri Verbeet 2024-09-16 19:36:47 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1077

View File

@ -6225,6 +6225,15 @@ static void vsir_validate_dcl_input_primitive(struct validation_context *ctx,
instruction->declaration.primitive_type.type);
}
static void vsir_validate_dcl_output_control_point_count(struct validation_context *ctx,
const struct vkd3d_shader_instruction *instruction)
{
if (!instruction->declaration.count || instruction->declaration.count > 32)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
"Output control point count %u is invalid.",
instruction->declaration.count);
}
static void vsir_validate_dcl_output_topology(struct validation_context *ctx,
const struct vkd3d_shader_instruction *instruction)
{
@ -6482,6 +6491,7 @@ static const struct vsir_validator_instruction_desc vsir_validator_instructions[
[VKD3DSIH_DCL_GS_INSTANCES] = {0, 0, vsir_validate_dcl_gs_instances},
[VKD3DSIH_DCL_HS_MAX_TESSFACTOR] = {0, 0, vsir_validate_dcl_hs_max_tessfactor},
[VKD3DSIH_DCL_INPUT_PRIMITIVE] = {0, 0, vsir_validate_dcl_input_primitive},
[VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT] = {0, 0, vsir_validate_dcl_output_control_point_count},
[VKD3DSIH_DCL_OUTPUT_TOPOLOGY] = {0, 0, vsir_validate_dcl_output_topology},
[VKD3DSIH_DCL_TEMPS] = {0, 0, vsir_validate_dcl_temps},
[VKD3DSIH_DCL_VERTICES_OUT] = {0, 0, vsir_validate_dcl_vertices_out},
@ -6542,12 +6552,6 @@ static void vsir_validate_instruction(struct validation_context *ctx)
ctx->dcl_temps_found = false;
return;
case VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT:
if (!instruction->declaration.count || instruction->declaration.count > 32)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION, "Output control point count %u is invalid.",
instruction->declaration.count);
return;
case VKD3DSIH_DCL_TESSELLATOR_DOMAIN:
if (instruction->declaration.tessellator_domain == VKD3D_TESSELLATOR_DOMAIN_INVALID
|| instruction->declaration.tessellator_domain >= VKD3D_TESSELLATOR_DOMAIN_COUNT)