Skip to content

Static Sprite Batching #181

@Syncaidius

Description

@Syncaidius

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    rendererAn issue relating to the render pipeline

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions