From 859b911b3a988449068c71a2373a9f425b64cd73 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 11 Oct 2024 11:23:09 +0200 Subject: [PATCH] vkd3d-shader/ir: Validate the output control point count. --- libs/vkd3d-shader/ir.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 6c2ed239..d0db2a71 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -7518,6 +7518,21 @@ enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t c program->input_control_point_count); } + switch (program->shader_version.type) + { + case VKD3D_SHADER_TYPE_HULL: + if (program->output_control_point_count == 0) + validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, + "Invalid zero output control point count."); + break; + + default: + if (program->output_control_point_count != 0) + validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, + "Invalid output control point count %u.", + program->output_control_point_count); + } + vsir_validate_signature(&ctx, &program->input_signature, SIGNATURE_TYPE_INPUT); vsir_validate_signature(&ctx, &program->output_signature, SIGNATURE_TYPE_OUTPUT); vsir_validate_signature(&ctx, &program->patch_constant_signature, SIGNATURE_TYPE_PATCH_CONSTANT);