[PATCH vkd3d 9/9] vkd3d-shader: Ignore break instructions if there is no active block.

Conor McCarthy cmccarthy at codeweavers.com
Tue Sep 28 00:38:18 CDT 2021


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

From: Philip Rebohle <philip.rebohle at tu-dortmund.de>
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
 libs/vkd3d-shader/spirv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 7d479184..849f5e86 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -7754,8 +7754,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->u.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->u.switch_.merge_block_id);
             }
 
             cf_info->inside_block = false;
-- 
2.32.0




More information about the wine-devel mailing list