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_pilot;
56mod submission_planner;
57pub use submission_planner::{FrameCost, FrameSubmissions};
58mod target;
59#[cfg(test)]
60mod tests;
61mod uniform;
62mod vector;
63mod yuv;
64
65/// Shared ownership of the renderer's pools. Not atomic on wasm, where wgpu objects are neither
66/// `Send` nor `Sync`.
67#[cfg(not(target_arch = "wasm32"))]
68pub(crate) type Shared<T> = std::sync::Arc<T>;
69#[cfg(target_arch = "wasm32")]
70pub(crate) type Shared<T> = std::rc::Rc<T>;
71
72pub use backend::{EffectCatalog, RenderControls};
73pub use blend::{BlendMode, BlendSpace};
74pub use builtins::{
75    CHROMA_KEY_ID, GAUSSIAN_BLUR_ID, GLOW_ID, LUT_3D_ID, builtin_effect_definitions,
76    builtin_transition_definitions, chroma_key_definition, gaussian_blur_definition,
77    glow_definition, lut_3d_definition,
78};
79pub use catalog::{builtin_catalog, builtin_catalog_document, builtin_catalog_json};
80pub use color::{
81    Color, ColorDiagnostic, ColorError, ColorPolicy, SdrOutputTransfer, YuvSample,
82    convert_yuv_to_linear_rgba, encode_linear_rgb, is_hdr,
83};
84pub use composite::{CompositeLayer, LayerTransform};
85pub use cpu::{
86    BandProgress, CpuImage, CpuRenderStats, CpuRenderer, CpuSource, RgbaPixels, YuvPlanes, decoded,
87    report_band_progress,
88};
89pub use diagnostics::{
90    AdapterDiagnostics, BenchmarkMetadata, GpuSubmissionStats, PassTiming, PipelineCreation,
91    PipelineCreationStats, RenderDiagnostics, TimingSource,
92};
93pub use effect::{
94    DiagnosticSeverity, EffectDef, EffectId, EffectKind, EffectParams, EffectResourceKind,
95    EffectResources, EffectRuntime, InputSpec, ParamSpec, ParamType, ParamUnit, ParamValue,
96    ResourceSpec, ShaderDiagnostic, ShaderDiagnostics, UniformField, UniformLayout,
97};
98pub use effect_resource::{Lut3dData, LutParseError};
99pub use error::{
100    DEFAULT_GPU_WAIT_TIMEOUT, GPU_DEVICE_LOST_MESSAGE, GPU_TIMEOUT_MESSAGE,
101    GPU_WORK_DROPPED_MESSAGE, ReadbackFailure, RenderError,
102};
103pub use gaussian_blur::blur_sigma_pixels;
104pub use generator::{
105    FILL_PAINT_PARAMS, GENERATOR_EFFECT_ID, MAX_GENERATOR_STOPS, PAINT_KINDS, PAINT_SPREADS,
106    PaintParams, generator_definition,
107};
108pub use gpu_errors::GpuErrorReports;
109pub use graph::{
110    EffectInputs, GraphError, GraphLayer, RenderCacheKey, RenderGraph, RenderNodeId, RenderNodeKind,
111};
112pub use graph_plan::RenderPlan;
113pub use graph_submit::FrameSubmitTimings;
114pub use masking::{
115    MASK_COMBINE_EFFECT_IDS, MASK_COMBINE_NAMES, MASK_MODES, MAX_SHAPE_MASKS, MaskCombineNames,
116    TRACK_MATTE_EFFECT_ID, mask_combine_definition, mask_combine_definitions,
117    track_matte_definition,
118};
119pub use pipeline::{PipelineCacheStats, WarmupReport};
120pub use pool::{ReadbackBufferPoolStats, TexturePoolStats, UploadTexture, UploadTexturePoolStats};
121pub use readback::{
122    EncodedNv12Pack, Nv12PlaneTargets, PlaneTarget, Rgba8Readback, StagingPlane, Yuv420pPlanes,
123    Yuv420pReadback, Yuv420pTargets, layout_staging_bytes, yuv420p_staging_bytes,
124};
125pub use renderer::{LossClassifier, RenderQualityControls, Renderer};
126pub use repack::RepackSource;
127pub use result_cache::{CacheEligibility, CacheIntent, CacheInvalidation, ResultCacheStats};
128pub use robustness::{
129    CapabilityDiagnostic, DegradationDecision, ResourceBudget, filter_sample_limit,
130    resolve_degradation,
131};
132pub use shader_inventory::{builtin_wgsl_modules, effect_wgsl};
133pub use submission_clock::{FrameMark, SubmissionReport};
134pub use target::{RenderSize, RenderedTexture, SourceView};
135pub use uniform::UniformBufferPoolStats;
136pub use yuv::{
137    ExternalTextureLease, GpuVideoPlanes, PendingSourceWork, PreparedSourceTexture, SourceAlpha,
138    SourcePlane, SourcePresentation, Yuv420Frame, YuvFrame,
139};