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

Static Sprite Batching #181

Open
Syncaidius opened this issue Mar 5, 2023 · 0 comments
Open

Static Sprite Batching #181

Syncaidius opened this issue Mar 5, 2023 · 0 comments
Labels
renderer An issue relating to the render pipeline
Milestone

Comments

@Syncaidius
Copy link
Owner

Syncaidius commented Mar 5, 2023

Add support for a static sprite-batching, which would avoid the cost of repopulating a sprite-batch buffer every time you want to draw large amount of sprites.

  1. Split draw and batching methods of SpriteBatcher into a base class
  2. Add StaticSpriteBatcher
  3. Use a static vertex buffer instead of dynamic
  4. Add StaticSpriteBatcher.Replace() for replacing existing sprites in the buffer without re-generating it all
  5. Add StaticSpriteBatcher.ReplaceRange() for replacing a range of sprites at once
  6. During Render() call:
    • If batch was changed, update vertex buffer via a staging buffer
    • Draw in the same way that normal SpriteBatcher does, but don't reset sprite data once finished
  7. Add SpriteBatcher.FlushToStatic(StaticSpriteBatcher destination = null) to copy the current contents to a static sprite-batcher and flush without rendering
@Syncaidius Syncaidius added the renderer An issue relating to the render pipeline label Mar 5, 2023
@Syncaidius Syncaidius added this to the Release 0.8 - Dec23 milestone Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
renderer An issue relating to the render pipeline
Projects
Status: No status
Development

No branches or pull requests

1 participant