Add support for pristine buffer in bob manager #235
+229
−172
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.
Description
Adds optional support for using pristine buffer for bob undraw.
This is enabled by setting the
ACE_BOB_PRISTINE_BUFFER
CMake switch to ON.Motivation and Context
Although the current undraw technique could be used in memory efficient manner, it introduced extra performance cost by needing to store the background beneath each bob, each frame. Also, having multiple optional bobs can cause it to use excessive memory for its undraw buffer.
The pristine buffer approach assumes that there's a third buffer with always up to date background, which can be used for undraw and skipping the background store phase. This gives huge performance boost when there's a lot of bobs in use.
In order to make the code as fast as possible, it is a compile-time switch backed by a define. This makes the code quite sliced up and hard to read, but I don't think there's any other reasonable way around it.
How Has This Been Tested?
Performance comaprison
Bars under thumbnail show the cpu/blitter usage, smaller is better.
Chaos Arena perf before pristine:
Chaos Arena perf after pristine:
Types of changes
bobReallocateBgBuffers()
becamebobReallocateBuffers()
.Checklist