Vixen
02b45cc4
csharp
public sealed class UiRenderer

Draws a frame of interface geometry.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Everything above this is a pure function of a draw list and is tested without a device. This is where that stops: buffers, pipelines, an atlas texture and a scissor rectangle. It is kept separate from UiRenderFeature so that the part that actually touches a device can be driven by a golden image without a RenderSystem — which is the only way to find out whether the shaders agree with the geometry.

⚠ Three pipelines, one vertex layout. They differ only in the fragment stage, so a frame binds a different pipeline per batch kind and never a different buffer. That is what makes a frame one upload however many kinds of thing it draws.

⚠ Host-visible buffers, rewritten every frame, and no staging copy. The usual advice is the opposite — upload through a staging buffer into device-local memory — and it is the wrong advice here. That advice is about data the GPU reads many times; interface geometry is read once, by one draw, and then thrown away. A staging copy would add a transfer and a barrier to save nothing.

Fields and properties (5)

  • public int Draws

    How many draws the last Record submitted.

  • public int ImageSets

    How many descriptor sets registering images has ever allocated.

  • public int AtlasUploads

    How many times the atlas has been copied to the GPU.

  • public int Regions

    How many frames' worth of geometry the buffers hold at once.

  • public int Region

    Which of them the last Upload wrote.

Methods (6)

  • public UiRenderer(IGraphicsDevice device, UiShaders shaders, RenderOutput output)

    Builds the pipelines a UI pass needs.

  • public void Upload(ICommandList commands, in UiGeometry geometry, GlyphAtlas atlas)

    Puts this frame's geometry where the GPU can read it. Called outside a render pass.

  • public void Record(ICommandList commands, in UiGeometry geometry, Int2 surface, float scale = 1)

    Records the frame. Called inside a render pass.

  • public void RegisterImage(ulong image, TextureViewHandle view)

    Names a texture, so a draw list can ask for it.

  • public bool UnregisterImage(ulong image)

    Forgets a texture.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (9)

  • UiHostHelloUi
  • UiFrameLifetimeTestsVixen.Graphics.Golden.Tests
  • UiImageTestsVixen.Graphics.Golden.Tests
  • UiRenderFeatureVixen.Ui.Renderer
  • VideoInUiTestsVixen.Video.Rendering.Tests
  • EditorHostVixen.Editor.Host
  • EditorPaneVixen.Editor.Host
  • ScenePresenterVixen.Editor.App
  • ThumbnailSurfaceVixen.Editor.App