SpriteBatch internals question


Imagine I have two Texture2D: “A” and “B”; In SpriteBatch I draw “A” , then “B”, then “A” again. I’m using Deferred mode. Am I wrong if I think that this, at the end of the process, results in 3 draw calls?

Is there a way to know how many draw calls are being used per frame? I think there was an ongoing subproject to compute them, but I’ve been away from MonoGame for quite a long time and I’m unable to find it.


You can use GraphicsDevice.Metrics.DrawCount to see how many draw calls there are per frame.

With SpriteBatchMode.Deferred enqueued sprites are not sorted before processed. The behaviour is a first in first out (FIFO) queue where any change in texture forces a separate draw call. If you want to minimize draw calls consider using a texture atlas so all your sprites use one large texture or use SpriteBatchMode.Texture.