mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/spirv: Omit the "endloop" branch to the loop start if the loop block was previously ended.
Avoiding generation of invalid SPIR-V. Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
581d71310f
commit
4e398459b1
@ -7661,6 +7661,7 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
|
||||
cf_info->u.loop.continue_block_id = continue_block_id;
|
||||
cf_info->u.loop.merge_block_id = merge_block_id;
|
||||
cf_info->current_block = VKD3D_BLOCK_LOOP;
|
||||
cf_info->inside_block = true;
|
||||
|
||||
vkd3d_spirv_build_op_name(builder, loop_header_block_id, "loop%u_header", compiler->loop_id);
|
||||
vkd3d_spirv_build_op_name(builder, loop_body_block_id, "loop%u_body", compiler->loop_id);
|
||||
@ -7673,7 +7674,10 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
|
||||
assert(compiler->control_flow_depth);
|
||||
assert(cf_info->current_block == VKD3D_BLOCK_LOOP);
|
||||
|
||||
vkd3d_spirv_build_op_branch(builder, cf_info->u.loop.continue_block_id);
|
||||
/* The loop block may have already been ended by an unconditional
|
||||
* break instruction right before the end of the loop. */
|
||||
if (cf_info->inside_block)
|
||||
vkd3d_spirv_build_op_branch(builder, cf_info->u.loop.continue_block_id);
|
||||
|
||||
vkd3d_spirv_build_op_label(builder, cf_info->u.loop.continue_block_id);
|
||||
vkd3d_spirv_build_op_branch(builder, cf_info->u.loop.header_block_id);
|
||||
|
@ -814,6 +814,7 @@ static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *conte
|
||||
case VKD3DSIH_LOOP:
|
||||
cf_info = vkd3d_shader_scan_push_cf_info(context);
|
||||
cf_info->type = VKD3D_SHADER_BLOCK_LOOP;
|
||||
cf_info->inside_block = true;
|
||||
break;
|
||||
case VKD3DSIH_ENDLOOP:
|
||||
if (!(cf_info = vkd3d_shader_scan_get_current_cf_info(context)) || cf_info->type != VKD3D_SHADER_BLOCK_LOOP)
|
||||
|
Loading…
x
Reference in New Issue
Block a user