vkd3d-shader: Ignore break instructions if there is no active block.

This can happen if a continue statement is immediately followed
by a break instruction in a switch case.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2021-03-04 12:44:00 +01:00 committed by Hans-Kristian Arntzen
parent 96888b0663
commit ba8e306452
1 changed files with 4 additions and 2 deletions

View File

@ -8094,8 +8094,10 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
}
else if (breakable_cf_info->current_block == VKD3D_BLOCK_SWITCH)
{
assert(breakable_cf_info->inside_block);
vkd3d_spirv_build_op_branch(builder, breakable_cf_info->switch_.merge_block_id);
/* It is possible that we already broke out of the
* current case block with a continue statement */
if (breakable_cf_info->inside_block)
vkd3d_spirv_build_op_branch(builder, breakable_cf_info->switch_.merge_block_id);
}
cf_info->inside_block = false;