[webkit-changes] [WebKit/WebKit] 8f8094: [WGSL] Generate the correct code for arrayLength

Tadeu Zagallo noreply at github.com
Fri Oct 6 09:43:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8f8094467d6c459615e10bbd06efa26ed9755c93
      https://github.com/WebKit/WebKit/commit/8f8094467d6c459615e10bbd06efa26ed9755c93
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-10-06 (Fri, 06 Oct 2023)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTVariable.h
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    A Source/WebGPU/WGSL/tests/valid/array-length.wgsl

  Log Message:
  -----------
  [WGSL] Generate the correct code for arrayLength
https://bugs.webkit.org/show_bug.cgi?id=262703
rdar://116524838

Reviewed by Mike Wyrzykowski.

As of 268884 at main, the API now exposes the size of runtime-sized arrays at the
end of the argument buffer. This patch updates the compiler to match this argument
buffer layout and rewrite calls to arrayLength to read these sizes.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::getPacking):
(WGSL::RewriteGlobalVariables::collectGlobals):
(WGSL::RewriteGlobalVariables::containsRuntimeArray):
(WGSL::RewriteGlobalVariables::packArrayType):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::emitArrayLength):
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/tests/valid/array-length.wgsl: Added.

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




More information about the webkit-changes mailing list