mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Add a debug buffer to struct vsir_cfg.
This commit is contained in:
parent
c5893288d9
commit
c3657c4799
Notes:
Alexandre Julliard
2024-03-07 23:22:05 +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/662
@ -3102,6 +3102,7 @@ struct vsir_cfg
|
|||||||
struct vsir_block *blocks;
|
struct vsir_block *blocks;
|
||||||
struct vsir_block *entry;
|
struct vsir_block *entry;
|
||||||
size_t block_count;
|
size_t block_count;
|
||||||
|
struct vkd3d_string_buffer debug_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void vsir_cfg_cleanup(struct vsir_cfg *cfg)
|
static void vsir_cfg_cleanup(struct vsir_cfg *cfg)
|
||||||
@ -3112,6 +3113,9 @@ static void vsir_cfg_cleanup(struct vsir_cfg *cfg)
|
|||||||
vsir_block_cleanup(&cfg->blocks[i]);
|
vsir_block_cleanup(&cfg->blocks[i]);
|
||||||
|
|
||||||
vkd3d_free(cfg->blocks);
|
vkd3d_free(cfg->blocks);
|
||||||
|
|
||||||
|
if (TRACE_ON())
|
||||||
|
vkd3d_string_buffer_cleanup(&cfg->debug_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum vkd3d_result vsir_cfg_add_edge(struct vsir_cfg *cfg, struct vsir_block *block,
|
static enum vkd3d_result vsir_cfg_add_edge(struct vsir_cfg *cfg, struct vsir_block *block,
|
||||||
@ -3182,6 +3186,9 @@ static enum vkd3d_result vsir_cfg_init(struct vsir_cfg *cfg, struct vsir_program
|
|||||||
if (!(cfg->blocks = vkd3d_calloc(cfg->block_count, sizeof(*cfg->blocks))))
|
if (!(cfg->blocks = vkd3d_calloc(cfg->block_count, sizeof(*cfg->blocks))))
|
||||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
if (TRACE_ON())
|
||||||
|
vkd3d_string_buffer_init(&cfg->debug_buffer);
|
||||||
|
|
||||||
for (i = 0; i < program->instructions.count; ++i)
|
for (i = 0; i < program->instructions.count; ++i)
|
||||||
{
|
{
|
||||||
struct vkd3d_shader_instruction *instruction = &program->instructions.elements[i];
|
struct vkd3d_shader_instruction *instruction = &program->instructions.elements[i];
|
||||||
@ -3292,12 +3299,8 @@ 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)
|
||||||
{
|
{
|
||||||
struct vkd3d_string_buffer buf;
|
|
||||||
size_t i, j;
|
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)
|
||||||
{
|
{
|
||||||
struct vsir_block *block = &cfg->blocks[i];
|
struct vsir_block *block = &cfg->blocks[i];
|
||||||
@ -3309,7 +3312,7 @@ static void vsir_cfg_compute_dominators(struct vsir_cfg *cfg)
|
|||||||
|
|
||||||
if (TRACE_ON())
|
if (TRACE_ON())
|
||||||
{
|
{
|
||||||
vkd3d_string_buffer_printf(&buf, "Block %u dominates:", block->label);
|
vkd3d_string_buffer_printf(&cfg->debug_buffer, "Block %u dominates:", block->label);
|
||||||
for (j = 0; j < cfg->block_count; j++)
|
for (j = 0; j < cfg->block_count; j++)
|
||||||
{
|
{
|
||||||
struct vsir_block *block2 = &cfg->blocks[j];
|
struct vsir_block *block2 = &cfg->blocks[j];
|
||||||
@ -3318,15 +3321,12 @@ static void vsir_cfg_compute_dominators(struct vsir_cfg *cfg)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (bitmap_is_set(block->dominates, j))
|
if (bitmap_is_set(block->dominates, j))
|
||||||
vkd3d_string_buffer_printf(&buf, " %u", block2->label);
|
vkd3d_string_buffer_printf(&cfg->debug_buffer, " %u", block2->label);
|
||||||
}
|
}
|
||||||
TRACE("%s\n", buf.buffer);
|
TRACE("%s\n", cfg->debug_buffer.buffer);
|
||||||
vkd3d_string_buffer_clear(&buf);
|
vkd3d_string_buffer_clear(&cfg->debug_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user