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

Rework main pool alloc to support fragmented buffer. Move zbuffer & fb to different memory banks #737

Open
wants to merge 10 commits into
base: develop/3.0.0
Choose a base branch
from

Conversation

aglab2
Copy link
Collaborator

@aglab2 aglab2 commented Dec 16, 2023

Moves zbuffer and framebuffer to separate memory banks. To implement this, alloc only pool was removed and replaced with main pool instead that supports fragmented memory. Fragmented pool is not using double linked list and is built very similarly to alloc only pool.

Saves 0.5 fps in JRB.
example

@aglab2
Copy link
Collaborator Author

aglab2 commented Dec 16, 2023

Updated PR with splitting FBs to each own memory bank with USE_EXT_MEM. Saved another 0.5f
image

@gheskett gheskett added questionable This is risky or potentially invalid or undesirable performance Issue or feature related to game performance labels Dec 17, 2023
@gheskett gheskett added this to the 2.2 milestone Dec 17, 2023
@gheskett gheskett added the monkaS monkaS label Dec 17, 2023
@arthurtilly
Copy link
Collaborator

Things that need to be done:

  • Make the defines clearer to the average user - ideally slightly less technical and not using magic numbers as each setting. Having fewer settings (only the ones that are necessary) would also be nice.

  • Remove config_memory_private.h

  • Ensure that puppyprint ram usage displays are still entirely accurate

@aglab2
Copy link
Collaborator Author

aglab2 commented Dec 17, 2023

Need to add better documentation for main_pool_ functions to clearly state their benefits compared to alloc only pool

@arthurtilly arthurtilly modified the milestones: 2.2, 3.0 Dec 17, 2023
@aglab2
Copy link
Collaborator Author

aglab2 commented Jan 9, 2024

Finished documentation for main pool allocator. I have also profiled level loads - I have implemented fast path for main_pool_alloc that will be inlined to avoid random slowdowns on level startup.

3.0:
castle inside: 103423 105440 106329 102889 103430
castle grounds: 42575 48902 51084 55313 54764
bob: 71654 70644 70339 70760 71486

3.0 new main pool:
castle inside: 106152 106099 104109 104368 103311
castle grounds: 48520 44482 43405 45028 41257
bob: 70940 70981 70684 70690 71391

I also fixed other issues noted in @arthurtilly comment, code is ready for another round of review

@gheskett gheskett requested a review from arthurtilly September 5, 2024 05:02
@gheskett
Copy link
Collaborator

gheskett commented Jan 6, 2025

Any chance the z buffer could be moved back to the start of RAM, FB0 to the end of the code segments, and FB1/FB2 bordering 0x80700000? Unless I'm misunderstanding, this would come with the same performance benefits with the least fragmentation necessary. (Map packer loading to 0x80700000 may not be ideal here.)

@aglab2
Copy link
Collaborator Author

aglab2 commented Jan 7, 2025

I used such combination of memory buffers in one of my hacks, I can add it as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monkaS monkaS performance Issue or feature related to game performance questionable This is risky or potentially invalid or undesirable
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

3 participants