Bug 264208

Summary: [WGSL] Generated switch statements are missing 'break' after each case
Product: WebKit Reporter: Mike Wyrzykowski <mwyrzykowski>
Component: WebGPUAssignee: Tadeu Zagallo <tzagallo>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   

Description Mike Wyrzykowski 2023-11-04 11:29:39 PDT
[WGSL] Generated switch statements are missing 'break' after each case

Inspect our metal output of https://webgpu.github.io/webgpu-samples/samples/bitonicSort#./bitonicCompute.frag.wgsl

The switch statement should have a break after each case, but it does not.

Generated metal:
....
    switch (global3.field2) {
    case 1:{
        vec<unsigned, 2> local8 = function1(parameter9.x, global3.field3);
        function0(local8.x, local8.y, global0, global4);
    }    case 2:{
        vec<unsigned, 2> local9 = function2(parameter9.x, global3.field3);
        function0(local9.x, local9.y, global0, global4);
    }    case 3:{
        vec<unsigned, 2> local10 = function1(parameter8.x, global3.field3);
        function3(local10.x, local10.y, global1, global2);
    }    case 4:{
        vec<unsigned, 2> local11 = function2(parameter8.x, global3.field3);
        function3(local11.x, local11.y, global1, global2);
    }    default:{
    }
...

each 'case' statement should have a break at the end of it
Comment 1 Radar WebKit Bug Importer 2023-11-04 11:29:55 PDT
<rdar://problem/117947313>
Comment 2 Tadeu Zagallo 2023-11-07 07:03:53 PST
Pull request: https://github.com/WebKit/WebKit/pull/20099
Comment 3 EWS 2023-11-07 09:06:31 PST
Committed 270327@main (a431b35bc795): <https://commits.webkit.org/270327@main>

Reviewed commits have been landed. Closing PR #20099 and removing active labels.