Skip to content

Scene step D, second part: the light list is filled on the GPU - #150

Merged
yujiaxu-ops merged 6 commits into
mainfrom
emitters-gpu-fill
Nov 17, 2026
Merged

yujiaxu-ops merged 6 commits into
mainfrom
emitters-gpu-fill

Conversation

@yujiaxu-ops

@yujiaxu-ops yujiaxu-ops commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Scene step D, second part. Follows #147.

What

What moves an emitter after the light list was written is copied into the list by a GPU pass (emitter_fill.wgsl), as real-time engines prepare their lights: a run of the list an invocation row, each emitter's rows taken again from its triangle.

  • Emitters the CPU moves (reposed triangles): filled after a commit that moved them. The CPU's rewrite from Scene step D, first part: the light list holds its triangles #147 is gone.
  • Particles' emitters: filled after the particle passes, live and offline. The kernel reads every emitter from the list; its particle case (emitter_tri_of) is gone.
  • EmitterRuns at prepare; gpu::EmitterFills a scene (only with hardware ray tracing: nothing moves emitters in place without it); the pipeline is made once; bind groups are made again when a buffer grows.

Measured

  • The crowd's commit (21,280 moving emitters): 4.5 ms in a guarded run, main's level (4.9 to 5.0 with Scene step D, first part: the light list holds its triangles #147's CPU rewrite). An unguarded timing is still owed: the machine was busy.
  • No scene of the catalog has light-sampled particles; that fill is covered by tests only.

Pictures

  • render-identity against Scene step D, first part: the light list holds its triangles #147's build, 239 outputs: 217 byte-identical, 19 within their own spread; the two light-sampled particle tests differ in their last bits (4e-7: their kernel variant reads other code); geometry/grow-live left no output on either build in that run (its script ran past its time on a busy machine).
  • Bistro and the crowd: within main's own run-to-run difference.
  • Vulkan (RTX 5090), against Scene step D, first part: the light list holds its triangles #147's build: 236 outputs, 219 byte-identical, 17 within their own spread, 0 changed. cargo test 167 passed there (the fill pass and its readback test); test-render fails only tests that fail there on main.

Tests

  • cargo test 167 passed, test-render 239 pass.
  • the_light_list_holds_its_triangles now covers particles (collapsed as loaded, placed after a frame) and the movers through the pass. Four mutants (a fill not run, the pass copying one row, the pass losing the words), each caught.

Next

Emitters on instances: an entry an instance and emitting triangle, their runs filled by this pass through the instance's matrix.

🤖 Generated with Claude Code

yujiaxu-ops and others added 5 commits November 17, 2026 04:55
Light sampling read an emitter's triangle from the triangles' table as world
space, so whatever emits had to be stored there in world space (flattened, or
a mesh of its own written in world space). The list now has its own copy, the
way real-time engines keep a light list: `Table::EmitterTris`, one
`GpuEmitterTri` an emitter (v0, e1, e2 in world space; its triangle, object
and light-tree path code). The kernel's emitter sampling, light LOD, cull and
`emit_mis` read it. A CDF entry names its emitter; a triangle's attributes
name its emitter entry (x.w, where the path code was).

The copies follow what moves (`move_emitters`: the emitters the CPU moves) and
what edits make (`write_emitters`). A particle's is still read where its pass
places it. Nothing is placed otherwise yet.

Cost: 48 B an emitter; the trace +0.07 to 0.10 ms where emitters are sampled
(Bistro 7.18 -> 7.29 ms, Tokyo 4.41 -> 4.42, none without emitters), not
attributed; 0.2 ms of CPU a frame for the crowd's 21,280 moving emitters, which
a GPU pass is to take over. Pictures: big scenes within main's own run-to-run
difference; 26 of the suite's 239 outputs differ in their last bits.

Test: `the_light_list_holds_its_triangles` reads the list and the triangles
back from the GPU after a load, a move and in-place edits.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
What moves an emitter after the list was written is copied into it by a pass
(`emitter_fill.wgsl`, what real-time engines call preparing the lights): a run
of the list an invocation row, each emitter's rows taken again from its
triangle.

- The emitters of the triangles the CPU reposes: filled after a commit that
  moved them, in place of the CPU's rewrite (0.2 ms a frame on the crowd).
- The particles': filled after their passes, so the kernel reads every emitter
  from the list; its particle case (`emitter_tri_of`) is gone.

`EmitterRuns` at prepare, `gpu::EmitterFills` a scene (with hardware ray
tracing), the pipeline made once.

Test: the readback test covers particles (collapsed as loaded, placed after a
frame) and the movers through the pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops changed the base branch from emitters-decoupled to main November 17, 2026 07:05
@yujiaxu-ops
yujiaxu-ops merged commit 2a9b67c into main Nov 17, 2026
9 checks passed
@yujiaxu-ops
yujiaxu-ops deleted the emitters-gpu-fill branch November 17, 2026 08:02
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