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