Repository navigation
Reuse unchanged region draw batches and merge adjacent commands - #581
Open
BonsUnleashed wants to merge 1 commit into
Open
BonsUnleashed wants to merge 1 commit into
BonsUnleashed wants to merge 1 commit into
Conversation
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.
Proposed Changes
Terrain rendering rebuilds a region's draw commands even when its mesh data, visible sections and camera-facing tests have not changed. This keeps the last two command lists per region and terrain pass, allowing the main view and a shadow view to reuse their own entries.
Storage mutations invalidate both entries. Accessing the existing writable pointer permanently disables caching for that storage, including retained pointers; the renderer uses an explicit read-only accessor. Keys include section order, pass flags, culling and exact camera face-test results. Cache hits copy only active commands.
Adjacent commands using the shared quad index buffer can also merge when their vertex ranges touch. Triangle order stays unchanged. Merging remains disabled with shader packs because per-draw shader inputs may depend on command boundaries.
This follows work prepared for Bons and Furious 1.0.30. Native compilation passed, followed by roughly 25,000 checks using the compiled renderer and native buffers: command/index equivalence, camera boundaries, two-view reuse, storage mutations, retained writable pointers and sorted/shader fallbacks. The test uses a shader-state shim; it does not render a frame. These results verify command behavior and do not establish an FPS gain.