Vixen
02b45cc4
csharp
public sealed class WebGpuDevice

The WebGPU device: everything the RHI can do, done twice over.

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

Remarks

This class contains no WebGPU calls. It talks to IWebGpuBinding, which is native Dawn or wgpu on a desktop and navigator.gpu in a browser — the two surface implementations docs/plan/05 asks for. Translation, validation, handle lifetime and command replay are therefore written once and are identical on both, and all of it is testable against a fake binding on a machine with neither.

Handles index tables this object owns. Nothing here is finalisable and nothing is reference-counted by the collector: a GPU object's lifetime belongs to the renderer.

Destruction is deferred, and WebGPU makes that easy rather than hard. Releasing a WebGPU object drops a reference; the implementation keeps the object alive until the work that names it has finished, which is exactly the guarantee Vulkan does not give. The frame-delayed retirement below is therefore belt and braces rather than the load-bearing part — and it stays, because the RHI's contract is stated in frames and a backend that quietly relied on someone else's reference counting would be one binding upgrade from being wrong.

Fields and properties (9)

  • 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 const string EntryPoint

    The entry point every module the engine compiles exposes.

Methods (38)

Used by (8)

  • NativeWebGpuTestsVixen.Graphics.WebGPU.Tests
  • WebGpuCommandListVixen.Graphics.WebGPU
  • WebGpuCommandTestsVixen.Graphics.WebGPU.Tests
  • WebGpuDeviceTestsVixen.Graphics.WebGPU.Tests
  • WebGpuQueueVixen.Graphics.WebGPU
  • WebGpuRequirementVixen.Graphics.WebGPU.Tests
  • WebGpuSwapChainVixen.Graphics.WebGPU
  • GraphicsHostVixen.App