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

Armotize cpu drawcalls #807

Merged
merged 3 commits into from
Sep 12, 2024
Merged

Conversation

InnocentusLime
Copy link
Contributor

Synposis

The cost of breaking the batching in macroquad is too big:

  • Each unbatched call creates a 410kb sized buffer on the CPU
  • Each unbatched call creates a new buffer on the GPU

This PR aims to eliminate the big allocations on the CPU side of things to reduce the code of breaking the batching.

The fix is based on the assumption that a ~1mb sized batch is very rare and that most of that 1mb is unused space.

The implementation

Instead of using a buffer per draw call, the implementation uses a big contigious buffer. Each DrawCall instead stores (start, len) in that buffer, essentially acting as a slice

@not-fl3
Copy link
Owner

not-fl3 commented Sep 12, 2024

Thanks for PR, great work!

@not-fl3 not-fl3 merged commit 3c543fe into not-fl3:master Sep 12, 2024
5 of 6 checks passed
@InnocentusLime InnocentusLime deleted the armotize-cpu-drawcalls branch September 23, 2024 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants