Is GUI.AdvancedDynamicTexture auto-batch different textures?

I just tried to add one more GUI.Image texture and suddenly it looks like it was successfully batched in one draw-call. Looks like a magick to me. Or am I missing something?
Here is: playground

Here is how I added the second texture:

var image = new BABYLON.GUI.Image("but", "textures/grass.png");
image.width = 0.2;
image.height = "40px";
advancedTexture.addControl(image);    
    
var image2 = new BABYLON.GUI.Image("but2", "textures/fire.png");
image2.top = 100;
image2.width = 0.2;
image2.height = "80px";
advancedTexture.addControl(image2); 
Draw calls before I added a second image: 3
Draw calls after: 3

The second texture didn’t add additional draw call. Looks like it automatically batches new textures? Or am I should use spritesheets created by my own for GUI images? I didn’t find any info on that.

The trick is that they are not texture :slight_smile: GUI is purely based on canvas2D manipulation so each image you’re adding as simply copied (using CPU) to a unique texture

But how do they batch if they are different unique textures? Or in some cases they will not be batched?

the unique texture is the advancedTexture, it is a canvas and the GUI.Image renders on it before the actual rendering on screen

2 Likes