Draw Calls
Nova makes heavy use of GPU instancing to render content in as few draw calls as possible. However, the way you structure your content can impact how well Nova is able to batch it, and by avoiding certain situations you can reduce the number of draw calls required, as discussed below. For additional information on draw calls and GPU instancing, see the following resources:
Maintain Coplanarity
2D UIBlocks (i.e. UIBlock2Ds or TextBlocks) which lie on the same geometric plane in world space are called coplanar. Nova attempts to batch coplanar UIBlocks within a SortGroup and render them in as few draw calls as possible, while maintaining proper Render Order.
Put simply:
- Coplanar → Fewer Draw Calls
- Not Coplanar → More Draw Calls
In determining coplanarity, only the final world transformation of a 2D UIBlock is used. In other words, content with nested local rotations and/or offsets between two or more 2D UIBlocks can still be treated as coplanar, so long as the compound result of said transformations maintain coplanarity.
Warning
Offsetting 2D content along the Z
axis breaks coplanarity, incurring additional draw calls. Therefore, rather than modifying a UIBlock's Z
position, prefer the ZIndex property for simple render order adjustments.
See Render Order for more info.
Reduce Interleaving Content
Nova can only batch content of the same type into a single draw call.
Some examples of batchable content include (but are not limited to):
- TextBlocks using the same font
- UIBlock2Ds with an Inner Border
- Drop Shadows
- UIBlock3Ds using the same Lighting Model
When different types of content overlap but need to render in the order of TypeA
→TypeB
→TypeA
, the two TypeA
draw calls cannot be batched even if they meet all other criteria.
More concretely:
Render Order | # Draw Calls |
---|---|
TypeA →TypeA →TypeA |
1 |
TypeA →TypeA →TypeB |
2 |
TypeA →TypeB →TypeA |
3 |
Structuring your content in a way which minimizes these scenarios and selectively using certain features can substantially reduce the number of draw calls required to render your UI.