Skip to content

perf(webgpu): sync wgpu fork to upstream trunk; skip per-draw re-validation in finish - #219

Merged
triniwiz merged 2 commits into
masterfrom
perf/wgpu-draw-fast-path-sync
Nov 14, 2026
Merged

triniwiz merged 2 commits into
masterfrom
perf/wgpu-draw-fast-path-sync

Conversation

@triniwiz

@triniwiz triniwiz commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Bumps the wgpu fork, which now:

  • Skips per-draw re-validation in render pass replay. Consecutive draws with no state change reuse the readiness check, and redundant vertex/index rebinds are dropped. Headless finish() per draw at 13k draws:

    batched per-mesh
    Metal (M1 Max) 63 → 38 ns 240 → 195 ns
    Vulkan (Intel/Mesa) 66 → 36 ns 405 → 355 ns
  • Is merged with gfx-rs/wgpu trunk (304 commits). The merge has no measurable performance impact, and wgpu's own test suites pass.

canvas-c is ported to the upstream API changes, and the new snorm10-10-10-2 vertex format is exposed.

Fork: https://github.com/triniwiz/wgpu/tree/sync/upstream-trunk (87e00d492)

…dation in finish

wgpu-core replayed a render pass by re-running the full draw readiness
check on every draw (bind group compatibility, late buffer sizes, vertex
slots, index format) and re-issuing HAL vertex/index binds even when the
same buffers were already bound. For a three.js BatchedMesh pass that is
thousands of consecutive draws with no state change in between; for the
per-Mesh path it is the same geometry buffers rebound for every mesh.

The fork now caches the readiness check per draw family until a
non-draw command runs, skips the vertex slot and bind group rebind scans
when nothing is dirty, and drops redundant index/vertex rebinds.
Headless finish() cost per draw at 13k draws, same session A/B:

  Metal (M1 Max)        batched 63 -> 38 ns   per-mesh 240 -> 195 ns
  Vulkan (Intel/Mesa)   batched 66 -> 36 ns   per-mesh 405 -> 355 ns

The fork is also merged with gfx-rs/wgpu trunk (304 commits): coalesced
queue-write barriers, Metal pipeline switches without per-vertex-buffer
allocations, Vulkan descriptor pool recovery and transient memory pool,
Vulkan dma-buf texture import, Mali robust-image-access fix, deadlock
fixes, plus naga fixes. The merge is performance-neutral in interleaved
runs. wgpu's own suites pass on the merged tree (120 validation, 65 core
unit, 299 Metal GPU tests) and wgpu-hal/core type-check for the Android
and iOS targets.

canvas-c port: MapMode replaces HostMap and map_async takes the mode and
callback directly; get_mapped_range returns a BufferMapping; the two
pipeline error enums merged; Surface::configure returns Result and
Queue::submit returns Option; BufferUsages/ShaderStages are composed
flags; every TextureDescriptor gets texture_binding_view_dimension; the
new snorm10-10-10-2 vertex format is mirrored in the enum and TS types.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ec8dd321-b529-4174-8527-99c3a5221aa5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Without a lockfile, cargo picked lock_api 0.5, whose RawMutex/RawRwLock
traits wgpu-sync does not implement.
@triniwiz
triniwiz merged commit d18654e into master Nov 14, 2026
14 of 25 checks passed
@triniwiz
triniwiz deleted the perf/wgpu-draw-fast-path-sync branch November 14, 2026 10:25
triniwiz added a commit that referenced this pull request Nov 14, 2026
…dation in finish (#219)

The wgpu fork now reuses the draw readiness check across consecutive
draws with no state change and drops redundant vertex/index rebinds.
Headless finish() per draw at 13k draws:

  Metal (M1 Max)        batched 63 -> 38 ns   per-mesh 240 -> 195 ns
  Vulkan (Intel/Mesa)   batched 66 -> 36 ns   per-mesh 405 -> 355 ns

The fork is also merged with gfx-rs/wgpu trunk (304 commits), with
lock_api capped below 0.5 for wgpu-sync. canvas-c and canvas-napi are
ported to the upstream API changes, and the new snorm10-10-10-2 vertex
format is exposed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant