[webkit-changes] [WebKit/WebKit] c485e8: [WGSL] Pack nested structs

Tadeu Zagallo noreply at github.com
Thu Oct 5 02:07:57 PDT 2023


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

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

  Log Message:
  -----------
  [WGSL] Pack nested structs
https://bugs.webkit.org/show_bug.cgi?id=262626
rdar://116467765

Reviewed by Mike Wyrzykowski.

We were failing to pack structs referenced by other packed structs. In order to
avoid excessive rewriting of the AST, we simply generate the packed structs, but
leave it up to the code generator to update the struct fields.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::packArrayResource):
(WGSL::RewriteGlobalVariables::packType):
(WGSL::RewriteGlobalVariables::packStructType):
(WGSL::RewriteGlobalVariables::packArrayType):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
(WGSL::Metal::FunctionDefinitionWriter::generatePackingHelpers):
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::usesPackedStructs const):
(WGSL::ShaderModule::setUsesPackedStructs):
(WGSL::ShaderModule::clearUsesPackedStructs):
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:

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




More information about the webkit-changes mailing list