rendering: retain prepared instance submissions - #80
Open
tritao wants to merge 2 commits into
Open
Conversation
tritao
force-pushed
the
stack/retained-instance-data
branch
from
August 23, 2026 21:21
4d57b02 to
90bdafb
Compare
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.
Builds on #75.
Purpose
The retained renderer already keeps geometry and render plans alive between
frames, but its instanced submission data was still rebuilt and uploaded in
full on every update. This made a small edit in a large repeated assembly much
more expensive than the edit itself: moving one occurrence could require
reprocessing every occurrence before drawing the frame.
This PR keeps the prepared visual instance batches and their OpenGL buffers
alive for as long as their render-plan membership remains valid. A transform
or legacy diffuse-color edit can then update only the instance records for the
commands that actually changed.
The optimization is deliberately conservative. The draw list publishes only
the most recent committed command patch. If the backend missed that revision,
or if the plan, resources, visibility, or an unsupported part of the scene
changed, it refreshes or rebuilds the affected data instead of assuming that
the cached batches are still correct.
Picking and selection continue to use their own transient instance buffer, so
this does not change their ordering or identity semantics.
What changed
proven safe.
the existing opt-in renderer statistics and benchmark JSON.
recreation.
Performance
The representative case is a staged assembly with 50,000 occurrences, where
one occurrence moves per sample. On the pinned 5.4 GHz performance core:
The optimized path still submits 40 draw calls, does not rebuild the retained
frame, and produces the same pixels as a forced rebuild.
These are comparison measurements from one controlled machine, not CI timing
thresholds. The counters and output parity are the deterministic performance
contract.
Validation
-j12and all 34 CTest tests.visibility changes with periodic picking and forced-rebuild comparisons.