vkd3d-shader: Expose the whole profile when dumping an HLSL shader.

The profile cannot be reliably devised by analyzing the HLSL code,
so it's useful to have it included in the file name.
This commit is contained in:
Giovanni Mascellani 2023-10-21 20:44:07 +02:00 committed by Alexandre Julliard
parent ecdc3f39d4
commit ab09c0b45b
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
3 changed files with 13 additions and 8 deletions

View File

@ -3633,7 +3633,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
return VKD3D_ERROR_NOT_IMPLEMENTED;
}
vkd3d_shader_dump_shader(compile_info->source_type, profile->type, &compile_info->source);
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)
{

View File

@ -391,7 +391,10 @@ static void vkd3d_shader_dump_blob(const char *path, const char *prefix,
id = InterlockedIncrement(&shader_id) - 1;
snprintf(filename, ARRAY_SIZE(filename), "%s/vkd3d-shader-%s-%u.%s", path, prefix, id, suffix);
if (prefix)
snprintf(filename, ARRAY_SIZE(filename), "%s/vkd3d-shader-%s-%u.%s", path, prefix, id, suffix);
else
snprintf(filename, ARRAY_SIZE(filename), "%s/vkd3d-shader-%u.%s", path, id, suffix);
if ((f = fopen(filename, "wb")))
{
if (fwrite(data, 1, size, f) != size)
@ -424,7 +427,7 @@ static const char *shader_get_source_type_suffix(enum vkd3d_shader_source_type t
}
void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type,
enum vkd3d_shader_type shader_type, const struct vkd3d_shader_code *shader)
const char *prefix, const struct vkd3d_shader_code *shader)
{
static bool enabled = true;
const char *path;
@ -438,8 +441,8 @@ void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type,
return;
}
vkd3d_shader_dump_blob(path, shader_get_type_prefix(shader_type),
shader_get_source_type_suffix(source_type), shader->code, shader->size);
vkd3d_shader_dump_blob(path, prefix, shader_get_source_type_suffix(source_type),
shader->code, shader->size);
}
static void init_scan_signature_info(const struct vkd3d_shader_compile_info *info)
@ -1348,7 +1351,8 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
struct vkd3d_shader_compile_info scan_info;
int ret;
vkd3d_shader_dump_shader(compile_info->source_type, parser->shader_version.type, &compile_info->source);
vkd3d_shader_dump_shader(compile_info->source_type, shader_get_type_prefix(parser->shader_version.type),
&compile_info->source);
scan_info = *compile_info;
@ -1433,7 +1437,8 @@ static int compile_d3d_bytecode(const struct vkd3d_shader_compile_info *compile_
return ret;
}
vkd3d_shader_dump_shader(compile_info->source_type, parser->shader_version.type, &compile_info->source);
vkd3d_shader_dump_shader(compile_info->source_type, shader_get_type_prefix(parser->shader_version.type),
&compile_info->source);
if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_ASM)
{

View File

@ -1325,7 +1325,7 @@ void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const s
enum vkd3d_shader_error error, const char *format, va_list args);
void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type,
enum vkd3d_shader_type shader_type, const struct vkd3d_shader_code *shader);
const char *prefix, const struct vkd3d_shader_code *shader);
void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function);
#define vkd3d_shader_trace_text(text, size) \
vkd3d_shader_trace_text_(text, size, __FUNCTION__)