Native Geode root selection. More...
#include <cstdint>#include <memory>#include <optional>#include <ostream>#include <span>#include <string_view>#include "donner/base/Utils.h"#include "donner/gpu/Device.h"Classes | |
| struct | donner::geode::GeodeGpuRootCapabilities |
| Capabilities shared by runtime devices opened over one browser GPU device. More... | |
| class | donner::geode::GeodeGpuRoot |
| Owns the browser GPU device and loss condition shared by logical Geode contexts. More... | |
| struct | donner::geode::GpuRootSelection |
| Inputs to browser-root selection. A named unsupported backend is refused. More... | |
| struct | donner::geode::GeodeRuntimeDevice |
| One logical runtime device over the selected browser root. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Enumerations | |
| enum class | donner::geode::GpuBackendKind : uint8_t { NativeMetal , NativeVulkan , Browser , NativeMetal , NativeVulkan , Browser , External } |
| The backend selected for a Geode runtime device. More... | |
Functions | |
| std::string_view | donner::geode::GpuBackendKindName (GpuBackendKind kind) |
| Human-readable name of a selected backend. | |
| std::ostream & | donner::geode::operator<< (std::ostream &os, GpuBackendKind kind) |
| Prints the kind's human-readable name. | |
| gpu::Result< GpuBackendKind > | donner::geode::ProcessDefaultGpuBackendKind () |
| In WebAssembly builds, the backend DONNER_GPU_BACKEND requests, or the browser backend when it is unset or empty. | |
| gpu::Result< GpuBackendKind > | donner::geode::ResolveGpuBackendKind (const GpuRootSelection &options, std::string_view request) |
The backend SelectGpuRoot opens for options, without opening it. | |
| std::shared_ptr< GeodeGpuRoot > | donner::geode::SelectGpuRoot (const GpuRootSelection &options) |
| In WebAssembly builds, opens the browser's GPU device as a root. When the caller names no backend, halts if DONNER_GPU_BACKEND is invalid or names a native backend. A caller-named native backend halts when DONNER_GPU_BACKEND is non-empty and returns null otherwise. Also returns null when the device request fails. | |
| std::shared_ptr< GeodeGpuRoot > | donner::geode::AdoptNativeVulkanRoot (std::shared_ptr< gpu::vulkan::VulkanSharedRoot > nativeRoot, std::shared_ptr< gpu::DeviceLostState > lostState) |
| Adopts a completed native Vulkan root, for example one an embedder selected for its actual presentation surface. | |
| GeodeRuntimeDevice | donner::geode::CreateGpuDeviceOver (std::shared_ptr< GeodeGpuRoot > root) |
| In WebAssembly builds, opens one runtime device over the browser root, sharing its loss condition. | |
Native Geode root selection.
|
strong |
The backend selected for a Geode runtime device.
| Enumerator | |
|---|---|
| External | Runtime devices a GeodeRuntimeDeviceSource opens. Never selected: only adopting a source produces it. |
| std::shared_ptr< GeodeGpuRoot > donner::geode::AdoptNativeVulkanRoot | ( | std::shared_ptr< gpu::vulkan::VulkanSharedRoot > | nativeRoot, |
| std::shared_ptr< gpu::DeviceLostState > | lostState ) |
Adopts a completed native Vulkan root, for example one an embedder selected for its actual presentation surface.
| nativeRoot | Completed Vulkan instance, physical and logical device, and queue. |
| lostState | Loss condition nativeRoot was opened with. |
lostState is not the condition nativeRoot shares, or this platform has no native Vulkan backend. | GeodeRuntimeDevice donner::geode::CreateGpuDeviceOver | ( | std::shared_ptr< GeodeGpuRoot > | root | ) |
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.
| root | Root to render through; must not be null. |
| std::string_view donner::geode::GpuBackendKindName | ( | GpuBackendKind | kind | ) |
Human-readable name of a selected backend.
| kind | Backend kind to name. |
| std::ostream & donner::geode::operator<< | ( | std::ostream & | os, |
| GpuBackendKind | kind ) |
Prints the kind's human-readable name.
| os | Output stream. |
| kind | Value to output. |
| gpu::Result< GpuBackendKind > donner::geode::ProcessDefaultGpuBackendKind | ( | ) |
In WebAssembly builds, the backend DONNER_GPU_BACKEND requests, or the browser backend when it is unset or empty.
The backend DONNER_GPU_BACKEND requests: metal or vulkan in any letter case, or the platform default (native Metal on Apple, native Vulkan on Linux) when the variable is unset or empty.
| gpu::Result< GpuBackendKind > donner::geode::ResolveGpuBackendKind | ( | const GpuRootSelection & | options, |
| std::string_view | request ) |
The backend SelectGpuRoot opens for options, without opening it.
The first of these that applies decides: the backend the caller names, the one request names, and the platform default.
| options | Caller-supplied inputs. |
| request | Value of DONNER_GPU_BACKEND; empty when it is unset or empty. |
request names none, the external kind is named, no backend applies on this platform, or the Vulkan presentation options are inconsistent with each other or with the resolved backend. | std::shared_ptr< GeodeGpuRoot > donner::geode::SelectGpuRoot | ( | const GpuRootSelection & | options | ) |
In WebAssembly builds, opens the browser's GPU device as a root. When the caller names no backend, halts if DONNER_GPU_BACKEND is invalid or names a native backend. A caller-named native backend halts when DONNER_GPU_BACKEND is non-empty and returns null otherwise. Also returns null when the device request fails.
Selects a native backend root for options and opens the system device behind it.
Halts the process when the Vulkan presentation options are inconsistent with each other or with the resolved backend. When the caller names no backend and DONNER_GPU_BACKEND controls selection, it also halts if the variable names no backend or one this process cannot open: an explicit process request is never silently replaced with another backend.
| options | Caller-supplied inputs. |