From 5f2010351891357388698b325750e6d296a4a507 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 27 Sep 2024 14:13:31 +0200 Subject: [PATCH] vkd3d-shader/d3dbc: Trace the program when validation fails after parsing. --- libs/vkd3d-shader/d3dbc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 34752a1a..763d52e1 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1352,9 +1352,6 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c for (i = 0; i < ARRAY_SIZE(program->flat_constant_count); ++i) program->flat_constant_count[i] = get_external_constant_count(&sm1, i); - if (!sm1.p.failed) - ret = vkd3d_shader_parser_validate(&sm1.p, config_flags); - if (sm1.p.failed && ret >= 0) ret = VKD3D_ERROR_INVALID_SHADER; @@ -1365,7 +1362,18 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c return ret; } - return ret; + if ((ret = vkd3d_shader_parser_validate(&sm1.p, config_flags)) < 0) + { + WARN("Failed to validate shader after parsing, ret %d.\n", ret); + + if (TRACE_ON()) + vkd3d_shader_trace(program); + + vsir_program_cleanup(program); + return ret; + } + + return VKD3D_OK; } bool hlsl_sm1_register_from_semantic(const struct vkd3d_shader_version *version, const char *semantic_name,