mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Swap selection branches if the if branch is empty.
This commit is contained in:
parent
0515482e82
commit
d6ba8b88fa
Notes:
Alexandre Julliard
2024-04-16 23:25:43 +02: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/785
@ -4268,6 +4268,17 @@ static enum vkd3d_result vsir_cfg_move_breaks_out_of_selections(struct vsir_cfg
|
||||
--cfg->loop_intervals[else_target].target_count;
|
||||
}
|
||||
|
||||
/* If a branch becomes empty, make it the else branch, so we save a block. */
|
||||
if (selection->u.selection.if_body.count == 0)
|
||||
{
|
||||
struct vsir_cfg_structure_list tmp;
|
||||
|
||||
selection->u.selection.invert_condition = !selection->u.selection.invert_condition;
|
||||
tmp = selection->u.selection.if_body;
|
||||
selection->u.selection.if_body = selection->u.selection.else_body;
|
||||
selection->u.selection.else_body = tmp;
|
||||
}
|
||||
|
||||
return VKD3D_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user