vkd3d-shader/tpf: Destroy the SM4 parser on parsing errors.

This commit is contained in:
Giovanni Mascellani 2023-09-07 11:30:22 +02:00 committed by Alexandre Julliard
parent a2fb9588c7
commit 78220ed07e
Notes: Alexandre Julliard 2023-09-22 22:46:19 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/317

View File

@ -2642,9 +2642,16 @@ int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compi
if (sm4->p.shader_version.type == VKD3D_SHADER_TYPE_HULL && !sm4->has_control_point_phase && !sm4->p.failed)
shader_sm4_validate_default_phase_index_ranges(sm4);
if (sm4->p.failed)
{
WARN("Failed to parse shader.\n");
shader_sm4_destroy(&sm4->p);
return VKD3D_ERROR_INVALID_SHADER;
}
*parser = &sm4->p;
return sm4->p.failed ? VKD3D_ERROR_INVALID_SHADER : VKD3D_OK;
return VKD3D_OK;
}
static void write_sm4_block(const struct tpf_writer *tpf, const struct hlsl_block *block);