Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodeGpuRoot Class Reference

Owns the browser GPU device and loss condition shared by logical Geode contexts. More...

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

Public Member Functions

 GeodeGpuRoot (GeodeGpuRootCapabilities capabilities, std::shared_ptr< gpu::DeviceLostState > lostState, std::shared_ptr< const void > backendHold)
 Retain the selected GPU root, its capabilities, and shared device-loss state.
const GeodeGpuRootCapabilities & capabilities () const
 Return the selected root's capabilities.
const std::shared_ptr< gpu::DeviceLostState > & lostState () const
 Return the shared device-loss state.
bool hasBackendDevice () const
 Return whether this root can open runtime devices for its backend.
 GeodeGpuRoot (GeodeGpuRootCapabilities capabilities, std::shared_ptr< gpu::DeviceLostState > lostState, std::shared_ptr< gpu::vulkan::VulkanSharedRoot > vulkanRoot=nullptr)
 Retains a selected native backend; the external kind is refused, because only an adopted GeodeRuntimeDeviceSource can open its devices.
const GeodeGpuRootCapabilities & capabilities () const
 Return the selected root's capabilities.
const std::shared_ptr< gpu::DeviceLostState > & lostState () const
 Return the shared device-loss state.
const std::shared_ptr< gpu::vulkan::VulkanSharedRoot > & vulkanRoot () const
 Return the retained Vulkan owner; null unless the root is native Vulkan.
bool hasBackendDevice () const
 Return whether this root can open runtime devices for its backend.

Friends

std::shared_ptr< GeodeGpuRoot > AdoptRuntimeDeviceSource (std::shared_ptr< GeodeRuntimeDeviceSource > source, const GeodeGpuRootCapabilities &capabilities, std::shared_ptr< gpu::DeviceLostState > lostState)
 Adopts source as a Geode root of kind GpuBackendKind::External.
GeodeRuntimeDevice CreateGpuDeviceOver (std::shared_ptr< GeodeGpuRoot > root)
 In WebAssembly builds, opens one runtime device over the browser root, sharing its loss condition.

Detailed Description

Owns the browser GPU device and loss condition shared by logical Geode contexts.

Retains a native GPU owner and the loss condition shared by logical contexts.

Constructor & Destructor Documentation

◆ GeodeGpuRoot() [1/2]

donner::geode::GeodeGpuRoot::GeodeGpuRoot ( GeodeGpuRootCapabilities capabilities,
std::shared_ptr< gpu::DeviceLostState > lostState,
std::shared_ptr< const void > backendHold )

Retain the selected GPU root, its capabilities, and shared device-loss state.

Parameters
capabilitiesCapabilities exposed by the selected root.
lostStateShared loss condition observed by logical devices.
backendHoldOpaque shared ownership keeping the backend device alive.

◆ GeodeGpuRoot() [2/2]

donner::geode::GeodeGpuRoot::GeodeGpuRoot ( GeodeGpuRootCapabilities capabilities,
std::shared_ptr< gpu::DeviceLostState > lostState,
std::shared_ptr< gpu::vulkan::VulkanSharedRoot > vulkanRoot = nullptr )

Retains a selected native backend; the external kind is refused, because only an adopted GeodeRuntimeDeviceSource can open its devices.

Parameters
capabilitiesCapabilities of the selected native backend.
lostStateNon-null loss condition shared by logical devices.
vulkanRootShared Vulkan physical owner; null unless the backend is native Vulkan.

◆ AdoptRuntimeDeviceSource

std::shared_ptr< GeodeGpuRoot > AdoptRuntimeDeviceSource ( std::shared_ptr< GeodeRuntimeDeviceSource > source,
const GeodeGpuRootCapabilities & capabilities,
std::shared_ptr< gpu::DeviceLostState > lostState )
friend

Adopts source as a Geode root of kind GpuBackendKind::External.

The root never selects or names a backend: DONNER_GPU_BACKEND, a caller's backend choice and the platform default all refuse the external kind, so only a holder of a source reaches it.

Parameters
sourceOpens the runtime devices of every context over the root; must not be null.
capabilitiesWhat every device the source opens reports identically. Its backend kind is replaced with the external kind.
lostStateLoss condition shared by the root and every device source opens; must not be null.
Returns
The root, or null when source or lostState is null.

◆ CreateGpuDeviceOver

GeodeRuntimeDevice CreateGpuDeviceOver ( std::shared_ptr< GeodeGpuRoot > root)
friend

In WebAssembly builds, opens one runtime device over the browser root, sharing its loss condition.

Opens one runtime device over root.

Every logical rendering context gets its own, with its own handle tables and submission serials, while all of them share the root's loss condition.

Parameters
rootRoot to render through; must not be null.
Returns
The device, or an empty device when the backend could not open one.

The documentation for this class was generated from the following files: