Donner 0.5.0
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::geode::GeodeDevice Class Reference

Owns a headless WebGPU device/queue pair for GPU rendering. More...

#include "donner/svg/renderer/geode/GeodeDevice.h"

Classes

struct  Impl
 PIMPL struct: owns the Dawn instance which must outlive adapter/device. More...

Public Member Functions

 ~GeodeDevice ()
 Destructor releases the device and all GPU resources.
 GeodeDevice (const GeodeDevice &)=delete
GeodeDevice & operator= (const GeodeDevice &)=delete
 GeodeDevice (GeodeDevice &&) noexcept
GeodeDevice & operator= (GeodeDevice &&) noexcept
const wgpu::Device & device () const
 Returns the wgpu::Device. Guaranteed valid for the lifetime of this object.
const wgpu::Queue & queue () const
 Returns the default queue.
const wgpu::Adapter & adapter () const
 Returns the adapter backing this device.

Static Public Member Functions

static std::unique_ptr< GeodeDevice > CreateHeadless ()
 Create a headless GeodeDevice.

Detailed Description

Owns a headless WebGPU device/queue pair for GPU rendering.

GeodeDevice is the entry point to the Geode rendering backend. It creates a Dawn instance, selects a default adapter, and creates a device — all without any window system integration. All rendering happens into offscreen textures.

Typical usage:

auto maybeDevice = GeodeDevice::CreateHeadless();
if (!maybeDevice) {
  // Dawn initialization failed — likely no GPU available.
  return;
}
GeodeDevice& device = *maybeDevice;
wgpu::Texture target = device.device().CreateTexture(...);
// ... render ...

Class Documentation

◆ donner::geode::GeodeDevice::Impl

struct donner::geode::GeodeDevice::Impl

PIMPL struct: owns the Dawn instance which must outlive adapter/device.

Collaboration diagram for donner::geode::GeodeDevice::Impl:
[legend]
Class Members
unique_ptr< Instance > instance

Member Function Documentation

◆ CreateHeadless()

std::unique_ptr< GeodeDevice > donner::geode::GeodeDevice::CreateHeadless ( )
static

Create a headless GeodeDevice.

Returns
A valid GeodeDevice on success, or an empty unique_ptr if Dawn could not create an adapter/device (e.g., no GPU, no driver).

The documentation for this class was generated from the following files:
  • donner/svg/renderer/geode/GeodeDevice.h
  • donner/svg/renderer/geode/GeodeDevice.cc