vkd3d-shader/d3d-asm: Dump signatures when tracing a VSIR program.

This commit is contained in:
Giovanni Mascellani 2024-10-08 16:54:08 +02:00 committed by Henri Verbeet
parent c7d09bba97
commit c332adaa68
Notes: Henri Verbeet 2024-10-08 22:12:06 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1160

View File

@ -2499,12 +2499,57 @@ enum vkd3d_result d3d_asm_compile(const struct vsir_program *program,
return result;
}
/* This is meant exclusively for development use. Therefore, differently from
* dump_dxbc_signature(), it doesn't try particularly hard to make the output
* nice or easily parsable, and it dumps all fields, not just the DXBC ones.
* This format isn't meant to be stable. */
static void trace_signature(const struct shader_signature *signature, const char *signature_type)
{
struct vkd3d_string_buffer buffer;
unsigned int i;
TRACE("%s signature:%s\n", signature_type, signature->element_count == 0 ? " empty" : "");
vkd3d_string_buffer_init(&buffer);
for (i = 0; i < signature->element_count; ++i)
{
const struct signature_element *element = &signature->elements[i];
vkd3d_string_buffer_clear(&buffer);
vkd3d_string_buffer_printf(&buffer, "Element %u: %s %u-%u %s", i,
get_component_type_name(element->component_type),
element->register_index, element->register_index + element->register_count,
element->semantic_name);
if (element->semantic_index != -1)
vkd3d_string_buffer_printf(&buffer, "%u", element->semantic_index);
vkd3d_string_buffer_printf(&buffer,
" mask %#x used_mask %#x sysval %s min_precision %s interpolation %u stream %u",
element->mask, element->used_mask, get_sysval_semantic_name(element->sysval_semantic),
get_minimum_precision_name(element->min_precision), element->interpolation_mode,
element->stream_index);
if (element->target_location != -1)
vkd3d_string_buffer_printf(&buffer, " target %u", element->target_location);
else
vkd3d_string_buffer_printf(&buffer, " unused");
TRACE("%s\n", buffer.buffer);
}
vkd3d_string_buffer_cleanup(&buffer);
}
void vsir_program_trace(const struct vsir_program *program)
{
const unsigned int flags = VSIR_ASM_FLAG_DUMP_TYPES | VSIR_ASM_FLAG_DUMP_ALL_INDICES;
struct vkd3d_shader_code code;
const char *p, *q, *end;
trace_signature(&program->input_signature, "Input");
trace_signature(&program->output_signature, "Output");
trace_signature(&program->patch_constant_signature, "Patch-constant");
if (d3d_asm_compile(program, NULL, &code, flags) != VKD3D_OK)
return;