Test-only wgpu-native implementation of donner::gpu::Device, the reference the Linux resvg comparison renders the production Geode contexts through.
More...
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <mutex>
#include <span>
#include <string_view>
#include <vector>
#include <webgpu/webgpu.hpp>
#include "donner/base/SmallVector.h"
#include "donner/gpu/Device.h"
#include "donner/svg/renderer/geode/GeodeWgpuUtil.h"
Test-only wgpu-native implementation of donner::gpu::Device, the reference the Linux resvg comparison renders the production Geode contexts through.
◆ CreateWgpuReferenceContext()
Creates a headless Geode context over a newly selected wgpu reference.
- Parameters
-
| textureFormat | Format the context's render targets and pipelines are built for. |
- Returns
- The context, or null when SelectWgpuReference found no adapter or device.
◆ GpuTextureFormatFromWgpu()
| gpu::TextureFormat donner::geode::GpuTextureFormatFromWgpu |
( |
wgpu::TextureFormat | format | ) |
|
Maps a wgpu render-target format onto the donner::gpu format enum.
Halts (release assert) on formats outside the runtime's supported set - RGBA8Unorm, BGRA8Unorm, R8Unorm - which are the only formats Geode's shaders and render targets are built for.
- Parameters
-
| format | wgpu texture format to map. |
◆ SelectWgpuReference()
| WgpuReferenceSelection donner::geode::SelectWgpuReference |
( |
std::string_view | label | ) |
|
Selects the wgpu-native reference: creates an instance, requests an adapter and a device, and takes the default queue, then adopts them as a Geode root whose runtime devices are GeodeWgpuAdapterDevice instances.
WGPU_BACKEND names the wgpu backend (vulkan, metal, opengl or opengles; Vulkan when unset on Linux), and DONNER_GEODE_FORCE_FALLBACK_ADAPTER=1 requests wgpu's fallback adapter. Adapter and device requests that fail under parallel load are retried on a short logged schedule.
The production contexts, renderer and caches drive the reference only through the runtime contract, so a comparison against it exercises the same Geode code as a native backend.
- Parameters
-
| label | Label the selected device carries in driver diagnostics. |
- Returns
- The selection, with both members null when no adapter or device could be obtained.
◆ WgpuTextureFormatFrom()
Maps a donner::gpu render-target format onto the wgpu format enum, for the call sites that still describe a backend texture.
Halts (release assert) on a format the backend cannot name.
- Parameters
-
| format | Runtime texture format to map. |