Skip to main content

Crate alpha2_render

Crate alpha2_render 

Source
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§

AdapterDiagnostics
Adapter metadata recorded beside reproducible benchmark samples.
BenchmarkMetadata
Reproducible metadata envelope written beside benchmark measurements.
Color
A premultiplied, sRGB-encoded RGBA storage value with components in the 0..=1 range and no color component above alpha: the values an intermediate texture holds, not linear light.
CompiledEffect
A runtime effect the device compiled, ready for Renderer::register_compiled on the renderer that compiled it.
DegradationDecision
Effective controls and every observable fallback decision.
EffectDef
Data-only runtime effect, transition, or generator definition.
EffectId
Stable identity of one registered effect version.
EffectInputs
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 'a or owned, as EffectParams names are.
EffectParams
Named values supplied to one runtime effect invocation.
EffectResources
Named resource identities supplied to one effect invocation.
EffectRuntime
Per-invocation values supplied by the timeline runner.
FrameSubmitTimings
Where one frame’s graph construction and submission spent its time.
GpuErrorReports
GPU errors the embedding saw that no scope of the renderer’s caught: on the browser, every uncaptured error its device reports.
GraphLayer
One owned layer reference in a graph composition node.
InputSpec
One image an effect samples besides its source, by the name its shader reads it under: sample_<name>(uv) and size_<name>().
LayerTransform
Placement and opacity of one composited layer.
Lut3dData
Canonical RGB samples for one cubic 3D lookup table.
LutParseError
Diagnostic returned while parsing .cube text.
MaskCombineNames
The names of one mask of a mask-combine pass: its coverage input and its parameters, as mask_combine_definition declares them.
PaintParams
The parameter names of one of the generator’s paints, as generator_definition declares them.
ParamSpec
One runtime effect parameter.
PassTiming
Most recent timing for one named render pass.
PendingEffect
A runtime effect whose shader module and pipeline exist on the device, with the device’s verdict on them still to come: Renderer::compile_effect made it, PendingEffect::compiled waits for the verdict, and Renderer::register_compiled adds what passed.
PendingSourceWork
One source-presentation pass waiting to be encoded by its first consumer.
PipelineCacheStats
Current pipeline-cache occupancy.
PlaneTarget
A caller-owned destination for one packed plane.
PreparedSourceTexture
A rendered source texture paired with presentation work that can be folded into the command encoder of its first consumer.
ReadbackBufferPoolStats
Allocation and retention counters for mapped readback buffers.
RenderCacheKey
Deterministic 128-bit key for a source or rendered graph result.
RenderDiagnostics
Snapshot of render performance, cache, memory, and scheduling behavior.
RenderGraph
An insertion-ordered, acyclic render program.
RenderNodeId
Stable handle to a node within one render graph.
RenderPlan
Compiled execution and lifetime schedule for a render graph.
RenderQualityControls
Quality controls consumed by graph compilation and pass execution.
RenderSize
A non-zero render-target extent.
RenderedTexture
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.
ResourceBudget
Caller-owned resource envelope; zero means the corresponding resource is unavailable.
ResourceSpec
One named external resource required by an effect definition.
ResultCacheStats
Result-cache counters since the renderer was created.
Rgba8Readback
A submitted texture readback whose buffer has not been mapped yet.
ShaderDiagnostic
One schema or WGSL diagnostic.
ShaderDiagnostics
Diagnostics returned when runtime registration fails.
SourcePlane
One borrowed source plane: rows stride bytes apart.
SourcePresentation
GPU presentation transform applied while converting a decoded source.
SourceView
A texture the renderer draws from as a source, borrowed from whoever owns it: a RenderedTexture, an crate::UploadTexture (what crate::Renderer::upload_rgba8 returns), or, through the wgpu interop, any texture view of the renderer’s device.
StagingPlane
Where one plane sits in a mapped readback staging buffer.
TexturePoolStats
Observable allocation counters for the intermediate texture pool.
UniformBufferPoolStats
Allocation and retention counters for submission-scoped uniform arenas.
UniformField
Automatically computed uniform member placement.
UniformLayout
Host layout generated from a parameter schema.
UploadTexture
One source-upload texture retained by the renderer’s descriptor-keyed pool.
UploadTexturePoolStats
Allocation and retention counters for source-upload textures.
WarmupReport
Work completed by a graph warmup request.
Yuv420Frame
Borrowed 8-bit planar 4:2:0 source.
Yuv420pPlanes
Tightly packed planar YUV420 data produced by a GPU readback.
Yuv420pReadback
A submitted GPU RGB-to-YUV420 conversion whose buffer is not mapped yet.
Yuv420pTargets
Destinations for the three planes of one packed frame.
YuvFrame
Borrowed planar or semi-planar YCbCr source of any subsampling and depth YuvFormat::is_supported accepts.
YuvSample
A normalized YUV sample and straight alpha value.

Enums§

BlendMode
Artistic RGB operation applied before Porter-Duff source-over coverage.
BlendSpace
Color space in which compositing arithmetic is evaluated.
CacheEligibility
Whether a node’s result can be cached, and if not, why.
CacheIntent
Whether a node’s result may be kept and reused.
CacheInvalidation
Why cached results were dropped all at once.
CapabilityDiagnostic
One deterministic fallback selected from adapter facts and caller budgets.
ColorDiagnostic
Observable color-pipeline diagnostic.
ColorError
Color conversion failure.
ColorPolicy
What happens to an HDR (PQ or HLG) source.
DiagnosticSeverity
Shader compiler message severity.
EffectKind
Runtime shader category.
EffectResourceKind
Representation an effect resource binding expects from its registered data.
GraphError
Structural or execution failure in a render graph.
ParamType
Host-side parameter representation.
ParamUnit
Semantic unit exposed to authoring hosts.
ParamValue
Typed default parameter value.
ReadbackFailure
Where a texture readback failed.
RenderError
Render input or output failure.
RenderNodeKind
Public category of a render graph node.
SdrOutputTransfer
SDR transfer used when encoding a render result.
SourceAlpha
How an RGBA source texture stores color relative to its alpha.
TimingSource
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 n masks is MASK_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 kind parameter.
PAINT_SPREADS
Enum values of a paint’s spread parameter.
TRACK_MATTE_EFFECT_ID
Internal identifier of the track-matte pass.

Traits§

ExternalTextureLease
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_catalog for 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 color is 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 count masks (1 to MAX_SHAPE_MASKS) into its source’s coverage. Mask i is the named input m{i}, whose alpha is the mask’s coverage (drawn by the vector pass, feathered by a blur), inverted when invert{i} is set, and combined with the masks before it by mode{i}: coverage starts empty when the first mask adds and full otherwise; add is c + m - c m, subtract c (1 - m), intersect c m. The source is kept by the result.
mask_combine_definitions
Every mask-combine pass, for one to MAX_SHAPE_MASKS masks.
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 size stages: 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.