Skip to content
Snippets Groups Projects
Commit d6ba8b88 authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard
Browse files

vkd3d-shader/ir: Swap selection branches if the if branch is empty.

parent 0515482e
No related branches found
No related tags found
1 merge request!785vkd3d-shader/ir: Only emit trampolines and launchers when needed.
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment