From 1f4d17a4a2e265773f71c6b4361b8bcfc3750934 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Tue, 22 Oct 2024 22:18:57 -0400 Subject: [PATCH] vkd3d-shader/dxil: Allow zero domain input control point count. --- libs/vkd3d-shader/dxil.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 7099bcc9..1cf01616 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -9719,10 +9719,10 @@ static void sm6_parser_emit_dcl_tessellator_domain(struct sm6_parser *sm6, ins->declaration.tessellator_domain = tessellator_domain; } -static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6, unsigned int count, - const char *type) +static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6, + unsigned int count, bool allow_zero, const char *type) { - if (!count || count > 32) + if ((!count && !allow_zero) || count > 32) { WARN("%s control point count %u invalid.\n", type, count); vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_PROPERTIES, @@ -9951,7 +9951,7 @@ static enum vkd3d_tessellator_domain sm6_parser_ds_properties_init(struct sm6_pa } sm6_parser_emit_dcl_tessellator_domain(sm6, operands[0]); - sm6_parser_validate_control_point_count(sm6, operands[1], "Domain shader input"); + sm6_parser_validate_control_point_count(sm6, operands[1], true, "Domain shader input"); sm6->p.program->input_control_point_count = operands[1]; return operands[0]; @@ -10010,9 +10010,9 @@ static enum vkd3d_tessellator_domain sm6_parser_hs_properties_init(struct sm6_pa } } - sm6_parser_validate_control_point_count(sm6, operands[1], "Hull shader input"); + sm6_parser_validate_control_point_count(sm6, operands[1], false, "Hull shader input"); program->input_control_point_count = operands[1]; - sm6_parser_validate_control_point_count(sm6, operands[2], "Hull shader output"); + sm6_parser_validate_control_point_count(sm6, operands[2], false, "Hull shader output"); sm6_parser_emit_dcl_count(sm6, VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT, operands[2]); program->output_control_point_count = operands[2]; sm6_parser_emit_dcl_tessellator_domain(sm6, operands[3]);