[webkit-changes] [WebKit/WebKit] d83c11: [WGSL] GlobalVariableRewriter doesn't distinguish ...

Tadeu Zagallo noreply at github.com
Tue Sep 26 00:22:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d83c118fb83b8b9d192dc37a05462975854bf4cd
      https://github.com/WebKit/WebKit/commit/d83c118fb83b8b9d192dc37a05462975854bf4cd
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-09-26 (Tue, 26 Sep 2023)

  Changed paths:
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    A Source/WebGPU/WGSL/tests/valid/global-same-binding.wgsl

  Log Message:
  -----------
  [WGSL] GlobalVariableRewriter doesn't distinguish between multiple globals with the same binding
https://bugs.webkit.org/show_bug.cgi?id=262045
rdar://115994053

Reviewed by Dan Glastonbury.

When GlobalVariableRewriter determines which globals are used by each entrypoint, it
uses a pair of (group, binding) to determine which globals are used. However, it is
valid to have multiple globals with the same (group, binding) pair, so long as they are
not used by the same entrypoint. In those cases, we ended up marking all such variables
as used, which resulted in invalid code since we had multiple struct fields with the same
[[id]]. The fix is trivial, since we already keep track of the names of all the variables
used, all we need to do is add an extra check to see if the variable is used according
to its name.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::insertStructs):
* Source/WebGPU/WGSL/tests/valid/global-same-binding.wgsl: Added.

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




More information about the webkit-changes mailing list