Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cb889bc9fe7ef028ee24aa8c822832e4be6495d1
      
https://github.com/WebKit/WebKit/commit/cb889bc9fe7ef028ee24aa8c822832e4be6495d1
  Author: Mike Wyrzykowski <[email protected]>
  Date:   2025-02-07 (Fri, 07 Feb 2025)

  Changed paths:
    M Source/WebGPU/WebGPU/Buffer.h
    M Source/WebGPU/WebGPU/Buffer.mm
    M Source/WebGPU/WebGPU/CommandBuffer.h
    M Source/WebGPU/WebGPU/CommandBuffer.mm
    M Source/WebGPU/WebGPU/CommandEncoder.h
    M Source/WebGPU/WebGPU/CommandEncoder.mm
    M Source/WebGPU/WebGPU/CommandEncoder.swift
    M Source/WebGPU/WebGPU/ComputePassEncoder.h
    M Source/WebGPU/WebGPU/ComputePassEncoder.mm
    M Source/WebGPU/WebGPU/Queue.h
    M Source/WebGPU/WebGPU/Queue.mm
    M Source/WebGPU/WebGPU/RenderBundleEncoder.mm
    M Source/WebGPU/WebGPU/RenderPassEncoder.h
    M Source/WebGPU/WebGPU/RenderPassEncoder.mm

  Log Message:
  -----------
  [WebGPU] Out of order encoding and submission leads to potential incorrect 
validation
https://bugs.webkit.org/show_bug.cgi?id=286669
rdar://143806368

Reviewed by Dan Glastonbury.

Since we attempt to avoid repeated vertex buffer validation, out of order
encoding may allow for skipping validation incorrectly.

This out of order encoding which mutates the index buffer seems incredibly 
uncommon.
I have not trigged the issue on a single site I'm aware of.

The performance is quite bad but it does not appear anyone is intentionally 
doing
anything of this nature, so this PR is for correctness.

* Source/WebGPU/WebGPU/Buffer.h:
* Source/WebGPU/WebGPU/Buffer.mm:
(WebGPU::span):
(WebGPU::Buffer::makeIndexIndirectBuffer):
(WebGPU::Buffer::getBufferContents):
(WebGPU::Buffer::mapGPUAddress const):
(WebGPU::Buffer::canSkipDrawIndexedValidation const):
(WebGPU::Buffer::drawIndexedValidated):
(WebGPU::verifyIndexBufferData):
(WebGPU::Buffer::takeSlowIndexValidationPath):
(WebGPU::Buffer::takeSlowIndirectIndexValidationPath):
(WebGPU::verifyIndirectBufferData):
(WebGPU::Buffer::takeSlowIndirectValidationPath):
(WebGPU::Buffer::skippedDrawIndexedValidation):
(WebGPU::Buffer::skippedDrawIndirectIndexedValidation):
(WebGPU::Buffer::skippedDrawIndirectValidation):
(WebGPU::Buffer::didReadOOB):
(WebGPU::Buffer::indirectBufferInvalidated):
* Source/WebGPU/WebGPU/CommandBuffer.h:
(WebGPU::CommandBuffer::create):
* Source/WebGPU/WebGPU/CommandBuffer.mm:
(WebGPU::CommandBuffer::CommandBuffer):
(WebGPU::CommandBuffer::makeInvalid):
(WebGPU::CommandBuffer::preCommitHandler):
(WebGPU::CommandBuffer::postCommitHandler):
(WebGPU::CommandBuffer::addPostCommitHandler):
* Source/WebGPU/WebGPU/CommandEncoder.h:
* Source/WebGPU/WebGPU/CommandEncoder.mm:
(WebGPU::CommandEncoder::copyBufferToBuffer):
(WebGPU::CommandEncoder::copyTextureToBuffer):
(WebGPU::CommandEncoder::clearBuffer):
(WebGPU::CommandEncoder::finish):
(WebGPU::CommandEncoder::resolveQuerySet):
(WebGPU::CommandEncoder::addOnCommitHandler):
* Source/WebGPU/WebGPU/CommandEncoder.swift:
(WebGPU.copyBufferToBuffer(_:sourceOffset:destination:destinationOffset:size:)):
(WebGPU.copyTextureToBuffer(_:destination:copySize:)):
(WebGPU.clearBuffer(_:offset:size:)):
* Source/WebGPU/WebGPU/ComputePassEncoder.mm:
(WebGPU::addResourceToActiveResources):
(WebGPU::ComputePassEncoder::executePreDispatchCommands):
* Source/WebGPU/WebGPU/Queue.h:
(WebGPU::Queue::WTF_GUARDED_BY_LOCK):
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::waitForAllCommitedWorkToComplete):
(WebGPU::Queue::commitMTLCommandBuffer):
(WebGPU::Queue::submit):
(WebGPU::Queue::synchronizeResourceAndWait):
(WebGPU::Queue::clearBuffer):
* Source/WebGPU/WebGPU/RenderBundleEncoder.mm:
(WebGPU::RenderBundleEncoder::drawIndexed):
* Source/WebGPU/WebGPU/RenderPassEncoder.h:
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::addResourceToActiveResources):
(WebGPU::RenderPassEncoder::executePreDrawCommands):
(WebGPU::RenderPassEncoder::clampIndexBufferToValidValues):
(WebGPU::checkForIndirectDrawDeviceLost):
(WebGPU::RenderPassEncoder::clampIndirectIndexBufferToValidValues):
(WebGPU::RenderPassEncoder::clampIndirectBufferToValidValues):
(WebGPU::RenderPassEncoder::drawIndexed):
(WebGPU::RenderPassEncoder::executeBundles):

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



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

Reply via email to