vkd3d-shader: Pass a vkd3d_shader_parser structure to vkd3d_dxbc_binary_to_text().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2021-09-01 15:45:09 +02:00 committed by Alexandre Julliard
parent a129206e7e
commit 1c8b0d1062
3 changed files with 7 additions and 7 deletions

View File

@ -1771,7 +1771,7 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
shader_addline(buffer, "\n"); shader_addline(buffer, "\n");
} }
enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data, enum vkd3d_result vkd3d_dxbc_binary_to_text(struct vkd3d_shader_parser *parser,
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out) const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out)
{ {
enum vkd3d_shader_compile_option_formatting_flags formatting; enum vkd3d_shader_compile_option_formatting_flags formatting;
@ -1831,17 +1831,17 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
vkd3d_string_buffer_init(buffer); vkd3d_string_buffer_init(buffer);
shader_version = &compiler.shader_version; shader_version = &compiler.shader_version;
shader_sm4_read_header(data, &ptr, shader_version); shader_sm4_read_header(parser->data, &ptr, shader_version);
vkd3d_string_buffer_printf(buffer, "%s%s_%u_%u%s\n", compiler.colours.version, vkd3d_string_buffer_printf(buffer, "%s%s_%u_%u%s\n", compiler.colours.version,
shader_get_type_prefix(shader_version->type), shader_version->major, shader_get_type_prefix(shader_version->type), shader_version->major,
shader_version->minor, compiler.colours.reset); shader_version->minor, compiler.colours.reset);
indent = 0; indent = 0;
while (!shader_sm4_is_end(data, &ptr)) while (!shader_sm4_is_end(parser->data, &ptr))
{ {
struct vkd3d_shader_instruction ins; struct vkd3d_shader_instruction ins;
shader_sm4_read_instruction(data, &ptr, &ins); shader_sm4_read_instruction(parser->data, &ptr, &ins);
if (ins.handler_idx == VKD3DSIH_INVALID) if (ins.handler_idx == VKD3DSIH_INVALID)
{ {
WARN("Skipping unrecognized instruction.\n"); WARN("Skipping unrecognized instruction.\n");
@ -1905,7 +1905,7 @@ void vkd3d_shader_trace(struct vkd3d_shader_parser *parser)
const char *p, *q, *end; const char *p, *q, *end;
struct vkd3d_shader_code code; struct vkd3d_shader_code code;
if (vkd3d_dxbc_binary_to_text(parser->data, NULL, &code) != VKD3D_OK) if (vkd3d_dxbc_binary_to_text(parser, NULL, &code) != VKD3D_OK)
return; return;
end = (const char *)code.code + code.size; end = (const char *)code.code + code.size;

View File

@ -1051,7 +1051,7 @@ static int compile_dxbc_tpf(const struct vkd3d_shader_compile_info *compile_info
if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_ASM) if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_ASM)
{ {
vkd3d_shader_free_scan_descriptor_info(&scan_descriptor_info); vkd3d_shader_free_scan_descriptor_info(&scan_descriptor_info);
ret = vkd3d_dxbc_binary_to_text(parser.data, compile_info, out); ret = vkd3d_dxbc_binary_to_text(&parser, compile_info, out);
vkd3d_shader_parser_destroy(&parser); vkd3d_shader_parser_destroy(&parser);
return ret; return ret;
} }

View File

@ -910,7 +910,7 @@ struct vkd3d_string_buffer_cache
size_t count, max_count, capacity; size_t count, max_count, capacity;
}; };
enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data, enum vkd3d_result vkd3d_dxbc_binary_to_text(struct vkd3d_shader_parser *parser,
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out); const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out);
void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer); void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer);
struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *list); struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *list);