Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
WgpuBaselineCapture.h File Reference

Renders corpus scenes through the current production renderer as a black box. More...

#include <cstdint>
#include <filesystem>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "donner/gpu/baseline/BaselineCorpus.h"
Include dependency graph for WgpuBaselineCapture.h:

Classes

struct  donner::gpu::baseline::CaptureEnvironment
 The adapter a capture ran on. Frozen pixels are only meaningful against the environment that produced them, so every capture records this and the check mode refuses to compare across a mismatch instead of reporting a difference it cannot attribute. More...
class  donner::gpu::baseline::WgpuBaselineCapturer
 Holds one production device for the whole corpus, because device creation compiles every shared pipeline and is far more expensive than any single scene. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

std::string donner::gpu::baseline::EnvironmentSlug (const CaptureEnvironment &environment)
 Directory name a capture from environment is filed under, for example apple_m1_pro_metal. Lowercase with every run of non-alphanumeric characters collapsed to one underscore, so one adapter always resolves to one directory on every platform.
std::string donner::gpu::baseline::WriteFrozenBaselineSet (WgpuBaselineCapturer &capturer, const std::filesystem::path &baselinesRoot, std::string_view sourceRevision, std::string_view sourceTree, std::filesystem::path *outputDirOut)
 Renders every pixel-capturing corpus scene and writes the frozen set for this capturer's adapter under baselinesRoot/<slug>/: one PNG per scene plus the provenance record.
std::string donner::gpu::baseline::CaptureNamedScene (WgpuBaselineCapturer &capturer, std::string_view sceneName, std::vector< uint8_t > &pixelsOut)
 Renders the corpus scene named sceneName on capturer. Fails when the corpus has no such scene, which keeps a stale golden filename from silently comparing against nothing.

Detailed Description

Renders corpus scenes through the current production renderer as a black box.

This is the pre-cutover oracle: the wgpu-backed Geode path, driven exactly the way production rendering drives it, with only its public outputs read back. Both the capture binary that writes the committed PNGs and the check-mode test that re-renders and diffs against them go through here, so the frozen bytes and the bytes under test can never come from two different code paths.

Function Documentation

◆ WriteFrozenBaselineSet()

std::string donner::gpu::baseline::WriteFrozenBaselineSet ( WgpuBaselineCapturer & capturer,
const std::filesystem::path & baselinesRoot,
std::string_view sourceRevision,
std::string_view sourceTree,
std::filesystem::path * outputDirOut )

Renders every pixel-capturing corpus scene and writes the frozen set for this capturer's adapter under baselinesRoot/<slug>/: one PNG per scene plus the provenance record.

Parameters
capturerLive capturer bound to the adapter being frozen.
baselinesRootDirectory that holds one subdirectory per adapter.
sourceRevisionRevision the capture was taken at.
sourceTreeWhether that tree was clean or dirty.
outputDirOutReceives the directory written, when non-null.
Returns
An empty string on success, or a human-readable reason the capture failed.