Expand description
GPU compositing public API.
§wgpu interop
The API names no wgpu type by default: sources come in as
SourceViews and results go out as RenderedTextures and readbacks.
The items that take or return wgpu handles are the interop surface,
documented with the wgpu-interop feature and following wgpu’s major
version. Without the feature those items are hidden: alpha2’s own crates
share handles through them, and they are not part of this crate’s API.
Re-exports§
pub use composite::LayerTransform;pub use readback::PlaneTarget;pub use readback::Rgba8Readback;pub use readback::StagingPlane;pub use readback::Yuv420pPlanes;pub use readback::Yuv420pReadback;pub use readback::Yuv420pTargets;pub use readback::yuv420p_staging_bytes;pub use yuv::ExternalTextureLease;pub use yuv::PendingSourceWork;pub use yuv::PreparedSourceTexture;pub use yuv::SourceAlpha;pub use yuv::SourcePlane;pub use yuv::SourcePresentation;pub use yuv::Yuv420Frame;pub use yuv::YuvFrame;
Modules§
- hdr
- HDR sources brought into the SDR working space.
Structs§
- Adapter
Diagnostics - Adapter metadata recorded beside reproducible benchmark samples.
- Benchmark
Metadata - Reproducible metadata envelope written beside benchmark measurements.
- Color
- A premultiplied, sRGB-encoded RGBA storage value with components in the
0..=1range and no color component above alpha: the values an intermediate texture holds, not linear light. - Compiled
Effect - A runtime effect the device compiled, ready for
Renderer::register_compiledon the renderer that compiled it. - Degradation
Decision - Effective controls and every observable fallback decision.
- Effect
Def - Data-only runtime effect, transition, or generator definition.
- Effect
Id - Stable identity of one registered effect version.
- Effect
Inputs - Named images one effect node samples besides its source, by the names its
definition declares. Kept sorted by name, one node per name; a name is
borrowed for
'aor owned, asEffectParamsnames are. - Effect
Params - Named values supplied to one runtime effect invocation.
- Effect
Resources - Named resource identities supplied to one effect invocation.
- Effect
Runtime - Per-invocation values supplied by the timeline runner.
- Frame
Submit Timings - Where one frame’s graph construction and submission spent its time.
- GpuError
Reports - GPU errors the embedding saw that no scope of the renderer’s caught: on the browser, every uncaptured error its device reports.
- Graph
Layer - One owned layer reference in a graph composition node.
- Input
Spec - One image an effect samples besides its source, by the name its shader
reads it under:
sample_<name>(uv)andsize_<name>(). - Layer
Transform - Placement and opacity of one composited layer.
- Lut3d
Data - Canonical RGB samples for one cubic 3D lookup table.
- LutParse
Error - Diagnostic returned while parsing
.cubetext. - Mask
Combine Names - The names of one mask of a mask-combine pass: its coverage input and
its parameters, as
mask_combine_definitiondeclares them. - Paint
Params - The parameter names of one of the generator’s paints, as
generator_definitiondeclares them. - Param
Spec - One runtime effect parameter.
- Pass
Timing - Most recent timing for one named render pass.
- Pending
Effect - A runtime effect whose shader module and pipeline exist on the device,
with the device’s verdict on them still to come:
Renderer::compile_effectmade it,PendingEffect::compiledwaits for the verdict, andRenderer::register_compiledadds what passed. - Pending
Source Work - One source-presentation pass waiting to be encoded by its first consumer.
- Pipeline
Cache Stats - Current pipeline-cache occupancy.
- Plane
Target - A caller-owned destination for one packed plane.
- Prepared
Source Texture - A rendered source texture paired with presentation work that can be folded into the command encoder of its first consumer.
- Readback
Buffer Pool Stats - Allocation and retention counters for mapped readback buffers.
- Render
Cache Key - Deterministic 128-bit key for a source or rendered graph result.
- Render
Diagnostics - Snapshot of render performance, cache, memory, and scheduling behavior.
- Render
Graph - An insertion-ordered, acyclic render program.
- Render
Node Id - Stable handle to a node within one render graph.
- Render
Plan - Compiled execution and lifetime schedule for a render graph.
- Render
Quality Controls - Quality controls consumed by graph compilation and pass execution.
- Render
Size - A non-zero render-target extent.
- Rendered
Texture - A GPU texture produced by the renderer. Image passes store premultiplied sRGB RGBA; raw solid clears retain the supplied component values.
- Renderer
- Renders graphs of sources, effects, transitions and composites on one GPU device, and owns the pipelines, pools and caches they use.
- Resource
Budget - Caller-owned resource envelope; zero means the corresponding resource is unavailable.
- Resource
Spec - One named external resource required by an effect definition.
- Result
Cache Stats - Result-cache counters since the renderer was created.
- Rgba8
Readback - A submitted texture readback whose buffer has not been mapped yet.
- Shader
Diagnostic - One schema or WGSL diagnostic.
- Shader
Diagnostics - Diagnostics returned when runtime registration fails.
- Source
Plane - One borrowed source plane: rows
stridebytes apart. - Source
Presentation - GPU presentation transform applied while converting a decoded source.
- Source
View - A texture the renderer draws from as a source, borrowed from whoever owns
it: a
RenderedTexture, ancrate::UploadTexture(whatcrate::Renderer::upload_rgba8returns), or, through thewgpuinterop, any texture view of the renderer’s device. - Staging
Plane - Where one plane sits in a mapped readback staging buffer.
- Texture
Pool Stats - Observable allocation counters for the intermediate texture pool.
- Uniform
Buffer Pool Stats - Allocation and retention counters for submission-scoped uniform arenas.
- Uniform
Field - Automatically computed uniform member placement.
- Uniform
Layout - Host layout generated from a parameter schema.
- Upload
Texture - One source-upload texture retained by the renderer’s descriptor-keyed pool.
- Upload
Texture Pool Stats - Allocation and retention counters for source-upload textures.
- Warmup
Report - Work completed by a graph warmup request.
- Yuv420
Frame - Borrowed 8-bit planar 4:2:0 source.
- Yuv420p
Planes - Tightly packed planar YUV420 data produced by a GPU readback.
- Yuv420p
Readback - A submitted GPU RGB-to-YUV420 conversion whose buffer is not mapped yet.
- Yuv420p
Targets - Destinations for the three planes of one packed frame.
- YuvFrame
- Borrowed planar or semi-planar YCbCr source of any subsampling and depth
YuvFormat::is_supportedaccepts. - YuvSample
- A normalized YUV sample and straight alpha value.
Enums§
- Blend
Mode - Artistic RGB operation applied before Porter-Duff source-over coverage.
- Blend
Space - Color space in which compositing arithmetic is evaluated.
- Cache
Eligibility - Whether a node’s result can be cached, and if not, why.
- Cache
Intent - Whether a node’s result may be kept and reused.
- Cache
Invalidation - Why cached results were dropped all at once.
- Capability
Diagnostic - One deterministic fallback selected from adapter facts and caller budgets.
- Color
Diagnostic - Observable color-pipeline diagnostic.
- Color
Error - Color conversion failure.
- Color
Policy - What happens to an HDR (PQ or HLG) source.
- Diagnostic
Severity - Shader compiler message severity.
- Effect
Kind - Runtime shader category.
- Effect
Resource Kind - Representation an effect resource binding expects from its registered data.
- Graph
Error - Structural or execution failure in a render graph.
- Param
Type - Host-side parameter representation.
- Param
Unit - Semantic unit exposed to authoring hosts.
- Param
Value - Typed default parameter value.
- Readback
Failure - Where a texture readback failed.
- Render
Error - Render input or output failure.
- Render
Node Kind - Public category of a render graph node.
- SdrOutput
Transfer - SDR transfer used when encoding a render result.
- Source
Alpha - How an RGBA source texture stores color relative to its alpha.
- Timing
Source - Source of one pass duration.
Constants§
- CHROMA_
KEY_ ID - Stable identifier of the built-in chroma-key effect.
- DEFAULT_
GPU_ WAIT_ TIMEOUT - How long a native caller waits for GPU work before giving up, unless the renderer is told otherwise.
- FILL_
PAINT_ PARAMS - The fill paint’s parameter names: static, so a caller sets a generator’s paints without formatting a name.
- GAUSSIAN_
BLUR_ ID - Stable identifier of the atomic Gaussian-blur effect.
- GENERATOR_
EFFECT_ ID - Internal identifier of the generator pass.
- GLOW_ID
- Stable identifier of the built-in glow effect.
- GPU_
DEVICE_ LOST_ MESSAGE - The message of
RenderError::GpuDeviceLost. - GPU_
TIMEOUT_ MESSAGE - The message every GPU wait timeout carries, so a host that sees only error
text can still classify it: one sentence for the renderer, the native
interop helpers, and encoder inputs alike.
The sentence every wait on GPU work that timed out carries, wherever it
was waited on (the renderer, a native interop helper, an encoder input),
so a host that sees only error text tells a hung GPU from a generic
failure. Hosts classify it as
GPU_TIMEOUT. - GPU_
WORK_ DROPPED_ MESSAGE - The message of
RenderError::GpuWorkDropped. It names a lost device, which is what the host classifies it as. - LUT_
3D_ ID - Stable identifier of the resource-backed 3D LUT effect.
- MASK_
COMBINE_ EFFECT_ IDS - Internal identifiers of the mask-combine passes, by mask count minus one:
the pass for
nmasks isMASK_COMBINE_EFFECT_IDS[n - 1]. - MASK_
COMBINE_ NAMES - Each mask’s names, by mask index: static, so a caller sets a frame’s masks without formatting a name.
- MASK_
MODES - Enum values of a mask’s
mode{i}parameter. - MAX_
EFFECT_ INPUTS - The most named inputs an effect declares. Its source pair, resources, and inputs must also fit the sampled textures a device offers a shader stage (16 on WebGL2-class limits), which registration checks per device.
- MAX_
GENERATOR_ STOPS - Stops one paint carries. The project model allows as many.
- MAX_
SHAPE_ MASKS - Masks one mask-combine pass combines at most. The project model allows as many, and each is one of its named inputs.
- PAINT_
KINDS - Enum values of a paint’s
kindparameter. - PAINT_
SPREADS - Enum values of a paint’s
spreadparameter. - TRACK_
MATTE_ EFFECT_ ID - Internal identifier of the track-matte pass.
Traits§
- External
Texture Lease - Keeps an imported native texture and its decoder surface alive until the queue has completed the submission that samples it.
Functions§
- builtin_
catalog - Returns the complete engine-owned effect catalog as a host-friendly JSON value.
- builtin_
catalog_ json - Serializes
builtin_catalogfor process and WebAssembly boundaries. - builtin_
effect_ definitions - Returns fresh definitions for every public built-in clip effect.
- builtin_
transition_ definitions - Returns fresh, data-only definitions for all built-in transitions.
- builtin_
wgsl_ modules - Returns every WGSL module the renderer can create, labelled: the built-in pipeline modules and the generated module of every built-in effect and transition.
- chroma_
key_ definition - Returns the data-only definition of the built-in chroma-key effect.
- convert_
yuv_ to_ linear_ rgba - Converts one integer-code-normalized YUV sample to premultiplied linear RGB.
- effect_
wgsl - Returns the complete module the renderer compiles for
definition: the generated preamble for its parameters and resources, followed by its body. - encode_
linear_ rgb - Encodes linear-light RGB for an SDR output target.
- filter_
sample_ limit - The most filter samples a pass takes on a device of
tier:crate::RenderQualityControls::MAX_FILTER_SAMPLES, and 16 on Tier B (WebGL2, GL ES), whose fill rate the larger budgets outrun. - gaussian_
blur_ definition - Returns the data-only definition of the built-in Gaussian blur.
- generator_
definition - The generator pass: the fill paint over the whole picture.
- glow_
definition - Returns the data-only definition of the built-in glow.
- is_hdr
- Whether
coloris an HDR signal: PQ or HLG, or declared HDR. - lut_
3d_ definition - Returns the data-only definition of the resource-backed 3D LUT effect.
- mask_
combine_ definition - The pass combining
countmasks (1 toMAX_SHAPE_MASKS) into its source’s coverage. Maskiis the named inputm{i}, whose alpha is the mask’s coverage (drawn by the vector pass, feathered by a blur), inverted wheninvert{i}is set, and combined with the masks before it bymode{i}: coverage starts empty when the first mask adds and full otherwise; add isc + m - c m, subtractc (1 - m), intersectc m. The source is kept by the result. - mask_
combine_ definitions - Every mask-combine pass, for one to
MAX_SHAPE_MASKSmasks. - resolve_
degradation - Resolves deterministic degradation without product- or device-name assumptions.
- track_
matte_ definition - The track-matte pass: the first input kept where the second input’s alpha (or luminance over black: BT.709 weights on linear light, times alpha) says, optionally inverted.
- yuv420p_
staging_ bytes - The bytes one planar YUV420 readback of
sizestages: each plane’s rows padded to the copy alignment, each plane starting on a placement boundary, and the 16-byte canary that proves the GPU wrote them. This is what an in-flight readback holds, and what a budget must reserve for it.