Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 22543ab3dd20ac898a8a0c95d716c3799f7a36b4
      
https://github.com/WebKit/WebKit/commit/22543ab3dd20ac898a8a0c95d716c3799f7a36b4
  Author: Tadeu Zagallo <[email protected]>
  Date:   2024-06-19 (Wed, 19 Jun 2024)

  Changed paths:
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/flow_control/switch-expected.txt
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebGPU/WGSL/AST/ASTContinueStatement.h
    M Source/WebGPU/WGSL/AST/ASTLoopStatement.h
    M Source/WebGPU/WGSL/AST/ASTSwitchStatement.h
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    A Source/WebGPU/WGSL/tests/invalid/continue.wgsl

  Log Message:
  -----------
  [WGSL] 
shader,execution,flow_control,switch:switch_inside_loop_with_continue:* is 
failing
https://bugs.webkit.org/show_bug.cgi?id=275636
rdar://130111144

Reviewed by Mike Wyrzykowski.

In WGSL, the `loop` statement can have a `continuing` block which gets evaluated
whenever there is a `continue` statement in the loop body. This is implemented 
by
copying the contents of the `continuing` block before each `continue` statement.
However, there's a small issue: the `continuing` block may contain a `break-if`,
and there might be a `continue` statement within a `switch`. Currently, we don't
handle this case, so we generate the `break` statement inside the `switch`, 
which
means that the `break` targets the `switch` instead of the `loop`.

To fix this issue we need to detect when there's a `switch` statement within a
`loop` statement that contains a `continuing` block. Then, the code for the 
`continuing`
cannot be copied into the `switch`, so we generate the code after the switch and
use a local variable to track whether it should run. We also need to detect 
whether
the `switch` is nested multiple levels deep, since that requires emitting 
different
code to go the enclosing `switch`, instead of emitting the `continuing` block.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/flow_control/switch-expected.txt:
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WGSL/AST/ASTContinueStatement.h:
* Source/WebGPU/WGSL/AST/ASTLoopStatement.h:
* Source/WebGPU/WGSL/AST/ASTSwitchStatement.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::analyze):
* Source/WebGPU/WGSL/tests/invalid/continue.wgsl: Added.

Canonical link: https://commits.webkit.org/280178@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to