Skip to content

Volumes and density grids come in place - #201

Merged
yujiaxu-ops merged 19 commits into
mainfrom
step-g2
Nov 23, 2026
Merged

yujiaxu-ops merged 19 commits into
mainfrom
step-g2

Conversation

@yujiaxu-ops

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

Copy link
Copy Markdown
Collaborator

Volumes and density grids come in place

A volume that came, went or was set again while a game ran, a still volume's first move, a volume function, a new density grid and a grid program each had the scene built again from the world. On Bistro (2.8 M triangles, 960 x 540, an M5 Pro), the frame the edit landed in:

main this
a homogeneous volume comes (the scene's first medium) 1.4 to 1.6 s no long frame (18 ms at most)
a volume with a 32³ density grid comes 1.3 to 1.4 s no long frame (27 ms)
a volume whose 32³ grid a program simulates comes 1.2 to 1.4 s 128 ms, the program's pass compiled; 19 ms once the driver has it
the first volume goes 1.1 to 1.2 s no long frame (21 ms)
the simulated one goes 1.2 s no long frame (18 ms)

Frames are 16.6 ms; each cell is the longest frame within 1.5 s of the edit, over two runs (main: two to four). On main a rebuild that needed a kernel variant the driver had not compiled took 5.1 to 5.4 s instead; here the variant is made beside the frames and the volume is drawn when it is there.

  • The media table is made whole from the world, as a build makes it (LiveCore::set_media, scene::MediumGpu::of): the volumes shown, and the hidden ones while the kernel has room. A volume function that comes takes the next number (Kernel::with_volume_functions); the kernel's count of media and its media features follow, and a scene's first volume is another kernel variant, made beside the frames.
  • Density grids follow the volumes that name them (Gpu::put_grids). The build and the view stack them by one function (scene::grid_of). A new grid, another size, another program or a program's code has the atlas and the programs' pass made again; what the programs had simulated is copied on the GPU to the grids that are the same still. New parameters make nothing again.
  • A simulated grid's program runs in its volume's box as the table has it: a still volume that is moved takes its grid with it.

docs/RUNTIME.md "What comes in place" has the rules and what still rebuilds: particle systems and their functions and programs; geometry functions; a posed model the scene has not got; any new model under software traversal; a rect light's card; lights past what the kernel sums exactly; the scene's first instance, procedural object, instance colours or vertex colours.

Costs that stay

  • A grid program that comes or changes is compiled in the frame it comes in (the 128 ms above).
  • Every grid is made again when one comes or goes (one atlas holds them all).

Tests

  • Each edit against a build of the edited world, state and picture: volumes_come_and_go_in_place (12 steps), density_grids_come_and_change_in_place (17 steps, with the cells a program had simulated read back).
  • The world's rules: density_grids_are_checked_and_updated_in_place.
  • Mutations: 23. 20 failed a test. Two had none, a media table that grew and was not bound again and a grid counted the same although its volume was another, and have their cases now. One was no fault: where a grid lies follows from the grids before it, and that comparison is gone.
  • Found by review: a still volume that was moved left its grid's program running in the box where it had stood; a volume edit in place did not hold the lighting's histories short for the frames after it, as a rebuild did (nor had a volume shown or hidden in place on main).

Checks

  • Unit tests 252 under each traversal.
  • Render tests: the volume, fog and medium-shadow groups (43 tests) read as main's, test by test (six of them fail on main as well, since another change). The whole render suite has not been run on this head.
  • A frame's GPU time in twelve scenes, one run against main: between -0.4 % and +0.5 %, which one run does not tell from no change. The scenes' pictures score as main's.
  • The library builds for wasm32.

🤖 Generated with Claude Code

yujiaxu-ops and others added 17 commits November 23, 2026 15:22
…g them again

A new texture, a material given a map, a new material with maps and a texture's new
pixels rebuilt the scene (4.5 s on Bistro: the pages packed whole). The pages keep where
each texture is and what they have free (texpack::Atlas); a texture is placed among them
and written there, the pages growing by a layer or a side with a copy on the GPU; new
pixels of the same size go over the old ones.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s textures, its mesh

Adding a model whose file the scene did not hold rebuilt it (5.2 s on Bistro). Its
materials are made as the build makes them and its textures placed in the pages before
the edit places it; its mesh is made in the room by the code a scene's mesh is made by
(make_mesh, moved out of edit_geometry). A mesh given back is no model's any more.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A feature a scene first uses (fog, glass, a texture) changed the kernel's variant, and
the next frame waited for the driver's compile (0.8 to 2.4 s here, tens of seconds on a
phone). The view now runs the kernel it has until the scene's is made on another thread
(Gpu::warm_kernel; modules and pipelines made without a lock held). In lockstep, and in
a browser, the frame makes its kernel itself as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ce comes in place

Each was refused for a kernel feature the scene's structure lacked (F_MASKED, F_IFUNC,
F_IGLASS) and rebuilt the scene. The three switch code on over data every scene has:
the edit asks for the feature, the commit adds it to the scene's, and the kernel's
variant with it is made as any other.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A new or changed material function rebuilt the scene (4.2 s on Bistro, and 7.9 s once a
texture had come in place: the pages packed whole). The scene keeps its functions by
number, one that comes takes the next; the kernel with them is another module, made
while the frames go on with the one the view has, where a material of a function it has
not is drawn as one without.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A light created, removed or set again as one of another class rebuilt the scene, and so
did a group (1.5 s on Bistro each). A light that is the light table's alone (not a rect
light's card, not the atmosphere's sun) has its entry added, dropped or sorted again in
place: the table is listed in a build's order, grown where it is full, and the kernel's
counts follow. Lights past what the kernel sums exactly still rebuild (the light tiles).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ild; the textures' test holds a shared slot and the grown pages' contents

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the light table's growth; tests for a model that emits, lights among those resampled, a shelf too low

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ice is one thread's)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…is made again with the translucency pass's functions as they are now

The pass's dispatch has its particles' materials' functions alone, made when the kernel
is. A material that changed function in place kept the old one (drawn as without a
function). The kernel's functions are remade after the commit's materials, where a
function came or changed or the particles' functions are others.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A volume created, set again, removed, or moved where it stood still rebuilt the scene,
and so did a volume function. The media table is made again from the world as the build
makes it (the volumes shown, the hidden ones while there is room), the kernel's count
and media features follow, and volume functions are numbered as they come: the kernel
with them is another module, made while the frames go on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	renderer/src/gpu.rs
#	renderer/src/live/edits.rs
#	renderer/src/live/inplace_tests.rs
#	renderer/src/live/load.rs
#	renderer/src/world.rs
A new grid, another size, another program, a program's code or its
parameters are the media table's change: the grids are made again as a
build stacks them (one function for both), and what the programs had
simulated goes with the grids that are still the same. Parameters alone
make nothing again. A simulated grid's program follows its volume's box
when a still volume is moved.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ia table; docs

Two mutations no test failed: the media table's growth not bound again
(the tests had two volumes, the table room for two), and a grid counted
the same although its volume was another (the tests never had that
alone). A grid that only passes to another volume is not made again:
its node is taken with its placement.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…mpared

Where a grid lies follows from the grids before it (a mutation of that
comparison changed nothing).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops marked this pull request as ready for review November 23, 2026 13:21

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 7a21159. Configure here.

Comment thread renderer/src/live/edits.rs Resolved
yujiaxu-ops and others added 2 commits November 23, 2026 21:38
A rebuild said the lighting changed (the temporal pass and the cache hold
short histories and look for the change for 45 frames); the media table
made in place did not, and neither did a volume shown or hidden in place.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops merged commit 442a975 into main Nov 23, 2026
9 checks passed
@yujiaxu-ops
yujiaxu-ops deleted the step-g2 branch November 23, 2026 15:38
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