Skip to content

perf(webgpu): promote stable retained replay - #784

Merged
Exoridus merged 4 commits into
nextfrom
feat/native-retained-replay
Sep 27, 2026
Merged

Exoridus merged 4 commits into
nextfrom
feat/native-retained-replay

Conversation

@Exoridus

@Exoridus Exoridus commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Behavior

Stable WebGPU retained groups reuse native render bundles after 30 complete compatible replay frames and at least 32 supported batches. Construction is limited to 32 bundles per backend frame. Resource or recording invalidation immediately returns to ordinary replay and restarts observation without eager rebuilding.

Sprite, scalable geometry, Text and TileChunk keep their existing resource/uniform upkeep. Native reuse validates resource identities. Stencil, writable-depth and multiple-color-attachment passes use ordinary replay, preserve normal-pass bundles, and pause stability observation. Mixed renderer groups retain bind groups per layout. The 30/32/32 policy is internal, with no public tuning API.

Evidence

A controlled idle acquisition used nine fresh Chromium processes: three each for 10k/50k/100k sprites, eight alternating paired AB/BA blocks per process, without concurrent local builds or tests. All nine process medians are positive:

Sprites Retained batches Paired CPU saving, three processes
10k 157 0.010 / 0.025 / 0.030 ms
50k 782 0.060 / 0.060 / 0.075 ms
100k 1563 0.060 / 0.070 / 0.100 ms

63/72 paired blocks are positive; all 24 blocks at 100k are positive. All timed frames have zero builds. Every acquisition verifies actual native execution, synchronized byte-identical pixels, a nonblank clear control, no WebGPU validation errors, and the 32-build frame budget. Raw data, source hashes and reproducer are committed. Measured runtime hashes remain identical after the final rebase.

These are CPU submission savings on one RTX 5070 Ti, not GPU time or FPS gains. They are smaller than the eager spike. Additional hardware, representative consumers and integrated churn performance remain follow-up work. The new canonical dataset supersedes uncontrolled desktop measurements; earlier data remains in Git history. Excluded exploratory raw data is removed from the final tree.

Validation

24 targeted cache tests pass, including fallback preservation, paused promotion, and resource changes on return. Real WebGPU stencil/MRT preservation tests pass. Focused tests also cover camera and texture changes, custom uniforms, mixed renderer transitions, render-target formats and synchronized pixels. All 25 static gates, unit/allocation/physics, WebGL, tilemap, structural benchmarks (60 cells, zero deviations), site build and 13 sampled example smokes pass. The full local WebGPU run stalled with 101 files / 618 tests passed; its test browser was terminated, and the remaining text-shaping parity file then passed all six tests in isolation with two workers. The stall is not proven to be local-only. Completed gates were not rerun on push; the final full remote WebGPU lane and overall CI must pass before merge.

#782 and #783 are merged; this branch is rebased onto their resulting next. Manual merge only, no automerge.

@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 26.96kB (0.08%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
exo-esm-esm 1.29MB 3.01kB (0.23%) ⬆️
exo-esm-modules-esm 3.7MB 5.63kB (0.15%) ⬆️
exo-iife-min-Exo-iife 1.29MB 3.01kB (0.23%) ⬆️
exo-full-iife-Exo-iife 5.94MB 6.07kB (0.1%) ⬆️
exojs-tilemap-esm 234.26kB 461 bytes (0.2%) ⬆️
exo-iife-Exo-iife 3.59MB 5.59kB (0.16%) ⬆️
exo-full-iife-min-Exo-iife 2.16MB 3.19kB (0.15%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: exo-esm-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.esm.js 3.01kB 1.29MB 0.23%

Files in exo.esm.js:

  • ./src/rendering/webgpu/WebGpuScalableSpriteRenderer.ts → Total Size: 27.72kB

  • ./src/rendering/webgpu/WebGpuNativeRetainedReplay.ts → Total Size: 3.42kB

  • ./src/rendering/webgpu/WebGpuTextRenderer.ts → Total Size: 38.44kB

  • ./src/rendering/webgpu/WebGpuBackend.ts → Total Size: 99.61kB

  • ./src/rendering/webgpu/WebGpuSpriteRenderer.ts → Total Size: 51.04kB

  • ./src/rendering/webgpu/WebGpuRetainedGroupBundle.ts → Total Size: 14.77kB

view changes for bundle: exojs-tilemap-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
webgpu/WebGpuTileChunkRenderer.js 461 bytes 21.38kB 2.2%

Files in webgpu/WebGpuTileChunkRenderer.js:

  • ./src/webgpu/WebGpuTileChunkRenderer.ts → Total Size: 20.86kB
view changes for bundle: exo-esm-modules-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
rendering/webgpu/WebGpuBackend.js 242 bytes 102.5kB 0.24%
rendering/webgpu/WebGpuSpriteRenderer.js 475 bytes 53.18kB 0.9%
rendering/webgpu/WebGpuTextRenderer.js 376 bytes 39.47kB 0.96%
rendering/webgpu/WebGpuScalableSpriteRenderer.js 461 bytes 28.92kB 1.62%
rendering/webgpu/WebGpuRetainedGroupBundle.js 563 bytes 15.13kB 3.86%
rendering/webgpu/WebGpuNativeRetainedReplay.js (New) 3.51kB 3.51kB 100.0% 🚀

Files in rendering/webgpu/WebGpuBackend.js:

  • ./src/rendering/webgpu/WebGpuBackend.ts → Total Size: 99.61kB

Files in rendering/webgpu/WebGpuSpriteRenderer.js:

  • ./src/rendering/webgpu/WebGpuSpriteRenderer.ts → Total Size: 50.97kB

Files in rendering/webgpu/WebGpuTextRenderer.js:

  • ./src/rendering/webgpu/WebGpuTextRenderer.ts → Total Size: 38.42kB

Files in rendering/webgpu/WebGpuScalableSpriteRenderer.js:

  • ./src/rendering/webgpu/WebGpuScalableSpriteRenderer.ts → Total Size: 27.7kB

Files in rendering/webgpu/WebGpuRetainedGroupBundle.js:

  • ./src/rendering/webgpu/WebGpuRetainedGroupBundle.ts → Total Size: 14.76kB

Files in rendering/webgpu/WebGpuNativeRetainedReplay.js:

  • ./src/rendering/webgpu/WebGpuNativeRetainedReplay.ts → Total Size: 3.42kB
view changes for bundle: exo-iife-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.iife.js 5.59kB 3.59MB 0.16%

Files in exo.iife.js:

  • ./src/rendering/webgpu/WebGpuRetainedGroupBundle.ts → Total Size: 15.13kB

  • ./src/rendering/webgpu/WebGpuNativeRetainedReplay.ts → Total Size: 3.51kB

  • ./src/rendering/webgpu/WebGpuBackend.ts → Total Size: 102.08kB

  • ./src/rendering/webgpu/WebGpuTextRenderer.ts → Total Size: 39.38kB

  • ./src/rendering/webgpu/WebGpuSpriteRenderer.ts → Total Size: 52.22kB

  • ./src/rendering/webgpu/WebGpuScalableSpriteRenderer.ts → Total Size: 28.38kB

view changes for bundle: exo-iife-min-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.iife.min.js 3.01kB 1.29MB 0.23%

Files in exo.iife.min.js:

  • ./src/rendering/webgpu/WebGpuBackend.ts → Total Size: 102.08kB

  • ./src/rendering/webgpu/WebGpuScalableSpriteRenderer.ts → Total Size: 28.38kB

  • ./src/rendering/webgpu/WebGpuRetainedGroupBundle.ts → Total Size: 15.13kB

  • ./src/rendering/webgpu/WebGpuSpriteRenderer.ts → Total Size: 52.22kB

  • ./src/rendering/webgpu/WebGpuTextRenderer.ts → Total Size: 39.38kB

  • ./src/rendering/webgpu/WebGpuNativeRetainedReplay.ts → Total Size: 3.51kB

view changes for bundle: exo-full-iife-min-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.full.iife.min.js 3.19kB 2.16MB 0.15%

Files in exo.full.iife.min.js:

  • ./packages/exojs-tilemap/src/webgpu/WebGpuTileChunkRenderer.ts → Total Size: 21.37kB
view changes for bundle: exo-full-iife-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.full.iife.js 6.07kB 5.94MB 0.1%

Files in exo.full.iife.js:

  • ./packages/exojs-tilemap/src/webgpu/WebGpuTileChunkRenderer.ts → Total Size: 21.37kB

@Exoridus
Exoridus force-pushed the feat/native-retained-replay branch from 0d73c4d to d36fd00 Compare September 27, 2026 06:19
@Exoridus
Exoridus marked this pull request as ready for review September 27, 2026 06:19
@Exoridus
Exoridus merged commit f0628ec into next Sep 27, 2026
18 checks passed
@Exoridus
Exoridus deleted the feat/native-retained-replay branch September 27, 2026 06:28
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