Is there a Texture 2D Array limit on mobile?

I am interested in using Texture 2D Arrays for reducing draw calls in a mobile game, is there a limit on the amount of textures I can have on a single array? What is stopping me from having just 1 array with all textures I need inside (of the same size) for the entire game, so I have just 1 draw call for the entire game? Can I have 100 individual 1024 x 1024 textures in the same array or I should split on smaller arrays? I could not find documentation anywhere about this.

On mobile platforms, there are limitations on Texture 2D Arrays that you should consider. While they are useful for reducing draw calls by grouping textures, each mobile device has its own constraints. Typically, you can have multiple textures in a single array, but there are limits on the total size and number of textures due to memory and performance considerations.

Having just one array with all your textures sounds efficient, but it’s crucial to balance this with the device’s capabilities. For example, having 100 individual 1024 x 1024 textures in a single array might exceed memory limits on some devices or impact performance negatively.

It’s advisable to test and profile your game on various mobile devices to find the optimal balance between reducing draw calls and maintaining performance. While specific documentation on these limits can vary, experimenting with smaller arrays or alternative optimizations could be necessary based on your findings.

Hope it will be helpful for you.

1 Like

you should download a caps viewer app and check the GLES 3.2 or Vulkan caps. the average device can handle 2048 texture array layers. be aware that astc has variable compression ratio. so memory consumption varies. at default blocksize of 4x4 you look at 1.3 MB per 1k texture with a full mip chain. for 128 textures you’d look at 175 MB of data. multiply that by 2 or 3 for data layers for reflection, roughness, normals and custom data and you have a good estimate. it’s a bit of data and device graphics memory may be limited. hmm

edited: math error. sry.

1 Like

Regardless of arbitrary limits, the real constraint is that any texture that exists in a loaded array is also loaded. Therefore you can introduce a huge memory bottleneck by loading textures unesscarily.

A good practice would be to create arrays with texture that have a high probability of being loaded at the same time anyway.

For example, all of the foliage within a single biome/level could exist in an array. But putting foliage from another level or biome into that array would cause it to load even though it might never be on screen.

1 Like