Skip to main content

alpha2_render/
lib.rs

1//! GPU compositing public API.
2//!
3//! # `wgpu` interop
4//!
5//! By default the API names no `wgpu` type: sources enter as [`SourceView`]s and results leave
6//! as [`RenderedTexture`]s and readbacks. Items taking or returning `wgpu` handles are
7//! documented only with the `wgpu-interop` feature, track `wgpu`'s major version, and are
8//! otherwise hidden and not part of this crate's API.
9
10mod backend;
11mod blend;
12mod builtins;
13mod call_budget;
14mod canary;
15mod catalog;
16mod color;
17mod composite;
18mod cpu;
19mod diagnostics;
20mod effect;
21mod effect_cost;
22mod effect_resource;
23mod error;
24mod frame_gpu_time;
25pub use frame_gpu_time::FrameGpuTimes;
26pub use present::SurfacePresenter;
27mod gaussian_blur;
28mod generator;
29mod gpu_errors;
30mod graph;
31mod graph_cache;
32mod graph_execute;
33mod graph_plan;
34mod graph_submit;
35pub mod hdr;
36mod layout_pack;
37mod loop_bound;
38mod masking;
39mod paint_wgsl;
40mod pipeline;
41mod pool;
42mod present;
43mod readback;
44mod registry;
45pub use registry::{CheckedEffect, CompiledEffect, MAX_EFFECT_INPUTS, PendingEffect, check_effect};
46mod renderer;
47mod repack;
48mod result_cache;
49mod retire;
50mod robustness;
51mod runtime_effect;
52mod settle;
53mod shader_inventory;
54mod submission_clock;
55mod submission_planner;
56pub use submission_planner::{FrameCost, FrameSubmissions};
57mod target;
58#[cfg(test)]
59mod tests;
60mod uniform;
61mod vector;
62mod yuv;
63
64/// Shared ownership of the renderer's pools. Not atomic on wasm, where wgpu objects are neither
65/// `Send` nor `Sync`.
66#[cfg(not(target_arch = "wasm32"))]
67pub(crate) type Shared<T> = std::sync::Arc<T>;
68#[cfg(target_arch = "wasm32")]
69pub(crate) type Shared<T> = std::rc::Rc<T>;
70
71pub use backend::{EffectCatalog, RenderControls};
72pub use blend::{BlendMode, BlendSpace};
73pub use builtins::{
74    CHROMA_KEY_ID, GAUSSIAN_BLUR_ID, GLOW_ID, LUT_3D_ID, builtin_effect_definitions,
75    builtin_transition_definitions, chroma_key_definition, gaussian_blur_definition,
76    glow_definition, lut_3d_definition,
77};
78pub use catalog::{builtin_catalog, builtin_catalog_document, builtin_catalog_json};
79pub use color::{
80    Color, ColorDiagnostic, ColorError, ColorPolicy, SdrOutputTransfer, YuvSample,
81    convert_yuv_to_linear_rgba, encode_linear_rgb, is_hdr,
82};
83pub use composite::{CompositeLayer, LayerTransform};
84pub use cpu::{
85    BandProgress, CpuImage, CpuRenderStats, CpuRenderer, CpuSource, RgbaPixels, YuvPlanes, decoded,
86    report_band_progress,
87};
88pub use diagnostics::{
89    AdapterDiagnostics, BenchmarkMetadata, GpuSubmissionStats, PassTiming, PipelineCreation,
90    PipelineCreationStats, RenderDiagnostics, TimingSource,
91};
92pub use effect::{
93    DiagnosticSeverity, EffectDef, EffectId, EffectKind, EffectParams, EffectResourceKind,
94    EffectResources, EffectRuntime, InputSpec, ParamSpec, ParamType, ParamUnit, ParamValue,
95    ResourceSpec, ShaderDiagnostic, ShaderDiagnostics, UniformField, UniformLayout,
96};
97pub use effect_resource::{Lut3dData, LutParseError};
98pub use error::{
99    DEFAULT_GPU_WAIT_TIMEOUT, GPU_DEVICE_LOST_MESSAGE, GPU_TIMEOUT_MESSAGE,
100    GPU_WORK_DROPPED_MESSAGE, ReadbackFailure, RenderError,
101};
102pub use gaussian_blur::blur_sigma_pixels;
103pub use generator::{
104    FILL_PAINT_PARAMS, GENERATOR_EFFECT_ID, MAX_GENERATOR_STOPS, PAINT_KINDS, PAINT_SPREADS,
105    PaintParams, generator_definition,
106};
107pub use gpu_errors::GpuErrorReports;
108pub use graph::{
109    EffectInputs, GraphError, GraphLayer, RenderCacheKey, RenderGraph, RenderNodeId, RenderNodeKind,
110};
111pub use graph_plan::RenderPlan;
112pub use graph_submit::FrameSubmitTimings;
113pub use masking::{
114    MASK_COMBINE_EFFECT_IDS, MASK_COMBINE_NAMES, MASK_MODES, MAX_SHAPE_MASKS, MaskCombineNames,
115    TRACK_MATTE_EFFECT_ID, mask_combine_definition, mask_combine_definitions,
116    track_matte_definition,
117};
118pub use pipeline::{PipelineCacheStats, WarmupReport};
119pub use pool::{ReadbackBufferPoolStats, TexturePoolStats, UploadTexture, UploadTexturePoolStats};
120pub use readback::{
121    EncodedNv12Pack, Nv12PlaneTargets, PlaneTarget, Rgba8Readback, StagingPlane, Yuv420pPlanes,
122    Yuv420pReadback, Yuv420pTargets, layout_staging_bytes, yuv420p_staging_bytes,
123};
124pub use renderer::{LossClassifier, RenderQualityControls, Renderer};
125pub use repack::RepackSource;
126pub use result_cache::{CacheEligibility, CacheIntent, CacheInvalidation, ResultCacheStats};
127pub use robustness::{
128    CapabilityDiagnostic, DegradationDecision, ResourceBudget, filter_sample_limit,
129    resolve_degradation,
130};
131pub use shader_inventory::{builtin_wgsl_modules, effect_wgsl};
132pub use submission_clock::{FrameMark, SubmissionReport};
133pub use target::{RenderSize, RenderedTexture, SourceView};
134pub use uniform::UniformBufferPoolStats;
135pub use yuv::{
136    ExternalTextureLease, GpuVideoPlanes, PendingSourceWork, PreparedSourceTexture, SourceAlpha,
137    SourcePlane, SourcePresentation, Yuv420Frame, YuvFrame,
138};