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

Mostly to avoid passing around void pointers.

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:08 +02:00 committed by Alexandre Julliard
parent a8b062000e
commit a129206e7e
3 changed files with 12 additions and 12 deletions

View File

@ -1900,12 +1900,12 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
return result; return result;
} }
void vkd3d_shader_trace(void *data) 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(data, NULL, &code) != VKD3D_OK) if (vkd3d_dxbc_binary_to_text(parser->data, NULL, &code) != VKD3D_OK)
return; return;
end = (const char *)code.code + code.size; end = (const char *)code.code + code.size;

View File

@ -367,14 +367,6 @@ void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type,
shader_get_source_type_suffix(source_type), shader->code, shader->size); shader_get_source_type_suffix(source_type), shader->code, shader->size);
} }
struct vkd3d_shader_parser
{
struct vkd3d_shader_desc shader_desc;
struct vkd3d_shader_version shader_version;
void *data;
const DWORD *ptr;
};
static int vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, static int vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser,
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context) const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context)
{ {
@ -960,7 +952,7 @@ static int scan_dxbc(const struct vkd3d_shader_compile_info *compile_info,
} }
if (TRACE_ON()) if (TRACE_ON())
vkd3d_shader_trace(parser.data); vkd3d_shader_trace(&parser);
while (!shader_sm4_is_end(parser.data, &parser.ptr)) while (!shader_sm4_is_end(parser.data, &parser.ptr))
{ {

View File

@ -874,7 +874,15 @@ static inline bool vkd3d_shader_register_is_output(const struct vkd3d_shader_reg
return reg->type == VKD3DSPR_OUTPUT || reg->type == VKD3DSPR_COLOROUT; return reg->type == VKD3DSPR_OUTPUT || reg->type == VKD3DSPR_COLOROUT;
} }
void vkd3d_shader_trace(void *data); struct vkd3d_shader_parser
{
struct vkd3d_shader_desc shader_desc;
struct vkd3d_shader_version shader_version;
void *data;
const uint32_t *ptr;
};
void vkd3d_shader_trace(struct vkd3d_shader_parser *parser);
const char *shader_get_type_prefix(enum vkd3d_shader_type type); const char *shader_get_type_prefix(enum vkd3d_shader_type type);