vkd3d-shader/ir: Dump the domination relationship.

This commit is contained in:
Giovanni Mascellani 2024-01-30 15:07:50 +01:00 committed by Alexandre Julliard
parent 04c2852c1a
commit 9c678532a7
Notes: Alexandre Julliard 2024-02-22 23:03:31 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/656
3 changed files with 27 additions and 2 deletions

View File

@ -3285,7 +3285,11 @@ static void vsir_cfg_compute_dominators_recurse(struct vsir_block *current, stru
static void vsir_cfg_compute_dominators(struct vsir_cfg *cfg) static void vsir_cfg_compute_dominators(struct vsir_cfg *cfg)
{ {
size_t i; struct vkd3d_string_buffer buf;
size_t i, j;
if (TRACE_ON())
vkd3d_string_buffer_init(&buf);
for (i = 0; i < cfg->block_count; ++i) for (i = 0; i < cfg->block_count; ++i)
{ {
@ -3295,7 +3299,27 @@ static void vsir_cfg_compute_dominators(struct vsir_cfg *cfg)
continue; continue;
vsir_cfg_compute_dominators_recurse(cfg->entry, block); vsir_cfg_compute_dominators_recurse(cfg->entry, block);
if (TRACE_ON())
{
vkd3d_string_buffer_printf(&buf, "Block %u dominates:", block->label);
for (j = 0; j < cfg->block_count; j++)
{
struct vsir_block *block2 = &cfg->blocks[j];
if (block2->label == 0)
continue;
if (bitmap_is_set(block->dominates, j))
vkd3d_string_buffer_printf(&buf, " %u", block2->label);
}
TRACE("%s\n", buf.buffer);
vkd3d_string_buffer_clear(&buf);
}
} }
if (TRACE_ON())
vkd3d_string_buffer_cleanup(&buf);
} }
enum vkd3d_result vkd3d_shader_normalise(struct vkd3d_shader_parser *parser, enum vkd3d_result vkd3d_shader_normalise(struct vkd3d_shader_parser *parser,

View File

@ -71,7 +71,7 @@ void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer)
vkd3d_free(buffer->buffer); vkd3d_free(buffer->buffer);
} }
static void vkd3d_string_buffer_clear(struct vkd3d_string_buffer *buffer) void vkd3d_string_buffer_clear(struct vkd3d_string_buffer *buffer)
{ {
buffer->buffer[0] = '\0'; buffer->buffer[0] = '\0';
buffer->content_size = 0; buffer->content_size = 0;

View File

@ -1399,6 +1399,7 @@ struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_c
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer); void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer);
void vkd3d_string_buffer_cache_cleanup(struct vkd3d_string_buffer_cache *list); void vkd3d_string_buffer_cache_cleanup(struct vkd3d_string_buffer_cache *list);
void vkd3d_string_buffer_cache_init(struct vkd3d_string_buffer_cache *list); void vkd3d_string_buffer_cache_init(struct vkd3d_string_buffer_cache *list);
void vkd3d_string_buffer_clear(struct vkd3d_string_buffer *buffer);
int vkd3d_string_buffer_print_f32(struct vkd3d_string_buffer *buffer, float f); int vkd3d_string_buffer_print_f32(struct vkd3d_string_buffer *buffer, float f);
int vkd3d_string_buffer_print_f64(struct vkd3d_string_buffer *buffer, double d); int vkd3d_string_buffer_print_f64(struct vkd3d_string_buffer *buffer, double d);
int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *format, ...) VKD3D_PRINTF_FUNC(2, 3); int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *format, ...) VKD3D_PRINTF_FUNC(2, 3);