Vixen
dd8b0a81
csharp
public sealed class AppGraphics

The device, the swapchain and the world's frame, owned by the host.

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

Remarks

The step the host stopped one short of. WorldRenderer was the whole join between a world and a drawn frame — the standard features, the shared geometry, the extraction systems, a SceneRenderHost — and nothing outside a test project constructed one, so every sample opened a device and issued draws by hand and none of them was a game. This is that object put in VixenApp.Run's way, together with the two things it deliberately does not own: a device, and a swapchain to present it through.

What it decides is an order, which is the part a host gets wrong silently. The swapchain image is lent to the frame under a name before the compositor builds, because a graph culls a pass whose target nobody outside it reads; the camera's aspect ratio is set when the swapchain is sized rather than when the frame is drawn, because extraction has already run by then; and the world is drawn before OnRender is offered the same command list, so an application's own passes land on top of the scene rather than under it.

Every step is a public method on a public object. docs/plan/17's rule that nothing in the boot path is inaccessible applies here as much as to the loop: a head that wants two windows, a different swapchain, or a frame recorded into somebody else's command list builds this itself and calls Begin and End where it likes — or skips it and uses WorldRenderer directly, which is all this does.

Fields and properties (22)

  • public IGraphicsDevice Device

    The device everything here lives on.

  • public DebugDraw? Debug

    The one accumulator every subsystem's debug geometry goes into, or null when Overlays is off.

  • public DiagnosticOverlays? Overlays

    The registry of diagnostic panels, or null when the overlays are off.

  • public ConsoleCommands? Console

    What the console runs, or null when the overlays are off.

  • public EffectSystem Effects

    Where variants are compiled or looked up.

  • public WorldRenderer Renderer

    The world's frame: the features, the geometry, the extraction and the host.

  • public RenderView View

    The view the scene's camera fills.

  • public CameraExtractionSystem Camera

    What fills it from the world.

  • public WaterZoneSystem Water

    The scene's water: the zones, their fields, and the one water clock.

  • public WaterClockSystem WaterClock

    What advances the water clock, in EarlyUpdate, before anything reads it.

  • public PostProcessVolumeSystem Volumes

    The post-process volumes the camera is inside, folded into one overlay.

  • public RenderStageMask Stages

    Which stages the world's drawables are extracted into.

  • public RenderStageMask StaticStages

    Which stages a drawable claiming to be static goes into instead, or none.

  • public RenderStageMask CasterStages

    Which of the extracted stages draw shadows, or none.

  • public RenderStageMask ParticleStages

    Which stage the scene's particle emitters are drawn in, or none.

  • public ISwapChain? SwapChain

    The swapchain, once one has been built.

  • public ICommandList? Commands

    The frame's command list, open only between Begin and End.

  • public bool IsLost

    Whether the device has gone and nothing more will be drawn.

  • public int FrameCount

    How many frames have been recorded.

  • public GpuFrame GpuFrame

    The most recent frame whose passes the GPU has finished timing.

  • public static GraphicsCompositorAsset DefaultFrame

    The frame a project gets before it authors one: one lit pass, into the window.

  • public string? LastCapturePath

    Where the last capture was written, or if there was none.

Methods (10)

  • public AppGraphics(IGraphicsDevice device, GraphicsOptions options, IWindow? window, AssetManager? assets, EffectStore? shaders, EngineLoop? engine, ILoggerFactory logs, bool ownsDevice = true, JobScheduler? jobs = null)

    Builds the frame a world is drawn through.

  • public bool Begin()

    Opens the frame: acquires an image, lends it to the document, draws the world.

  • public bool RequestCapture(string name)

    Asks for the next frame that finishes to be written as a picture.

  • public void End()

    Closes the frame: submits it and presents.

  • public void Recreate(bool force = false)

    Rebuilds the swapchain for the window's current size, if it has changed.

  • public static Int2 FramebufferOf(IWindow window)

    The window's framebuffer size, never zero in either axis.

  • public static ISwapChain SwapChainFor(IGraphicsDevice device, IWindow? window, GraphicsOptions options)

    Creates the swapchain a device presents through.

  • public void Suspend()

    Drops the swapchain, for a platform that has taken the surface away.

  • public void Dispose()

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

  • public void AdvanceDebug(float seconds)

    Ages the frame's debug geometry, which a host does itself and after the frame is recorded.

Used by (18)

  • AiVillageGameAiVillage
  • ArenaThirdPersonShooter
  • ArenaIlluminationThirdPersonShooter
  • PbrShowcaseGamePbrShowcase
  • ThirdPersonShooterGameThirdPersonShooter
  • AppBuilderVixen.App.Hosting
  • AppServicesVixen.App.Hosting
  • VixenApplicationVixen.App.Hosting
  • AppBackendTestsVixen.App.Tests
  • DeviceLossTestsVixen.App.Tests
  • FrameCaptureTestsVixen.App.Tests
  • GraphicsHostVixen.App
  • HostedOverlayTestsVixen.App.Tests
  • HostedRendererTestsVixen.App.Tests
  • LayeredGameVixen.App.Tests
  • RecordingGameVixen.App.Tests
  • TestAppVixen.App.Tests
  • TestAppTestsVixen.App.Tests