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 paint_wgsl;
35mod pipeline;
36mod pool;
37mod quad;
38mod readback;
39mod registry;
40pub use registry::{CompiledEffect, MAX_EFFECT_INPUTS, PendingEffect};
41mod renderer;
42mod repack;
43mod result_cache;
44mod retire;
45mod robustness;
46mod runtime_effect;
47mod settle;
48mod shader_inventory;
49mod target;
50#[cfg(test)]
51mod tests;
52mod uniform;
53mod vector;
54mod yuv;
55
56/// Shared ownership of the renderer's pools and the textures they recycle.
57///
58/// Those hold wgpu objects, which are neither `Send` nor `Sync` on wasm, so an
59/// atomic count would buy nothing there.
60#[cfg(not(target_arch = "wasm32"))]
61pub(crate) type Shared<T> = std::sync::Arc<T>;
62#[cfg(target_arch = "wasm32")]
63pub(crate) type Shared<T> = std::rc::Rc<T>;
64
65pub use blend::{BlendMode, BlendSpace};
66pub use builtins::{
67    CHROMA_KEY_ID, GAUSSIAN_BLUR_ID, GLOW_ID, LUT_3D_ID, builtin_effect_definitions,
68    builtin_transition_definitions, chroma_key_definition, gaussian_blur_definition,
69    glow_definition, lut_3d_definition,
70};
71pub use catalog::{builtin_catalog, builtin_catalog_json};
72pub use color::{
73    Color, ColorDiagnostic, ColorError, ColorPolicy, SdrOutputTransfer, YuvSample,
74    convert_yuv_to_linear_rgba, encode_linear_rgb, is_hdr,
75};
76pub use composite::{CompositeLayer, LayerTransform};
77pub use diagnostics::{
78    AdapterDiagnostics, BenchmarkMetadata, PassTiming, RenderDiagnostics, TimingSource,
79};
80pub use effect::{
81    DiagnosticSeverity, EffectDef, EffectId, EffectKind, EffectParams, EffectResourceKind,
82    EffectResources, EffectRuntime, InputSpec, ParamSpec, ParamType, ParamUnit, ParamValue,
83    ResourceSpec, ShaderDiagnostic, ShaderDiagnostics, UniformField, UniformLayout,
84};
85pub use effect_resource::{Lut3dData, LutParseError};
86pub use error::{
87    DEFAULT_GPU_WAIT_TIMEOUT, GPU_DEVICE_LOST_MESSAGE, GPU_TIMEOUT_MESSAGE,
88    GPU_WORK_DROPPED_MESSAGE, ReadbackFailure, RenderError,
89};
90pub use generator::{
91    FILL_PAINT_PARAMS, GENERATOR_EFFECT_ID, MAX_GENERATOR_STOPS, PAINT_KINDS, PAINT_SPREADS,
92    PaintParams, generator_definition,
93};
94pub use gpu_errors::GpuErrorReports;
95pub use graph::{
96    EffectInputs, GraphError, GraphLayer, RenderCacheKey, RenderGraph, RenderNodeId, RenderNodeKind,
97};
98pub use graph_plan::RenderPlan;
99pub use graph_submit::FrameSubmitTimings;
100pub use masking::{
101    MASK_COMBINE_EFFECT_IDS, MASK_COMBINE_NAMES, MASK_MODES, MAX_SHAPE_MASKS, MaskCombineNames,
102    TRACK_MATTE_EFFECT_ID, mask_combine_definition, mask_combine_definitions,
103    track_matte_definition,
104};
105pub use pipeline::{PipelineCacheStats, WarmupReport};
106pub use pool::{ReadbackBufferPoolStats, TexturePoolStats, UploadTexture, UploadTexturePoolStats};
107pub use readback::{
108    EncodedNv12Pack, Nv12PlaneTargets, PlaneTarget, Rgba8Readback, StagingPlane, Yuv420pPlanes,
109    Yuv420pReadback, Yuv420pTargets, yuv420p_staging_bytes,
110};
111pub use renderer::{RenderQualityControls, Renderer};
112pub use repack::RepackSource;
113pub use result_cache::{CacheEligibility, CacheIntent, CacheInvalidation, ResultCacheStats};
114pub use robustness::{
115    CapabilityDiagnostic, DegradationDecision, ResourceBudget, filter_sample_limit,
116    resolve_degradation,
117};
118pub use shader_inventory::{builtin_wgsl_modules, effect_wgsl};
119pub use target::{RenderSize, RenderedTexture, SourceView};
120pub use uniform::UniformBufferPoolStats;
121pub use yuv::{
122    ExternalTextureLease, GpuVideoPlanes, PendingSourceWork, PreparedSourceTexture, SourceAlpha,
123    SourcePlane, SourcePresentation, Yuv420Frame, YuvFrame,
124};