Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodeEmbedConfig Struct Reference

Configuration for embedding Geode into a host application that already owns a WebGPU device. More...

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

Public Attributes

wgpu::Instance instance
 Optional host-provided WebGPU instance. Browser embedders should provide it so synchronous snapshot readback can wait for map callback completion through Instance::waitAny().
wgpu::Device device
 Host-provided WebGPU device. Must not be null.
wgpu::Queue queue
 Host-provided queue associated with device. Must not be null.
wgpu::TextureFormat textureFormat = wgpu::TextureFormat::RGBA8Unorm
 Texture format for render targets. Must match the format of any texture passed to RendererGeode::setTargetTexture().
wgpu::Adapter adapter
 Optional adapter handle. Preserved for hosts that need to query the adapter associated with the external device.
std::shared_ptr< GeodeDeviceLostStatelostState
 Optional shared device-lost flag. Hosts that install their own WebGPU device-lost callback should have that callback set this flag and pass the same state here, so a driver-reported loss on the host device and a bounded-wait timeout inside Geode converge on the same GeodeDevice::isDeviceLost() condition. When null, the GeodeDevice creates a private flag that only bounded-wait timeouts can set.

Detailed Description

Configuration for embedding Geode into a host application that already owns a WebGPU device.

The host is responsible for the lifetime of the device and queue - they must remain valid for the entire lifetime of any GeodeDevice or RendererGeode constructed from this config.

Example:

config.instance = myInstance; // Optional; enables browser snapshot callbacks.
config.device = myDevice;
config.queue = myQueue;
config.textureFormat = wgpu::TextureFormat::BGRA8Unorm;
auto geodeDevice = GeodeDevice::CreateFromExternal(config);
RendererGeode renderer(std::move(geodeDevice));
static std::unique_ptr< GeodeDevice > CreateFromExternal(const GeodeEmbedConfig &config)
Create a GeodeDevice wrapping a host-provided device and queue.
Configuration for embedding Geode into a host application that already owns a WebGPU device.
Definition GeodeDevice.h:94
wgpu::Instance instance
Optional host-provided WebGPU instance. Browser embedders should provide it so synchronous snapshot r...
Definition GeodeDevice.h:98
wgpu::Device device
Host-provided WebGPU device. Must not be null.
Definition GeodeDevice.h:101
wgpu::Queue queue
Host-provided queue associated with device. Must not be null.
Definition GeodeDevice.h:104
wgpu::TextureFormat textureFormat
Texture format for render targets. Must match the format of any texture passed to RendererGeode::setT...
Definition GeodeDevice.h:108
Examples
geode_embed.cc.

Member Data Documentation

◆ adapter

wgpu::Adapter donner::geode::GeodeEmbedConfig::adapter

Optional adapter handle. Preserved for hosts that need to query the adapter associated with the external device.

Examples
geode_embed.cc.

◆ device

wgpu::Device donner::geode::GeodeEmbedConfig::device

Host-provided WebGPU device. Must not be null.

Examples
geode_embed.cc.

◆ instance

wgpu::Instance donner::geode::GeodeEmbedConfig::instance

Optional host-provided WebGPU instance. Browser embedders should provide it so synchronous snapshot readback can wait for map callback completion through Instance::waitAny().

Examples
geode_embed.cc.

◆ lostState

std::shared_ptr<GeodeDeviceLostState> donner::geode::GeodeEmbedConfig::lostState

Optional shared device-lost flag. Hosts that install their own WebGPU device-lost callback should have that callback set this flag and pass the same state here, so a driver-reported loss on the host device and a bounded-wait timeout inside Geode converge on the same GeodeDevice::isDeviceLost() condition. When null, the GeodeDevice creates a private flag that only bounded-wait timeouts can set.

◆ queue

wgpu::Queue donner::geode::GeodeEmbedConfig::queue

Host-provided queue associated with device. Must not be null.

Examples
geode_embed.cc.

◆ textureFormat

wgpu::TextureFormat donner::geode::GeodeEmbedConfig::textureFormat = wgpu::TextureFormat::RGBA8Unorm

Texture format for render targets. Must match the format of any texture passed to RendererGeode::setTargetTexture().

Examples
geode_embed.cc.

The documentation for this struct was generated from the following file: