public sealed class UiWindowSurfaceOne window's half of a frame: a swapchain, a renderer and the geometry between them.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
One of these per surface, which is one per window. The document lays out and draws every surface in one pass — see UiSurface — and what cannot be shared below that is everything with a swapchain image in it: the window's own extent, its own scale, its own vertex data.
⚠ A UiRenderer each, rather than one shared between the windows. The renderer rings its vertex and box buffers across the device's frames in flight and advances a region per Upload — so two uploads in one device frame consume two regions, and after as many frames as there are regions the second window would be writing over geometry the GPU is still reading. Sharing it is a validation-clean way to draw yesterday's frame. Two renderers cost two sets of pipelines, which an application with a torn-off panel or two can afford and a corrupted frame is not.
⚠ It exists without a device, and that is what keeps --frames honest. On a machine with no Vulkan the surface is still laid out, still drawn and still turned into vertices; only the presenting is missing. A surface that came into existence with a swapchain would make a headless run prove nothing about the window it never opened.
This is Vixen.Editor.App's EditorPane, which was the only one of the three copies of the frame loop that had all of the above. The other two — Samples/02 and the vixen-app template — held the swapchain in the host itself, so neither could open a second window and neither cached its tessellation.
Fields and properties (12)
public UiSurface SurfaceThe part of the document it shows.
public IWindow WindowThe window it presents to.
public bool IsPrimaryWhether this is the application's main window.
public ISwapChain? SwapChainWhat the swapchain presents through, once there is something to present to.
public UiRenderer? RendererThis window's own vertex buffers, pipelines and atlas texture.
public UiGeometryBuilder GeometryTurns this window's draw list into vertices.
public UiGeometry FrameThis frame's vertices.
public TextureViewHandle AcquiredThe image this frame is being drawn into, while there is one.
public bool IsDrawingWhether this surface has an image and has recorded into it.
public float ScaleHow many physical pixels one device-independent one is here, never zero.
public Rectangle ExtentThe window's client area in the units the document is laid out in.
public Int2 ViewportThe extent in the whole pixels a projection and a scissor are computed from.
Methods (6)
public UiWindowSurface(UiSurface surface, IWindow window)Joins a document's surface to the window that presents it.
public bool Ensure(IGraphicsDevice device, UiShaders shaders)Builds the swapchain and the renderer, once there is a surface to present to.
public bool Tessellate(GlyphFieldCache glyphs)Turns this window's draw list into vertices, or keeps the ones it already has.
public void Recreate(IGraphicsDevice device, bool force = false)Rebuilds the swapchain for the window's current size.
public bool? Acquire(IGraphicsDevice device, out TextureViewHandle view)Takes the next image, rebuilding once if the swapchain has gone stale.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (2)
- UiApplicationVixen.Ui.Desktop
- EditorHostVixen.Editor.Host