Vixen
02b45cc4
csharp
public sealed class SceneRenderHost

A render system, a compositor and a device, joined into a frame.

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

Remarks

The link every path was missing. Every piece of drawing a frame existed and was tested — features extract, a document builds a compositor, a graph aliases and orders the passes, a command list executes them — and nothing outside a test project put them together. new RenderSystem() appeared only in tests; the samples opened a device and issued draws directly. This is that assembly, and it is deliberately small: what it adds is the order, which is the only part a host can get wrong silently.

It does not run the render system's phases, and that is the thing about it worth reading twice. The obvious host extracts, culls, prepares and sorts, and then builds the graph — and that is wrong twice over. GraphicsCompositor.Build already collects the frame's views and calls Draw itself, because the views come from the compositor's own nodes and culling before they are collected culls against the previous frame's. A host that did it anyway would extract every feature twice per frame: a correct-looking frame, and a renderer that profiles as mysteriously half as fast.

So what is left is three calls in an order — reset the graph, build it, execute it into a list the caller owns. This opens no command list and submits nothing, because when a frame is submitted and what it is submitted with is the application's business.

It does not own the device or the effect system. A device outlives a frame and may be lost and recreated under a host that has its own opinions about swapchains; an effect system is shared with everything else that compiles a shader. What this owns is the render system, the graph's transient pool and the compositor it built.

Fields and properties (7)

  • public RenderSystem System

    The scene's side of the frame: the features, the objects and the views.

  • public EffectSystem Effects

    Where variants are compiled.

  • public RenderGraph Graph

    The graph the compositor builds into, and its transient pool.

  • public CompositorBuilder Builder

    What turns a document into nodes, and what a host hands its device-owned resources to.

  • public GraphicsCompositor? Compositor

    The compositor the last Load built, or null.

  • public Int2 FrameSize

    How many pixels the frame covers.

  • public int FrameCount

    How many frames Draw has recorded.

Methods (5)

  • public SceneRenderHost(IGraphicsDevice device, EffectSystem effects)

    Sets up a host on a device.

  • public void Load(GraphicsCompositorAsset asset)

    Builds the frame a document describes.

  • public void Import(string name, ImportedTexture texture)

    Lends the frame a texture the host owns.

  • public bool Draw(ICommandList list)

    Records one frame.

  • public void Dispose()

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

Used by (10)

  • ArenaThirdPersonShooter
  • ArenaFrameThirdPersonShooter
  • ArenaIlluminationThirdPersonShooter
  • VirtualGeometryGameVirtualGeometry
  • AppGraphicsVixen.App.Hosting
  • SceneRenderHostTestsVixen.Engine.Renderer.Tests
  • VirtualGeometryDeviceTestsVixen.Graphics.Golden.Tests
  • WorldRendererVixen.Engine.Renderer
  • WorldRendererTestsVixen.Engine.Renderer.Tests
  • HostedRendererTestsVixen.App.Tests