Repository navigation
Live: a power or material edit writes only the light list's codes that changed (a frame 742 -> 13 ms with 275 flashing emitters) - #180
Merged
Conversation
…t changed (a game flashing 300 moving emitters: 600 -> 11 ms a frame) write_emitters rewrote the path code of every emitter outside the light tree's static part on each power or emission edit, one 4-byte write_buffer each (the list's records are 48 bytes apart, so nothing merged): 133 k moving emitter triangles cost a frame ~470 ms of commit. LoadedScene keeps the codes it last wrote (codes_sent) and writes only those that changed; a load or a rebuild starts it empty, and emitters added in place are written whole and then their codes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A game that changes how bright its moving emitters are every frame (glowing bodies that flash when they bounce) spent about 470 ms of every frame in the commit. On each power or emission edit,
write_emitterswrote the path code of every emitter outside the light tree's static part, one 4-bytewrite_buffereach: the list's records are 48 bytes apart, soGathermerged nothing, and 133 k moving emitter triangles were 133 k writes.The loaded scene now keeps the codes it last wrote (
LoadedScene::codes_sent) and writes only those that changed. A power edit leaves every code as it was, so it writes none.Measured
Apple M3 Max, "Torrent" (a test game, not in this PR): 500 bodies pouring down a slope, 275 of them glowing spheres and cubes (about 133 k moving emitter triangles), whose brightness the game changes on about 30 bodies a frame. 1280 × 720, render scale 1, lockstep, frames 60 to 240:
The same with a material per body (
emissiveIntensityinstead of the object's power): 13.1 ms a frame, the same path.Merge gate (R3: a perf claim)
npm run typecheck,npm test: pass.cargo test --release: 206 passed. New:power_edits_keep_the_light_lists_codes, the GPU's light list against the codes after repeated power edits, a move, and two materials that start emitting one after the other (with moving emitters, with and without a light tree, and with still ones, whose tree slot regrows). A mutation that writes only codes never sent fails it (emitter 306's code). One run of the full suite failedthe_light_list_holds_its_trianglesandmoved_instances_keep_their_motionwith wgpu "buffer is invalid" validation errors; both pass alone and the suite passed on the rerun.cargo test --lib livefails a different few tests with the same errors on every run on main 7d1dfc3 too (parallel GPU tests).test:render: main 261 pass / 3 unsupported, branch the same; nothing newly failing.render-identity(main against branch, live tests included): 261 outputs, 238 byte-identical, 23 within their run-to-run spread, 0 changed.🤖 Generated with Claude Code