[webkit-changes] [WebKit/WebKit] 536fc7: [WGSL] Fix hardcoded buffer index calculation in M...

Tadeu Zagallo noreply at github.com
Mon Jan 30 02:06:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 536fc726cd22a49ccfdab8468c47e70e16aed264
      https://github.com/WebKit/WebKit/commit/536fc726cd22a49ccfdab8468c47e70e16aed264
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-01-30 (Mon, 30 Jan 2023)

  Changed paths:
    A Source/WebGPU/WGSL/API.h
    M Source/WebGPU/WGSL/AST/ASTShaderModule.h
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WGSL/Parser.h
    M Source/WebGPU/WGSL/ParserPrivate.h
    M Source/WebGPU/WGSL/WGSL.cpp
    M Source/WebGPU/WGSL/WGSL.h
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
    M Source/WebGPU/WebGPU/Device.mm
    M Source/WebGPU/WebGPU/ShaderModule.mm
    M Tools/TestWebKitAPI/Tests/WGSL/ASTStringDumperTests.cpp
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] Fix hardcoded buffer index calculation in MetalFunctionWriter
https://bugs.webkit.org/show_bug.cgi?id=251264
<rdar://problem/104742151>

Reviewed by Myles C. Maxfield.

Add a configuration object to be passed into the WGSL compiler, which for now
only contains the limit for `maxBuffersPlusVertexBuffersForVertexStage`. Also
moved the implementation of the function that calculates the buffer index for
a bind group using the limit into WGSL so it can be shared between the compiler
and the API. The plumbing to get it into the `AST::ShaderModule` is a bit
unfortunate for now, but will be addressed in a subsequent patch.

* Source/WebGPU/WGSL/API.h: Added.
(WGSL::vertexBufferIndexForBindGroup):
* Source/WebGPU/WGSL/AST/ASTShaderModule.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
(WGSL::Metal::FunctionDefinitionWriter::visit):
(WGSL::Metal::emitMetalFunctions):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::parse):
(WGSL::parseLChar):
(WGSL::parseUChar):
(WGSL::Parser<Lexer>::parseShader):
* Source/WebGPU/WGSL/Parser.h:
* Source/WebGPU/WGSL/ParserPrivate.h:
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::staticCheck):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/Device.mm:
(WebGPU::Device::vertexBufferIndexForBindGroup const):
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::Device::createShaderModule):

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




More information about the webkit-changes mailing list