Vixen
02b45cc4
csharp
public sealed class GlDevice

The graphics device over an OpenGL context.

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

Remarks

ADR-001's abstraction validator. D3D12 is postponed past 1.0 and this backend inherits its job: proving the RHI is API-neutral rather than a Vulkan wrapper with the serial numbers filed off. It is a harder test than D3D12 would have been, because GL is further away in every direction that matters — no pipeline objects, no descriptor sets, no explicit barriers, no multithreaded recording, and a clip space the other way up.

Every one of those is answered in a named place rather than smeared through the device: GlProgramCache and GlStateCache for pipelines, GlBindingPlan for descriptor sets, Replay for barriers, GlCommandList for threading, and GlslTranslator for clip space. The findings are collected in docs/rhi-backend-mapping.md.

Threading. Every GL call happens on the thread that owns the context, which is the thread that constructs the device and the thread that submits. Command lists are recorded anywhere.

Deferred destruction is free here. The RHI requires that destroying a resource an in-flight frame still references be safe. GL gives that for nothing: glDelete* unbinds the name and the driver keeps the object alive until nothing references it. That is one of the two places where GL's implicitness is an advantage rather than a tax.

Fields and properties (11)

  • public GlProfile Profile

    Which dialect this device drives.

  • public IGraphicsAdapter Adapter

    The adapter this device runs on.

  • public GraphicsDeviceFeatures Features

    What it can do.

  • public ICommandSubmitter GraphicsQueue

    The queue that can do everything.

  • public ICommandSubmitter ComputeQueue

    The compute queue, which is GraphicsQueue where the hardware has only one.

  • public ICommandSubmitter TransferQueue

    The transfer queue, which is GraphicsQueue where the hardware has only one.

  • public int FramesInFlight

    How many frames may be recorded before the first has to have finished.

  • public long FrameCount

    How many frames BeginFrame has started.

  • public int LiveResourceCount

    How many resources are alive, across every kind.

  • public int FramebufferCount

    How many framebuffer objects the pass cache holds.

  • public int ProgramCount

    How many distinct programs have been linked.

Methods (37)

Used by (9)

  • GlCommandListVixen.Graphics.OpenGL
  • GlCommandListTestsVixen.Graphics.OpenGL.Tests
  • GlDeviceTestsVixen.Graphics.OpenGL.Tests
  • GlReplayTestsVixen.Graphics.OpenGL.Tests
  • GlStateCacheTestsVixen.Graphics.OpenGL.Tests
  • GlSubmitterVixen.Graphics.OpenGL
  • GlSwapChainVixen.Graphics.OpenGL
  • PipelinesVixen.Graphics.OpenGL.Tests
  • GraphicsHostVixen.App