Vixen
02b45cc4
csharp
public sealed class DebugDrawRenderer

Draws a frame's DebugDraw: the world geometry every subsystem has been producing, and the diagnostic overlays on top of it.

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

Remarks

The half of DebugDraw that was owed since Phase 2. The accumulator has been collecting lines from physics, navigation and anything else that wanted to show its working, with nothing to draw them; this is what drains it. A subsystem written against the accumulator needs no change to become visible.

Two LineRenderers, and they are not interchangeable. One draws the world with the view-projection and, by default, the depth test — so a collider behind a wall is behind the wall. The other draws the screen with a pixel-to-clip matrix and never has a depth test, because an overlay that could be occluded by the scene is an overlay that disappears exactly when something has gone wrong in front of it.

⚠ Upload writes buffers and must be called outside a render pass. Vulkan forbids a transfer inside one, which is why ScenePresenter and UiRenderer both upload before their pass is declared rather than in it.

⚠ Nothing here ages the geometry. DebugDrawSystem does, in PostRender — after this has drained. Calling Advance before a frame is recorded is how a line asked for during that frame is never seen.

Fields and properties (6)

  • public bool DepthTested

    Whether world geometry is hidden by scene geometry in front of it.

  • public int WorldCount

    How many world vertices the last upload held.

  • public int ScreenCount

    How many screen vertices the last upload held.

  • public int Dropped

    How many vertices the last upload dropped for want of room, across both buffers.

  • public int LabelCount

    How many labels the last upload turned into strokes.

  • public int Draws

    How many draws the last record issued: zero, one or two.

Methods (5)

  • public DebugDrawRenderer(IGraphicsDevice device, LineShaders shaders, RenderOutput output, int worldCapacity = 65536, int screenCapacity = 65536)

    Builds the two pipelines a frame's debug geometry is drawn with.

  • public void Upload(DebugDraw draw, in Matrix4x4 view, Vector2 viewport)

    Builds a frame's vertices and writes them into the next region of each ring.

  • public void Record(ICommandList commands, in Matrix4x4 viewProjection)

    Draws what the last upload wrote.

  • public void RecordScreen(ICommandList commands)

    Draws only the screen-space half — the overlays, with no camera involved.

  • public void Dispose()

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

Used by (1)

  • DebugDrawImageTestsVixen.Graphics.Golden.Tests