vkd3d-shader: Ignore the patch constant signature when it doesn't make sense.

This commit is contained in:
Giovanni Mascellani 2024-10-09 11:36:06 +02:00 committed by Henri Verbeet
parent cd74461d6d
commit 16efb7c0c6
Notes: Henri Verbeet 2024-10-09 13:19:13 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1159
3 changed files with 32 additions and 0 deletions

View File

@ -10315,6 +10315,21 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, struct vsir_pro
sm6->ptr = &sm6->start[1];
sm6->bitpos = 2;
switch (program->shader_version.type)
{
case VKD3D_SHADER_TYPE_HULL:
case VKD3D_SHADER_TYPE_DOMAIN:
break;
default:
if (program->patch_constant_signature.element_count != 0)
{
WARN("The patch constant signature only makes sense for Hull and Domain Shaders, ignoring it.\n");
shader_signature_cleanup(&program->patch_constant_signature);
}
break;
}
input_signature = &program->input_signature;
output_signature = &program->output_signature;
patch_constant_signature = &program->patch_constant_signature;

View File

@ -2914,6 +2914,21 @@ int tpf_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t con
if (program->shader_version.type == VKD3D_SHADER_TYPE_HULL)
uninvert_used_masks(&program->patch_constant_signature);
switch (program->shader_version.type)
{
case VKD3D_SHADER_TYPE_HULL:
case VKD3D_SHADER_TYPE_DOMAIN:
break;
default:
if (program->patch_constant_signature.element_count != 0)
{
WARN("The patch constant signature only makes sense for Hull and Domain Shaders, ignoring it.\n");
shader_signature_cleanup(&program->patch_constant_signature);
}
break;
}
if (!shader_sm4_parser_validate_signature(&sm4, &program->input_signature,
sm4.input_register_masks, "Input")
|| !shader_sm4_parser_validate_signature(&sm4, &program->output_signature,

View File

@ -1846,6 +1846,8 @@ void shader_signature_cleanup(struct shader_signature *signature)
}
vkd3d_free(signature->elements);
signature->elements = NULL;
signature->elements_capacity = 0;
signature->element_count = 0;
}
int vkd3d_shader_parse_input_signature(const struct vkd3d_shader_code *dxbc,