v137 · miscellaneous

WebGPU: copyBufferToBuffer overload

Functionality added to the WebGPU spec after its first shipment in a browser. The GPUCommandEncoder copyBufferToBuffer() method now includes a simpler way to copy entire buffers using a new overload with optional offsets and size parameters.

concepts

  1. copyBufferToBuffer overload

    An overload of copyBufferToBuffer that takes no offsets/size — copies the entire source. Cleaner than spelling out 0/0/srcSize every time.

  2. Per-frame Copies

    A particle-system-style hot loop: N copies per frame, scrubbable copy count and buffer size. Times both call shapes to expose the per-call validation savings.

  3. Copy graph

  4. Streaming Buffer Pipeline

    Per-frame streaming pipeline: CPU data → staging buffer → GPU processing buffer via copyBufferToBuffer(src, dst) → CPU readback. Each step visualized in sequence. Run single frames or 5-frame auto loop to see the simplified copy call in action.

    Pick a frame budget and copy strategy; the lab benches both overloads over 60 frames each and lays out the call shapes side-by-side with a quick reference of which overload to reach for.

why it shipped

To simplify the copy of entire buffers, a new overload has been added to the GPUCommandEncoder copyBufferToBuffer() method, allowing developers to omit offsets and size parameters.

references