[webkit-changes] [WebKit/WebKit] aa1bdf: [WGSL] shader, execution, expression, call, builtin, ar...

Tadeu Zagallo noreply at github.com
Tue Jan 16 05:04:25 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aa1bdf7dca239287827c1c5f41d64b4cd1b3d0a4
      https://github.com/WebKit/WebKit/commit/aa1bdf7dca239287827c1c5f41d64b4cd1b3d0a4
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2024-01-16 (Tue, 16 Jan 2024)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTStructure.h
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/Types.cpp
    M Source/WebGPU/WGSL/Types.h
    M Source/WebGPU/WGSL/WGSLShaderModule.h
    M Source/WebGPU/WGSL/tests/valid/packing.wgsl

  Log Message:
  -----------
  [WGSL] shader,execution,expression,call,builtin,arrayLength:* is failing
https://bugs.webkit.org/show_bug.cgi?id=267549
rdar://121010619

Reviewed by Mike Wyrzykowski.

There were a couple issues with arrayLength:
- The offset of the array in the buffer has to be subtracted from the buffer size
  before dividing by the array stride.
- Packing and unpacking functions should not be generated if the struct is not
  constructible.
- In the process we also avoid emitting pack/unpack calls when implicitly conversion
  would work instead, e.g. assignment from vec3 to packed_vec3, and also for types
  that were not packed, where previously we'd emit pack/unpack for all struct fields
  unconditionally.

* Source/WebGPU/WGSL/AST/ASTStructure.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::getPacking):
(WGSL::RewriteGlobalVariables::packingForType):
(WGSL::RewriteGlobalVariables::packStructType):
(WGSL::RewriteGlobalVariables::finalizeArgumentBufferStruct):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
(WGSL::Metal::FunctionDefinitionWriter::generatePackingHelpers):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::packing const):
(WGSL::Type::isConstructible const):
* Source/WebGPU/WGSL/Types.h:
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::usesPackedStructs const): Deleted.
(WGSL::ShaderModule::setUsesPackedStructs): Deleted.
(WGSL::ShaderModule::clearUsesPackedStructs): Deleted.
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:

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




More information about the webkit-changes mailing list