UIRenderer Recommendations#

There are a couple of important points to consider when rendering with UIRenderer.

  • For Vulkan, reuse the command buffer of the sprite. Even if the text or the image is changed, it is unnecessary to re-record the command buffer unless the actual sprite objects rendered changed. UIRenderer uses indirect drawing commands to make it possible to even change the text without re-recording.

    • For example, if the colour and position of a sprite is changed, the command buffers do not need to be re-recorded.

    • If the actual text of a text element is changed, the command buffers do not need to be re-recorded.

    • If text is removed from a container, or new text is added, the command buffers do need to be re-recorded.

  • Only call commitUpdates() when all changes to a sprite are done. In some cases, especially if text length increases, this operation can become expensive. For example, VBOs may need to be regenerated.