From bd3ba87747fea8de7135c70650333ef9b2cf9e4f Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 11 Oct 2024 11:15:29 +0200 Subject: [PATCH] vkd3d-shader/ir: Validate the input control point count. --- libs/vkd3d-shader/ir.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 0bcc3d0a..6c2ed239 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -7501,6 +7501,23 @@ enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t c "Patch constant signature is only valid for hull and domain shaders."); } + switch (program->shader_version.type) + { + case VKD3D_SHADER_TYPE_HULL: + case VKD3D_SHADER_TYPE_DOMAIN: + case VKD3D_SHADER_TYPE_GEOMETRY: + if (program->input_control_point_count == 0) + validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, + "Invalid zero input control point count."); + break; + + default: + if (program->input_control_point_count != 0) + validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, + "Invalid input control point count %u.", + program->input_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);