Optimizing Draw Call Batching Using Transient Data-Guided Texture Atlases
Summary
Rendering a large number of 2D textures in real-time requires reducing the overhead of a large number of draw calls on the CPU caused by binding different textures when drawing. Texture atlases are used to avoid switching textures by packing textures into one larger texture before rendering. Graphics hardware APIs limit the size of a texture, so textures need to be partitioned into multiple atlases. Unfortunately, composing textures into atlases is performed manually by developers or artists with an educated guess and requires manually checking which texture switch breaks a draw call batch to improve batching. Manual composition of texture atlases is cumbersome, time-consuming and not optimal for large-scale and unpredictable use of textures. We automated the composition of atlases based on previously gathered texture rendering data to remove manual intervention and created transient texture atlases at run-time based on usage to optimize draw call batching. We applied our approach to four simulations and measured the number of draw calls, CPU frame time and GPU frame time. The number of draw calls is similar or less for data-guided texture atlases than for manually composed texture atlases. Transient data-guided texture atlases reduce the number of draw calls significantly for unpredictable use of textures, which leads to performance gains on the CPU.