Repository navigation
Update named mesh geometry in a native session (#59) - #61
Merged
Merged
Conversation
session.update accepts a new triangles table of any length. Meshes (by blas_index) whose triangle corners changed get a new BLAS built from one vertex buffer that holds only them; the other BLAS are kept and the TLAS is rebuilt. Reports changedMeshes. Refuses a changed set of meshes, a range outside the table and a triangleCount that does not match the table. Closes #59. Part of codepawl/crucible#1786.
This was referenced Nov 16, 2026
Merged
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.
Closes #59
Part of codepawl/crucible#1786
What changed
session.updatenow accepts a newtrianglestable of any length. Meshes are the instances that share ablas_index; the update keeps the set of meshes and the instance count, compares each mesh's triangle corners with the ones its BLAS was built from, builds a new BLAS for each mesh that differs (from one vertex buffer holding only those), keeps the other BLAS, and rebuilds the TLAS. The pipeline, textures, environment and unchanged BLAS stay. It reportschangedMeshes,accelerationRebuiltand the seconds.blas_indexvalues, an instance range outside the table, atriangleCountword that differs from the table, any instance mesh change without a new table.src/host/accel.rs(mesh plan,plan_geometry_update,update_cycles_geometry),src/host/cycles_session.rs,src/host/cycles_update.rs,src/cycles/mod.rs,src/lib.rs,index.mjs, README.How I checked it
node tools/run-cargo-tests.mjs:test result: ok. 142 passedandok. 23 passed, 0 failed.node --test: tests 201, pass 201, fail 0.tests/gpu/session-geometry-update.test.mjs(5 tests): frame N from a session updated from frame N-1 equals a freshtraceNativeof frame N byte for byte (rgba and depth), for a mesh that shrinks (86 to 84 triangles, shifting the meshes after it), grows, moves with the same count, and a mesh shared by two instances. Against the pre-change addon the same file fails 4 of 5 (mutation check).Evidence
Cook-level, RTX 3060, 320x240, 4 samples, six 40,000 triangle meshes plus a 4,000 triangle mesh that changes every frame, 8 frames:
updateupdateitself is 16.5 msAt 56,000 triangles a new session already costs only about 17 ms and
update4.5 ms, so Cook's share of the 0.3 to 0.6 s per frame in crucible#1786 is small; crucible's own export of the whole scene each frame (0.12 to 0.15 s inrun-video.mjs) is the larger part and is not changed here. With this Cook build the crucible video route for the particle scene changes fromnew-sessiontoupdatedfor frames 1 to 5 (updateSeconds0.004 to 0.007 s).