vkd3d-shader/dxil: Allow zero domain input control point count.

This commit is contained in:
Shaun Ren 2024-10-22 22:18:57 -04:00 committed by Henri Verbeet
parent 3669763835
commit 1f4d17a4a2
Notes: Henri Verbeet 2024-11-21 19:34:41 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1217

View File

@ -9719,10 +9719,10 @@ static void sm6_parser_emit_dcl_tessellator_domain(struct sm6_parser *sm6,
ins->declaration.tessellator_domain = tessellator_domain; ins->declaration.tessellator_domain = tessellator_domain;
} }
static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6, unsigned int count, static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6,
const char *type) 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); WARN("%s control point count %u invalid.\n", type, count);
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_PROPERTIES, 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_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]; sm6->p.program->input_control_point_count = operands[1];
return operands[0]; 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]; 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]); sm6_parser_emit_dcl_count(sm6, VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT, operands[2]);
program->output_control_point_count = operands[2]; program->output_control_point_count = operands[2];
sm6_parser_emit_dcl_tessellator_domain(sm6, operands[3]); sm6_parser_emit_dcl_tessellator_domain(sm6, operands[3]);