refactor(rendering,particles): generalize WebGPU compute SDK primitives, migrate ParticleGpuState onto them#418
Merged
Conversation
added 2 commits
July 26, 2026 14:08
…es, migrate ParticleGpuState onto them WebGpuComputePipeline gains multi-group bind groups, texture/sampler/storage-texture bindings, dedicated 2D/3D and indirect dispatch methods. New WebGpuUniformBuffer mirrors WebGpuStorageBuffer for the uniform-buffer case. New reflectComputeBindings derives bindingGroups directly from a compute shader's own @group/@binding declarations instead of a hand-written parallel binding list. ParticleGpuState now builds entirely on these primitives (buffers, pipeline, bind-group layouts via reflection) instead of raw WebGPU calls duplicated alongside the SDK surface, removing ~50 lines of binding-list bookkeeping that had to be kept in sync with the shader text by hand. No public API change to ParticleSystem; internal-only. Verified against the existing 27-test particle-gpu.test.ts suite (unmodified) plus typecheck/lint.
Exoridus
enabled auto-merge (squash)
July 26, 2026 12:18
|
To use Codex here, create an environment for this repo. |
Bundle ReportChanges will increase total bundle size by 24.55kB (0.1%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: exo-esm-modules-esmAssets Changed:
Files in
Files in
Files in
Files in
Files in
view changes for bundle: exojs-particles-esmAssets Changed:
Files in
view changes for bundle: exo-full-iife-Exo-iifeAssets Changed:
Files in
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WebGpuComputePipelinegains multi-group bind groups, texture/sampler/storage-texture bindings, and dedicateddispatchWorkgroups(2D/3D) anddispatchIndirectmethods alongside the existing item-countdispatch.WebGpuUniformBuffermirrorsWebGpuStorageBufferfor the uniform-buffer case (kept as a separate class rather than merged — different real-world usage shape: storage buffers get read back, uniform buffers essentially never do).reflectComputeBindings(wgsl, options?)derivesbindingGroupsdirectly from a compute shader's own@group/@bindingdeclarations via a small set of targeted regexes, instead of a hand-written parallel binding list that has to be kept in sync with the shader text by hand.ParticleGpuState(exojs-particles) is migrated fully onto these primitives — all 8 storage buffers, all 3 uniform buffers, the compute pipeline, and both bind-group layouts (the second one now reflected, not hand-written). ~50 lines of binding-list bookkeeping removed.No public API change to
ParticleSystemor any engine-facing surface — internal-only, plus new SDK-only exports on@codexo/exojs/renderer-sdk(WebGpuUniformBuffer,reflectComputeBindings, extendedWebGpuComputePipeline/ComputeBinding).Test plan
pnpm typecheck(root) cleanpnpm --filter @codexo/exojs-particles typecheckcleaneslintclean on all touched filespackages/exojs-particles/test/particle-gpu.test.ts— all 27 tests pass unmodified, proving the reflected bind-group layout matches the previously hand-written one bit-for-bit (including the module-uniforms-present/absent branch and ther32floatnon-filtering texture/sampler case)pnpm verify:quick(full local pre-push gate: typecheck across all projects, guides, examples, type-tests, packages, lint, format, API-doc sync) — all green