Yes in general performance is a still a big area of focus for UI Toolkit.
As a general note, each PanelSettings instances are not batched together, but multiple Visual Elements and multiple UI Documents can as long as they belong to the same PanelSettings.
Yes trying to minimize the number of batches to draw UI was the main focus of the UI Rendering strategy for UI Toolkit.
Compared to UGUI which offers the flexibility of customizing the UI shader, UI Toolkit has a single uber-shader for the whole UI.
By integrating the core bits of Text Mesh Pro in core Unity (TextCore), the same shader can also draw text so this doesn’t qualify as a batch breaking reason right now (text vs. non-text element).
UI Toolkit supports both static Sprite Atlases and has Dynamic Atlas feature (one large texture per PanelSettings). The Dynamic Atlas is populated as elements are added.
Some of its behaviour can be configured in the Dynamic Atlas Settings of the Panel.
As an aside, the UI Toolkit shader has 8 texture slots which can be bound dynamically (for example 1 dynamic atlas, 1 SpriteAtlas, multiple single textures). In 2022.1, font atlas textures can also be part of this dynamic slots, whereas there is only a single font texture slot in 2021 LTS.
It depends what you mean by “update”. But one thing that UI Toolkit does is that it doesn’t need to combine geometries together to enable batching. Instead, pages of vertices/indices are pre-allocated and ranges of these pages are allocated as needed for each element. This allows the geometry to be contiguous on the GPU to allow drawing multiple elements as once.
When an element changes, we just “update” the range for the VisualElement so we don’t need to re-combine the geometry.
Additionally one can use the UsageHints on specific elements to enable some transformations be done on the GPU directly (like moving vertices).
We know all of this information isn’t properly documented, I expect our documentation be updated before end of year about this.
In pratice though, any non-trivial UI will actually incur more than 1 draw calls, because:
- the geometry extends the maximum size for a specific page
- using UsageHints presents a tradeoff between CPU cost and batch breaks
- usage of masks changes the stencil buffer which leads to batch breaks
But in practice what we observe is that keeping the same material and just drawing a different range with a few different settings is less expensive that reconfiguring the whole GPU state.