Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae9209cc59f63567bb42f847f28f2994b15ba331
      
https://github.com/WebKit/WebKit/commit/ae9209cc59f63567bb42f847f28f2994b15ba331
  Author: Mike Wyrzykowski <mwyrzykow...@apple.com>
  Date:   2025-03-10 (Mon, 10 Mar 2025)

  Changed paths:
    M Source/WebGPU/WebGPU/BindableResource.h
    M Source/WebGPU/WebGPU/Device.mm
    M Source/WebGPU/WebGPU/RenderBundleEncoder.mm

  Log Message:
  -----------
  [WebGPU] static assert the size of IndexData in BindableResource.h and the 
sizes of IndexDataUshort and IndexDataUint in Device.mm
https://bugs.webkit.org/show_bug.cgi?id=289221
rdar://146359797

Reviewed by Cameron McCormack.

Add static assertions to ensure data between shaders matches C++
definitions.

Test: existing render bundle tests would immedietly fail with error similar to:
Error Domain=MTLLibraryErrorDomain Code=3 "program_source:33:5: error: 
static_assert failed due to requirement 'sizeof(IndexDataUshort) == 56' 
"sizeof(IndexDataUshort) in shader mismatches the API size"
    static_assert(sizeof(IndexDataUshort) == 56, "sizeof(IndexDataUshort) in 
shader mismatches the API size");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:34:5: error: static_assert failed due to requirement 
'sizeof(IndexDataUint) == 56' "sizeof(IndexDataUint) in shader mismatches the 
API size"
    static_assert(sizeof(IndexDataUint) == 56, "sizeof(IndexDataUint) in shader 
mismatches the API size");

which https://webgpu.github.io/webgpu-samples/?sample=renderBundles illustrates
prior to changing MTLPrimitiveType to a uint32_t

* Source/WebGPU/WebGPU/BindableResource.h:
metal::primitive_type is 4 bytes, while MTLPrimitiveType is sizeof(NSUInteger)
or 8 bytes on macs and phones, so use uint32_t instead to match.

* Source/WebGPU/WebGPU/Device.mm:
Add static assertions to ICB clamp pipeline.

* Source/WebGPU/WebGPU/RenderBundleEncoder.mm:
(WebGPU::RenderBundleEncoder::storeVertexBufferCountsForValidation):
add necessary static cast for conversion

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to