[webkit-changes] [WebKit/WebKit] 89dad5: [WebGPU] drawIndexed validation fails when the buf...

mwyrzykowski noreply at github.com
Mon May 27 23:51:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 89dad57f2bc3dc221c72677411afa2114812499b
      https://github.com/WebKit/WebKit/commit/89dad57f2bc3dc221c72677411afa2114812499b
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
    A LayoutTests/fast/webgpu/regression/repro_274699-expected.txt
    A LayoutTests/fast/webgpu/regression/repro_274699.html
    M Source/WebGPU/WebGPU/Device.mm
    M Source/WebGPU/WebGPU/RenderBundleEncoder.mm
    M Source/WebGPU/WebGPU/RenderPassEncoder.h
    M Source/WebGPU/WebGPU/RenderPassEncoder.mm

  Log Message:
  -----------
  [WebGPU] drawIndexed validation fails when the buffer stride exceeds buffer's lastStride
https://bugs.webkit.org/show_bug.cgi?id=274699
<radar://128601247>

Reviewed by Tadeu Zagallo.

The buffer's lastStride was not correctly handled, it assumed a buffer with N vertices
had size of stride * N, but the actual required size is stride * (N - 1) + lastStride.

Fix the calculation to avoid out of bounds shader access.

* LayoutTests/fast/webgpu/regression/repro_274699-expected.txt: Added.
* LayoutTests/fast/webgpu/regression/repro_274699.html: Added.
Add regression test which asserts before this change with __XPC_MTL_SHADER_VALIDATION=1

* Source/WebGPU/WebGPU/Device.mm:
* Source/WebGPU/WebGPU/RenderBundleEncoder.mm:
(WebGPU::RenderBundleEncoder::computeMininumVertexCount const):
* Source/WebGPU/WebGPU/RenderPassEncoder.h:
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::computeMininumVertexCount const):
(WebGPU::RenderPassEncoder::clampIndexBufferToValidValues):
(WebGPU::RenderPassEncoder::drawIndexed):
Fix vertex count calculation related to the lastStride of the buffer.

Canonical link: https://commits.webkit.org/279367@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