SpriteBatch batch size limit and flush frequency across DirectX and OpenGL backends
0 reputation · 10 Sept 2022, 07:17 UTC
Goal: Find a SpriteBatch batch size that reduces the number of End‑induced flushes per frame while staying within the GPU’s vertex‑buffer capacity on Windows DirectX, Linux/macOS OpenGL, and any other supported MonoGame backend.
Constraints: The developer must query GraphicsDeviceCapabilities.MaxVertexCount to avoid exceeding hardware limits, and must consider that SpriteSortMode settings can still cause flushes unrelated to vertex count. The exact flush frequency may vary between the DirectX and OpenGL implementations due to internal driver handling, making it unclear whether a uniform batch size yields consistent performance gains across platforms.
What is the highest batch size that can be safely used on each platform without triggering vertex‑buffer overflow?
How does the measured flush count per frame change when the batch size is increased from the default 2048 vertices to values such as 4096 or 8192 on DirectX versus OpenGL backends?
Does increasing the batch size affect rendering correctness or introduce any hidden overhead beyond the reduced flush frequency?