mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Sort each loop by block label.
This commit is contained in:
parent
3d4092d9dc
commit
8723b5d266
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
@ -3096,6 +3096,19 @@ static void vsir_block_cleanup(struct vsir_block *block)
|
||||
vkd3d_free(block->dominates);
|
||||
}
|
||||
|
||||
static int block_compare(const void *ptr1, const void *ptr2)
|
||||
{
|
||||
const struct vsir_block *block1 = *(const struct vsir_block **)ptr1;
|
||||
const struct vsir_block *block2 = *(const struct vsir_block **)ptr2;
|
||||
|
||||
return vkd3d_u32_compare(block1->label, block2->label);
|
||||
}
|
||||
|
||||
static void vsir_block_list_sort(struct vsir_block_list *list)
|
||||
{
|
||||
qsort(list->blocks, list->count, sizeof(*list->blocks), block_compare);
|
||||
}
|
||||
|
||||
struct vsir_cfg
|
||||
{
|
||||
struct vkd3d_shader_message_context *message_context;
|
||||
@ -3423,6 +3436,8 @@ static enum vkd3d_result vsir_cfg_compute_loops(struct vsir_cfg *cfg)
|
||||
if ((ret = vsir_cfg_scan_loop(loop, block, header)) < 0)
|
||||
return ret;
|
||||
|
||||
vsir_block_list_sort(loop);
|
||||
|
||||
if (TRACE_ON())
|
||||
{
|
||||
vkd3d_string_buffer_printf(&cfg->debug_buffer, "Back edge %u -> %u with loop:", block->label, header->label);
|
||||
|
Loading…
x
Reference in New Issue
Block a user