Browser GPU root selection. More...
#include <cstdint>#include <memory>#include <optional>#include <ostream>#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. | |
| std::optional< GpuBackendKind > | donner::geode::BuildDefaultGpuBackendKind () |
| In WebAssembly builds, the browser backend, selected when nothing else names a backend. | |
| gpu::Result< GpuBackendKind > | donner::geode::ResolveGpuBackendKind (const GpuRootSelection &options, std::string_view request, std::optional< GpuBackendKind > buildDefault) |
| In WebAssembly builds, resolves the caller's backend, then DONNER_GPU_BACKEND, then the build default, without opening a device. | |
| 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. | |
| GeodeRuntimeDevice | donner::geode::CreateGpuDeviceOver (std::shared_ptr< GeodeGpuRoot > root) |
| In WebAssembly builds, opens one runtime device over the browser root, sharing its loss condition. | |
Browser GPU 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. |
| 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, | ||
| std::optional< GpuBackendKind > | buildDefault ) |
In WebAssembly builds, resolves the caller's backend, then DONNER_GPU_BACKEND, then the build default, without opening a device.
| options | Caller-supplied inputs. |
| request | Value of DONNER_GPU_BACKEND; empty when it is unset or empty. |
| buildDefault | Backend chosen when nothing names one; the browser backend when empty. |
request names none. | 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. |