Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pristine buffer in bob manager #235

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tehKaiN
Copy link
Member

@tehKaiN tehKaiN commented Dec 14, 2024

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?

  • Tested for scroll-/tilebuffer by modifying the Battle Squadron 2 codebase - needed to add allocating pristine bitmap, adding drawing tiles to pristine on tilebuffer tile draw callback, and that's basically it
  • Tested in Chaos Arena for simple buffer scenarios - code is synced to latest ACE and pristine buffer is compile-time togglable for comparisons.

Performance comaprison

Bars under thumbnail show the cpu/blitter usage, smaller is better.
Chaos Arena perf before pristine:
obraz
Chaos Arena perf after pristine:
obraz

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change) - minor function rename - bobReallocateBgBuffers() became bobReallocateBuffers().

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation. None, because there's no bob docs yet HE HE HE...
  • I have updated the documentation accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant