Expand description
Layer 4: GPU backend — wgpu 30 over the frust-owned frust-engine strip
pipeline.
Consumes the renderer-agnostic frust_scene::Scene display list and
renders it into a window’s swapchain. frust-engine draws through ordinary
render passes into the acquired swapchain texture — no compute pass, no
storage write, no intermediate and no blit — so the surface needs only
RENDER_ATTACHMENT in whatever format the platform reports, plus the depth
attachment the surface carries alongside it. The one variation is a
swapchain whose compositor genuinely reads STRAIGHT alpha: there the frame
lands in a surface-owned intermediate and one fragment pass un-premultiplies
it into the swapchain. Both presentation models live in RenderContext /
SurfaceRenderer.
wgpu types are kept out of the public API except at one deliberate seam:
SurfaceRenderer::on_surface_created takes a wgpu::SurfaceTarget (the
shell must hand over a window). There is no renderer to select: the engine
is the only one this crate contains, so what was a tier probe is now a
plain capability gate (engine_support over TierCaps, against
ENGINE_REQUIRED_DOWNLEVEL_FLAGS) that refuses an adapter which cannot
run it. The cargo feature that gated the engine, the env-var/CLI override
that picked a renderer, and the vello-classic/vello_cpu tiers they chose
between are all gone.
HeadlessRenderer renders the same scenes with no surface at all — the
offscreen harness this crate’s pixel-regression tests compare against,
resolving its adapter and limits exactly as a real device does and asking
the same capability gate.
external_pass is the third wgpu-typed seam, and the one that points
outward: an app or a crate beside the facade registers an ExternalPass,
and SurfaceRenderer hands it the frame’s own device, queue and encoder
ahead of the scene pass so it can render into a target of its own and bind
the result for a Command::SceneTexture to composite. See that module’s
docs for the contract; HeadlessRenderer does not drain that registry.
Surface lifecycle is a first-class state machine: see SurfaceRenderer
and SurfacePhase/FrameOutcome, whose pure transition tables live in
frust_gpu::lifecycle and are re-exported here.
§Where the foundation lives
The wgpu instance, the lazily created logical device, the surface factory
and its cross-thread DetachedSurface hand-off, the surface lifecycle
state machine, the persisted pipeline-cache framing and the offscreen
shader-effect pipelines are all frust-gpu’s
(frust_gpu::context::RenderContext, frust_gpu::surface,
frust_gpu::lifecycle, frust_gpu::pipeline_cache,
frust_gpu::effects) — one copy, shared with every other consumer of that
crate. The context/surface/lifecycle types a shell touches are re-exported
here under the names they have always had, so frust_render::RenderContext
keeps working; the pipeline-cache framing and the shader-effect pipelines
were never public under this crate and are reached as
frust_gpu::pipeline_cache/frust_gpu::effects directly. What is genuinely this crate’s own is the
renderer: the render-path decision, the engine resources each arm owns, the
engine’s own capability gate, and SurfaceRenderer itself.
Re-exports§
pub use external_pass::ExternalFrame;pub use external_pass::ExternalPass;pub use external_pass::register_external_pass;pub use external_pass::unregister_external_pass;
Modules§
- external_
pass - The seam an app — or a crate sitting beside the facade, a 3D renderer being the motivating one — records its own GPU work through, ahead of the engine’s scene pass and into the engine’s own frame encoder.
Structs§
- Deferred
Present - A frame that has been rendered and queue-submitted but not yet
presented — the deferred half of
SurfaceRenderer::submit_deferred. - Detached
Surface - A created-but-not-yet-configured
wgpu::Surface, produced bySurfaceFactory::create_detached_surfaceon the windowing thread and configured on the render thread. - Engine
Unsupported - An adapter that cannot run the engine: the refusal
engine_supportreturns, naming the adapter and the flags it is missing. - Headless
Image - The pixels of one headless render, plus the provenance of the GPU that produced them.
- Headless
Meta - Which GPU actually produced an image — the provenance every promoted
baseline and every failing artifact has to record (
docs/TESTING.md§ GPU Run Metadata). - Headless
Options - How a
HeadlessRenderershould pick, and then verify, its GPU. - Headless
Renderer - A reusable offscreen engine renderer: one adapter, one device, one
frust_engine::EngineRendererand one size-matchedfrust_gpu::HeadlessTarget, across any number of renders. - Headless
Spec - One offscreen render’s parameters.
- Render
Context - Owns the
wgpu::Instanceand the single logical device this crate’s consumers render with. - Surface
Factory - A cheap, cloneable handle to a
wgpu::Instanceused to create a surface on a different thread than the one that owns the renderer. - Surface
Renderer - Per-surface renderer and lifecycle state machine.
- Tier
Caps - Plain-data capability inputs
engine_supportprobes. Built from a realwgpu::Adapterat the surface-creation call site (context::create_engine_surface), but constructible by hand in tests with no GPU.
Enums§
- Acquire
Outcome - The outcome of a single acquire call — the first half of the two-phase present seam (acquire + submit), itself the second phase of the render pipeline after encode.
- Encode
Outcome - The outcome of a single encode call — the first phase of the two-phase render seam (encode + present).
- Frame
Outcome - The outcome of a single render call.
- Surface
Alpha Request - What a caller wants of the surface’s alpha, expressed without naming a
wgputype — the public, platform-independent request a shell makes. - Surface
Phase - Which lifecycle state the surface is in.
Constants§
- ENGINE_
REQUIRED_ DOWNLEVEL_ FLAGS - The
wgpu::DownlevelFlagsthe engine (frust-engine) cannot run without: none of them. - GOLDEN_
EXPECT_ ADAPTER_ ENV_ VAR - Environment variable naming the adapter a golden/oracle run must have
resolved. Case-insensitive substring match on the adapter name, the same
shape
WGPU_ADAPTER_NAMEitself matches by —T400acceptsNVIDIA T400 4GB. - GOLDEN_
EXPECT_ BACKEND_ ENV_ VAR - Environment variable naming the wgpu backend a golden/oracle run must have
resolved (
vulkan,metal,dx12,gl, …; case-insensitive, matched whole). The backend counterpart ofGOLDEN_EXPECT_ADAPTER_ENV_VAR.
Functions§
- engine_
support - Whether
capscan run the engine.