Skip to main content

alpha2_render/
lib.rs

1//! GPU compositing public API.
2//!
3//! # `wgpu` interop
4//!
5//! The API names no `wgpu` type by default: sources come in as
6//! [`SourceView`]s and results go out as [`RenderedTexture`]s and readbacks.
7//! The items that take or return `wgpu` handles are the interop surface,
8//! documented with the `wgpu-interop` feature and following `wgpu`'s major
9//! version. Without the feature those items are hidden: alpha2's own crates
10//! share handles through them, and they are not part of this crate's API.
11
12mod blend;
13mod builtins;
14mod call_budget;
15mod canary;
16mod catalog;
17mod color;
18mod composite;
19mod diagnostics;
20mod effect;
21mod effect_resource;
22mod error;
23mod gaussian_blur;
24mod generator;
25mod gpu_errors;
26mod graph;
27mod graph_cache;
28mod graph_execute;
29mod graph_plan;
30mod graph_submit;
31pub mod hdr;
32mod loop_bound;
33mod masking;
34mod pipeline;
35mod pool;
36mod quad;
37mod readback;
38mod registry;
39pub use registry::{CompiledEffect, PendingEffect};
40mod renderer;
41mod repack;
42mod result_cache;
43mod retire;
44mod robustness;
45mod runtime_effect;
46mod settle;
47mod shader_inventory;
48mod target;
49#[cfg(test)]
50mod tests;
51mod uniform;
52mod yuv;
53
54/// Shared ownership of the renderer's pools and the textures they recycle.
55///
56/// Those hold wgpu objects, which are neither `Send` nor `Sync` on wasm, so an
57/// atomic count would buy nothing there.
58#[cfg(not(target_arch = "wasm32"))]
59pub(crate) type Shared<T> = std::sync::Arc<T>;
60#[cfg(target_arch = "wasm32")]
61pub(crate) type Shared<T> = std::rc::Rc<T>;
62
63pub use blend::{BlendMode, BlendSpace};
64pub use builtins::{
65    CHROMA_KEY_ID, GAUSSIAN_BLUR_ID, GLOW_ID, LUT_3D_ID, builtin_effect_definitions,
66    builtin_transition_definitions, chroma_key_definition, gaussian_blur_definition,
67    glow_definition, lut_3d_definition,
68};
69pub use catalog::{builtin_catalog, builtin_catalog_json};
70pub use color::{
71    Color, ColorDiagnostic, ColorError, ColorPolicy, SdrOutputTransfer, YuvSample,
72    convert_yuv_to_linear_rgba, encode_linear_rgb, is_hdr,
73};
74pub use composite::{CompositeLayer, LayerTransform};
75pub use diagnostics::{
76    AdapterDiagnostics, BenchmarkMetadata, PassTiming, RenderDiagnostics, TimingSource,
77};
78pub use effect::{
79    DiagnosticSeverity, EffectDef, EffectId, EffectInputs, EffectKind, EffectParams,
80    EffectResourceKind, EffectResources, EffectRuntime, ParamSpec, ParamType, ParamUnit,
81    ParamValue, ResourceSpec, ShaderDiagnostic, ShaderDiagnostics, UniformField, UniformLayout,
82};
83pub use effect_resource::{Lut3dData, LutParseError};
84pub use error::{
85    DEFAULT_GPU_WAIT_TIMEOUT, GPU_DEVICE_LOST_MESSAGE, GPU_TIMEOUT_MESSAGE,
86    GPU_WORK_DROPPED_MESSAGE, ReadbackFailure, RenderError,
87};
88pub use generator::{
89    FILL_PAINT_PARAMS, GENERATOR_EFFECT_ID, GENERATOR_SHAPES, MAX_GENERATOR_STOPS, PAINT_KINDS,
90    PAINT_SPREADS, PaintParams, STROKE_PAINT_PARAMS, generator_definition,
91};
92pub use gpu_errors::GpuErrorReports;
93pub use graph::{
94    GraphError, GraphLayer, RenderCacheKey, RenderGraph, RenderNodeId, RenderNodeKind,
95};
96pub use graph_plan::RenderPlan;
97pub use graph_submit::FrameSubmitTimings;
98pub use masking::{
99    MASK_MODES, MAX_SHAPE_MASKS, SHAPE_MASK_EFFECT_ID, SHAPE_MASK_PARAMS, ShapeMaskParams,
100    TRACK_MATTE_EFFECT_ID, shape_mask_definition, track_matte_definition,
101};
102pub use pipeline::{PipelineCacheStats, WarmupReport};
103pub use pool::{ReadbackBufferPoolStats, TexturePoolStats, UploadTexture, UploadTexturePoolStats};
104pub use readback::{
105    EncodedNv12Pack, Nv12PlaneTargets, PlaneTarget, Rgba8Readback, StagingPlane, Yuv420pPlanes,
106    Yuv420pReadback, Yuv420pTargets, yuv420p_staging_bytes,
107};
108pub use renderer::{RenderQualityControls, Renderer};
109pub use repack::RepackSource;
110pub use result_cache::{CacheEligibility, CacheIntent, CacheInvalidation, ResultCacheStats};
111pub use robustness::{
112    CapabilityDiagnostic, DegradationDecision, ResourceBudget, filter_sample_limit,
113    resolve_degradation,
114};
115pub use shader_inventory::{builtin_wgsl_modules, effect_wgsl};
116pub use target::{RenderSize, RenderedTexture, SourceView};
117pub use uniform::UniformBufferPoolStats;
118pub use yuv::{
119    ExternalTextureLease, GpuVideoPlanes, PendingSourceWork, PreparedSourceTexture, SourceAlpha,
120    SourcePlane, SourcePresentation, Yuv420Frame, YuvFrame,
121};