mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Keep track of loops by header block.
This commit is contained in:
parent
088a6c49a2
commit
8241ca2b67
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
@ -3107,6 +3107,7 @@ struct vsir_cfg
|
||||
|
||||
struct vsir_block_list *loops;
|
||||
size_t loops_count, loops_capacity;
|
||||
size_t *loops_by_header;
|
||||
};
|
||||
|
||||
static void vsir_cfg_cleanup(struct vsir_cfg *cfg)
|
||||
@ -3121,6 +3122,7 @@ static void vsir_cfg_cleanup(struct vsir_cfg *cfg)
|
||||
|
||||
vkd3d_free(cfg->blocks);
|
||||
vkd3d_free(cfg->loops);
|
||||
vkd3d_free(cfg->loops_by_header);
|
||||
|
||||
if (TRACE_ON())
|
||||
vkd3d_string_buffer_cleanup(&cfg->debug_buffer);
|
||||
@ -3391,6 +3393,10 @@ static enum vkd3d_result vsir_cfg_compute_loops(struct vsir_cfg *cfg)
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
if (!(cfg->loops_by_header = vkd3d_calloc(cfg->block_count, sizeof(*cfg->loops_by_header))))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
memset(cfg->loops_by_header, 0xff, cfg->block_count * sizeof(*cfg->loops_by_header));
|
||||
|
||||
for (i = 0; i < cfg->block_count; ++i)
|
||||
{
|
||||
struct vsir_block *block = &cfg->blocks[i];
|
||||
@ -3411,11 +3417,23 @@ static enum vkd3d_result vsir_cfg_compute_loops(struct vsir_cfg *cfg)
|
||||
if (!vkd3d_array_reserve((void **)&cfg->loops, &cfg->loops_capacity, cfg->loops_count + 1, sizeof(*cfg->loops)))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
loop = &cfg->loops[cfg->loops_count++];
|
||||
loop = &cfg->loops[cfg->loops_count];
|
||||
vsir_block_list_init(loop);
|
||||
|
||||
if ((ret = vsir_cfg_scan_loop(loop, block, header)) < 0)
|
||||
return ret;
|
||||
|
||||
if (cfg->loops_by_header[header->label - 1] != SIZE_MAX)
|
||||
{
|
||||
FIXME("Block %u is header to more than one loop, this is not implemented.\n", header->label);
|
||||
vkd3d_shader_error(cfg->message_context, &header->begin->location, VKD3D_SHADER_ERROR_VSIR_NOT_IMPLEMENTED,
|
||||
"Block %u is header to more than one loop, this is not implemented.", header->label);
|
||||
return VKD3D_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
cfg->loops_by_header[header->label - 1] = cfg->loops_count;
|
||||
|
||||
++cfg->loops_count;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user