# Draw calls and Defold

**URL:** <https://forum.defold.com/t/draw-calls-and-defold/4674>\
**Category:** The Defoldmine\
**Created:** [January 31, 2017, 11:19pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674 "2017-01-31T23:19:50Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 25, 2018, 6:48pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/21 "2018-09-25T18:48:04Z")

</div>

Yeah, it’s in our roadmap. Not sure when we’ll tackle it, but if I’m guessing it’s somewhere in December or January.

---

<div class="post-metadata">

**Author:** ![notbadgun](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/notbadgun/32/14901_2.png) [@notbadgun](https://forum.defold.com/u/notbadgun)\
**Post date:** [December 10, 2018, 6:27pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/22 "2018-12-10T18:27:40Z")

</div>

Hi! When are you planning on fixing the issue(batching tint and other)?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [December 10, 2018, 8:46pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/23 "2018-12-10T20:46:48Z")

</div>

We mentioned custom vertex formats in our most recent [Roadmap Post](https://forum.defold.com/t/defold-roadmap-2018-09-11/29071). We’re slightly behind in terms of what we had hoped to deliver by now due to in part some stability issues during the autumn and in part because of internal needs that was given higher priority. The roadmap post is still accurate, but I will post an update in beginning of January with some updates.

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [February 23, 2019, 3:59pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/24 "2019-02-23T15:59:24Z")

</div>

any news?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 23, 2019, 9:34pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/25 "2019-02-23T21:34:40Z")

</div>

News on custom vertex formats or on the roadmap (there was [a new roadmap post made in January](https://forum.defold.com/t/defold-roadmap-h1-2019/41406) as promised)?

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [February 25, 2019, 9:24am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/26 "2019-02-25T09:24:59Z")

</div>

News about this:

> [@Draw calls and Defold](https://forum.defold.com/t/draw-calls-and-defold/4674/17):
>
> If we could get the ability to set tinting / alpha with sprites in a way which didn’t break batching it would be super great.

as I understood “custom vertex formats” solve this.

> [@Draw calls and Defold](https://forum.defold.com/t/draw-calls-and-defold/4674/18):
>
> The answer to that is customizable vertex formats, which I think is on our roadmap for this second half of this year. (@britzl knows more)

---

<div class="post-metadata">

**Author:** ![Klear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/klear/32/11577_2.png) [@Klear](https://forum.defold.com/u/Klear)\
**Post date:** [August 18, 2020, 11:15am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/27 "2020-08-18T11:15:31Z")

</div>

I’d like to hear some clarifications on this amazing post, namely if and how the situation changes when using custom render predicates / materials / shaders, since if I understand it correctly, this guide assumes that the builtins are used everywhere.

Would different component types break batching if they were to use the same material? Or different materials but the same rendering predicate?

Do different materials break batching by themselves, or is it ultimately because they use different shaders?

Tint is explicitly said to break batching (as long as the values are not the same), but I assume this goes for any other custom constant I might be using, right?

Does this apply only to fragment shaders, or do different vertex shader constant values also break batching?

Thanks for any insight you can give me.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 18, 2020, 11:46am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/28 "2020-08-18T11:46:51Z")

</div>

The batch rules are documented here:

> **[Batch rules for non-GUI components - The render pipeline in Defold](https://defold.com/manuals/render/#batch-rules-for-non-gui-components)**
>
> Every object that is shown on screen by the engine: sprites, models, tiles, particles or GUI nodes, are drawn by a renderer. At the heart of the renderer is a render script that controls the render pipeline. By default, every 2D object is drawn with...

---

<div class="post-metadata">

**Author:** ![Klear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/klear/32/11577_2.png) [@Klear](https://forum.defold.com/u/Klear)\
**Post date:** [August 18, 2020, 12:36pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/29 "2020-08-18T12:36:45Z")

</div>

Ah, interesting. I didn’t realize the z level comes into play like it sort-of does in gui, but there it can be solved by layers.

So a tinted sprite on z level 0 will prevent batching of non-tinted sprites on levels 0.5 and -0.5, right?

I think I can save some draw calls in my current project when rendering a light map - I can group lights with the same tint on the same z level and put all the ones using other variable shader constants “aside” so they don’t break anything.

Thanks!

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [August 18, 2020, 2:23pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/30 "2020-08-18T14:23:29Z")

</div>

> [@Klear](#):
>
> I think I can save some draw calls in my current project when rendering a light map - I can group lights with the same tint on the same z level and put all the ones using other variable shader constants “aside” so they don’t break anything.

Also we can set few lights sources as constant\_buffer for whole predicate (‘tile’ for example) and then calculate light intensity in the sprite/other component shader.  
Or render lights into texture in renderscript and use it as lightmap texture in sprite shader, calculating tinting on sprite position within lightmap. So, this way prevents from setting tint to each sprites.

---

<div class="post-metadata">

**Author:** ![TheKing0x9](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/theking0x9/32/13588_2.png) [@TheKing0x9](https://forum.defold.com/u/TheKing0x9)\
**Post date:** [May 3, 2021, 7:58am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/31 "2021-05-03T07:58:11Z")

</div>

One part is still not clear to me - Why does the difference in shader constants break batching?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [May 3, 2021, 8:07am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/32 "2021-05-03T08:07:54Z")

</div>

> One part is still not clear to me - Why does the difference in shader constants break batching?

We need to send the shader constants (uniforms) before each draw call.

(Yes, there are uniform buffers, but we also still support older OpenGL versions. And uniform buffers don’t exist in OpenGLES)

---

<div class="post-metadata">

**Author:** ![TheKing0x9](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/theking0x9/32/13588_2.png) [@TheKing0x9](https://forum.defold.com/u/TheKing0x9)\
**Post date:** [May 4, 2021, 11:28am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/33 "2021-05-04T11:28:36Z")

</div>

It makes sense now. Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![leopthurler](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/leopthurler/32/40896_2.png) [@leopthurler](https://forum.defold.com/u/leopthurler)\
**Post date:** [October 10, 2025, 9:53pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/34 "2025-10-10T21:53:18Z")

</div>

Hello guys, there are a way to batch labels draw calls? Or each labels really need a individual draw call?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 11, 2025, 8:18am UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/35 "2025-10-11T08:18:16Z")

</div>

The labels are batched using their batchkey and distance to camera, just like sprites:

> <https://github.com/defold/defold/blob/dev/engine/gamesys/src/gamesys/components/comp_label.cpp#L154-L178>

---

<div class="post-metadata">

**Author:** ![leopthurler](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/leopthurler/32/40896_2.png) [@leopthurler](https://forum.defold.com/u/leopthurler)\
**Post date:** [October 11, 2025, 1:32pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/36 "2025-10-11T13:32:36Z")

</div>

I’m not sure about the reason why labels are not batching in my test.

My test consist in a world globe showing some cities name. Checking profile, it’s using 42 draw calls and when I remove labels with cities name it change to 6 draw calls, and when I remove cities markers sprites it goes to 5. So the sprites are batching but the labels don’t. I put some images bellow.

All the labels are using the same font with the same material, maybe the problem is about camera distance and labels size?

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/5/3/535868654854e25ea5fd915487c8efee1ebd21cc.jpeg)  
Test environment

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/9/b/9baba70e600c0365c0ef8f560373e2d9e5acfb88.jpeg)

Profile with labels

 ![dmengine_56Lw7LMoan](https://forum-defold-uploads.b-cdn.net/original/3X/8/a/8a2152b32c39816370523aa5cfff37e114ba2525.jpeg)

Profile without labels

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 11, 2025, 3:28pm UTC](https://forum.defold.com/t/draw-calls-and-defold/4674/37 "2025-10-11T15:28:30Z")

</div>

Do they have different colors? Or do you set some material constants?

Otherwise I’d recommend reproducing it in a test project and sharing it here and perhaps the community can help take a look.

[Previous page](https://forum.defold.com/t/draw-calls-and-defold/4674.md?page=1)
