diff --git a/src/webgpu/listing_meta.json b/src/webgpu/listing_meta.json index 5014ca450eb2..51178e1fe54c 100644 --- a/src/webgpu/listing_meta.json +++ b/src/webgpu/listing_meta.json @@ -1669,6 +1669,7 @@ "webgpu:shader,execution,flow_control,switch:switch_default_only:*": { "subcaseMS": 12.550 }, "webgpu:shader,execution,flow_control,switch:switch_multiple_case:*": { "subcaseMS": 5.550 }, "webgpu:shader,execution,flow_control,switch:switch_multiple_case_default:*": { "subcaseMS": 12.000 }, + "webgpu:shader,execution,flow_control,switch:switch_inside_loop_with_continue:*": { "subcaseMS": 0 }, "webgpu:shader,execution,flow_control,while:while_basic:*": { "subcaseMS": 5.951 }, "webgpu:shader,execution,flow_control,while:while_break:*": { "subcaseMS": 12.450 }, "webgpu:shader,execution,flow_control,while:while_continue:*": { "subcaseMS": 5.650 }, diff --git a/src/webgpu/shader/execution/flow_control/switch.spec.ts b/src/webgpu/shader/execution/flow_control/switch.spec.ts index e50072961426..772cd6a875db 100644 --- a/src/webgpu/shader/execution/flow_control/switch.spec.ts +++ b/src/webgpu/shader/execution/flow_control/switch.spec.ts @@ -154,3 +154,36 @@ ${f.expect_order(2)} ` ); }); + +g.test('switch_inside_loop_with_continue') + .desc('Test that flow control executes correct for a switch calling continue inside a loop') + .params(u => u.combine('preventValueOptimizations', [true, false])) + .fn(t => { + runFlowControlTest( + t, + f => ` +${f.expect_order(0)} +var i = ${f.value(0)}; +loop { + switch (i) { + case 1: { + ${f.expect_order(4)} + continue; + } + default: { + ${f.expect_order(1)} + break; + } + } + ${f.expect_order(2)} + + continuing { + ${f.expect_order(3, 5)} + i++; + break if i >= 2; + } +} +${f.expect_order(6)} +` + ); + });