vkd3d-shader: Dump shaders as soon as possible.

So that they are dumped even if parsing fails, which is a circumstance
in which one likely wants to see the problematic shader.

The downside of that is that for shader types other than HLSL
the profile is not written any more in the filename. This should
not be a big problem, because in those cases the shader describes
its own type.

When dumping an HLSL shader, the id is brought in front of the profile
in the file name, in order to make it more tab-friendly: when dealing
with a directory full of shaders it's likely that the id determines
the profile, but the other way around.
This commit is contained in:
Giovanni Mascellani
2023-10-21 21:35:08 +02:00
committed by Alexandre Julliard
parent ab09c0b45b
commit dd96fe50e2
Notes: Alexandre Julliard 2023-11-02 22:49:26 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/424
4 changed files with 29 additions and 18 deletions

View File

@@ -3260,7 +3260,7 @@ unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsi
return ret;
}
static const struct hlsl_profile_info *get_target_info(const char *target)
const struct hlsl_profile_info *hlsl_get_target_info(const char *target)
{
unsigned int i;
@@ -3627,14 +3627,12 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
}
entry_point = hlsl_source_info->entry_point ? hlsl_source_info->entry_point : "main";
if (!(profile = get_target_info(hlsl_source_info->profile)))
if (!(profile = hlsl_get_target_info(hlsl_source_info->profile)))
{
FIXME("Unknown compilation target %s.\n", debugstr_a(hlsl_source_info->profile));
return VKD3D_ERROR_NOT_IMPLEMENTED;
}
vkd3d_shader_dump_shader(compile_info->source_type, profile->name, &compile_info->source);
if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_BYTECODE && profile->major_version > 3)
{
vkd3d_shader_error(message_context, NULL, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE,