Skip to content

[codex] Add WebGPU renderer benchmark - #163

Draft
meekmachine wants to merge 1 commit into
mainfrom
codex/webgpu-renderer-benchmark
Draft

[codex] Add WebGPU renderer benchmark#163
meekmachine wants to merge 1 commit into
mainfrom
codex/webgpu-renderer-benchmark

Conversation

@meekmachine

Copy link
Copy Markdown
Owner

Summary

Adds a browser-runnable WebGPU renderer benchmark for Loom3 and removes two Three.js constructor-identity assumptions that block WebGPU-build consumers.

The benchmark is a procedural scene, so it does not depend on external GLB assets. It exercises:

  • direct morph writes
  • AU-to-morph mapping
  • live viseme/jaw updates
  • composite bone rotation
  • baked AnimationMixer morph clip playback
  • material settings
  • hair mesh registration

Results are printed to the browser console with console.table() and stored on window.__loom3BenchmarkResult. The benchmark can be rerun with window.runLoom3Benchmark().

How to run

npm run benchmark:webgpu

Open the printed local URL and inspect the browser console.

Compatibility work included

  • Replaces obj instanceof Mesh in hair registration with structural obj.isMesh === true.
  • Adds a regression test for mesh-like objects whose prototype is not Three's Mesh constructor.
  • Replaces bone extraction instanceof THREE.Bone checks with structural isBone / type === 'Bone' checks.

Validation

  • npm test passed: 28 files, 179 tests.
  • npm run build passed.
  • npm run typecheck passed.
  • Browser smoke via Chrome remote debugging passed against http://localhost:4173/examples/webgpu-benchmark/.

Smoke result excerpt:

{
  "renderer": "WebGPURenderer",
  "threeRevision": "170",
  "rendererFlags": {
    "isWebGPURenderer": true,
    "isWebGLRenderer": false,
    "backend": "WebGPUBackend"
  },
  "setup": {
    "hairRegistrationCount": 1,
    "morphMeshCount": 2
  },
  "submitMs": {
    "avg": 0.368,
    "p95": 0.5,
    "p99": 0.5
  },
  "approximateFpsFromRaf": 72.478
}

Notes

This intentionally does not switch Loom3's main package import to three/webgpu. The fixture uses an import map so three, three/webgpu, and Loom3's package import resolve to the same WebGPU Three.js build in the browser.

@meekmachine

Copy link
Copy Markdown
Owner Author

PR backlog triage — DRAFT_KEEP (RuntimeCore benchmark)

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