perf(mesh): skip immutable index re-upload on RT refit UPDATE (#68) #103
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-68"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Mesh::Refitre-uploaded the index buffer on the UPDATE path — one extra memcpy +FlushDevice+ barrier of immutable index data per refit. This is genuinely per-frame work for deforming meshes.Fix
A hardware acceleration-structure UPDATE cannot change topology, so the index buffer contents are immutable on the UPDATE branch. The index memcpy and its
FlushDeviceare skipped;RecordBLASBuildstill reads the stable, unchangedindexBuffer.address. Theindiciesspan is now consumed only for its element count.The full-rebuild fallback path (no allowUpdate, or topology changed) still re-uploads both buffers, unchanged.
Correctness note
This slightly tightens the documented contract: a bitwise-different but topologically-equivalent index array passed on refit is now ignored. That is consistent with the existing documentation that a refit "may only move vertex positions, not change connectivity." The interface doc comment is updated to spell this out.
Testing
crafter-build test— 19 passed, includingBLASBuildOptions, which exercises the triangle Refit UPDATE path and asserts the AS handle + blasAddr stay stable across refit.Resolves #68