Vulkan Fails to Batch 2D Sprites into a Single Draw Call

Godot Version

4.3.dev2 (also noticed in 4.2.1)

Question

I’ve been experimenting with adding multiple instances of the default Godot logo as a sprite in my scene. My understanding was that using the same sprite multiple times should only necessitate a single draw call. Surprisingly, I’m observing that the number of draw calls corresponds to the number of sprites. Is this behavior expected?

I’ve noticed the same pattern when using the same object in a tilemap. However, an interesting shift occurs when I switch the project’s rendering mode from Forward+ (or Mobile) to Compatibility: it then batches the rendering into a single draw call as I initially expected.

This issue isn’t new; I observed the same behavior in version 4.2.1, as confirmed by measurements taken with the RenderDoc tool.

2D batching is not implemented in Vulkan (forward+/mobile) renderers.

2 Likes

Hey @mrcdk, thanks again for your response! :slight_smile:

I’m curious about the rationale behind this decision. Please don’t get me wrong; I’m just looking to understand the situation better. Is the absence of 2D batching in Vulkan’s renderers due to a specific characteristic of Vulkan, or perhaps a consensus that it’s not a priority for development at this time? Or is it something that’s currently being worked on?

I think the reason was that Vulkan does not need it as much as OpenGL but I don’t know the specifics. Sorry.

That’s fine, thanks anyway.
On Reddit, people pointed me this documentation saying that “draw calls are much cheaper with Vulkan compared to OpenGL”.

Vulkan 2D batching is planned to be implemented at some point (as it helps reduce CPU overhead and power consumption), but we can’t give an ETA as nobody is currently working on this.

1 Like

Batching has been added via Add batching to `RendererCanvasRenderRD` by stuartcarnie · Pull Request #92797 · godotengine/godot · GitHub which should work with your case. Let us know how you get on!

1 Like