[webkit-changes] [WebKit/WebKit] 5c3faf: [WGSL] Sort globals by binding

Tadeu Zagallo noreply at github.com
Wed Oct 4 01:37:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5c3faf8a43239e12db67045ff3b0f8872aa4de7c
      https://github.com/WebKit/WebKit/commit/5c3faf8a43239e12db67045ff3b0f8872aa4de7c
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

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

  Log Message:
  -----------
  [WGSL] Sort globals by binding
https://bugs.webkit.org/show_bug.cgi?id=262547
rdar://116403111

Reviewed by Mike Wyrzykowski.

For now, we directly translate `@binding(x)` into `[[id(x)]]` for global variables,
but based on order of usage and declaration, we can end up with the variables out
of order in the argument buffer struct. In order to temporarily fix that, we simply
sort the globals by their binding value.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::insertStructs):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/valid/global-ordering.wgsl: Added.

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




More information about the webkit-changes mailing list