[webkit-changes] [WebKit/WebKit] a9fce2: [WGSL] Add mechanism to validate override values

Tadeu Zagallo noreply at github.com
Wed Oct 2 11:34:07 PDT 2024


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

  Changed paths:
    M Source/WebGPU/WGSL/CompilationMessage.h
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/WGSL.cpp
    M Source/WebGPU/WGSL/WGSL.h
    A Source/WebGPU/WGSL/WGSLShaderModule.cpp
    M Source/WebGPU/WGSL/WGSLShaderModule.h
    A Source/WebGPU/WGSL/tests/invalid/override.wgsl
    M Source/WebGPU/WGSL/wgslc.cpp
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
    M Source/WebGPU/WebGPU/Pipeline.mm
    M Source/WebGPU/WebGPU/ShaderModule.mm
    M Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp

  Log Message:
  -----------
  [WGSL] Add mechanism to validate override values
https://bugs.webkit.org/show_bug.cgi?id=280676
rdar://136876110

Reviewed by Mike Wyrzykowski.

At compile time we validate constant values according to the spec,
as an example in this patch we cover that array sizes must be bigger
than 0. However, when the value can only be computed after overrides
have been provided, we need a way to validate the these values at a
later stage. This patch introduces the mechanism that will be used
for such validations, by storing the necessary validations in the
shader module, and then executing each validation every time the
module is used in a pipeline.

* Source/WebGPU/WGSL/CompilationMessage.h:
(WGSL::CompilationMessage::CompilationMessage):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::generate):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WGSL/WGSLShaderModule.cpp: Added.
(WGSL::ShaderModule::validateOverrides):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::addOverrideValidation):
* Source/WebGPU/WGSL/tests/invalid/override.wgsl: Added.
* Source/WebGPU/WGSL/wgslc.cpp:
(runWGSL):
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/Pipeline.mm:
(WebGPU::createLibrary):
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::earlyCompileShaderModule):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list