Skip to main content

strata_render/
lib.rs

1//! Strata Render: Display List, Stacking Context Compositor, Analytical SDF GPU Rasterizer, and Unified 3D Engine.
2//!
3//! # Examples
4//!
5//! ```rust
6//! use strata_render::compositor::DisplayList;
7//!
8//! let dl = DisplayList::new();
9//! assert_eq!(dl.len(), 0);
10//! ```
11
12#![allow(
13    clippy::too_many_arguments,
14    clippy::type_complexity,
15    clippy::field_reassign_with_default,
16    clippy::chunks_exact_to_as_chunks,
17    clippy::should_implement_trait,
18    clippy::collapsible_match
19)]
20
21pub mod blur;
22pub mod camera64;
23pub mod canvas2d;
24pub mod compositor;
25pub mod custom_shader;
26pub mod font;
27pub mod geometry3d;
28pub mod gpu3d;
29pub mod gpu_context;
30pub mod gpu_pipeline;
31#[cfg(feature = "wgpu-backend")]
32pub mod gpu_wgpu;
33pub mod kinetic_scroll;
34pub mod math3d;
35pub mod multi_window_compositor;
36pub mod orbit_controls;
37pub mod overlay3d;
38pub mod rasterizer;
39pub mod rasterizer3d;
40pub mod scene3d;
41pub mod shared_target;
42pub mod shm_compositor;
43pub mod swapchain;
44pub mod terrain3d;
45pub mod texture3d;
46pub mod texture_atlas;
47pub mod tiling;
48
49// Re-exports
50pub use canvas2d::{
51    canvas_verbs_bounds, flatten_canvas_verbs, parse_canvas_font, rasterize_canvas_commands,
52    Canvas2DContext, CanvasCommand, CanvasPathVerb, CanvasTextAlign, CanvasTextBaseline,
53    Transform2D,
54};
55pub use compositor::{Compositor, DamageTracker, DisplayList, DrawCommand};
56pub use custom_shader::{
57    CustomShaderPipeline, FaceCullMode, GpuRenderCallback, GpuRenderContext, PrimitiveTopology,
58    WgslShaderSource, WGSL_COMPUTE_TELEMETRY_SHADER, WGSL_PBR_3D_SHADER,
59};
60pub use font::{
61    get_glyph, get_glyph_or_fallback, map_common_unicode, FontFallbackChain, GenericFontFamily,
62    OsPlatform, SystemFontResolver, FONT_GLYPH_HEIGHT, FONT_GLYPH_WIDTH, TOFU_GLYPH,
63};
64pub use geometry3d::{
65    generate_box, generate_custom, generate_cylinder, generate_plane, generate_sphere, MeshBuffers,
66    Vertex3D,
67};
68pub use gpu_pipeline::{
69    GpuBatch, GpuBatchCollector, GpuBatchSummary, GpuCompareFunction, GpuDepthStencilState,
70    GpuPathBatch, GpuPathPipeline, GpuPresentationPipeline, GpuPrimitiveTopology, GpuQuadInstance,
71    GpuRenderPipeline, GpuShaderCompiler, GpuShaderModule, GpuSlugTextPipeline, GpuUniforms,
72    GpuVertex, GpuVertexAttribute, GpuVertexBufferLayout, GpuVertexFormat, GpuVertexStepMode,
73    QUAD_VERTICES, WGSL_ANALYTICAL_QUAD_SHADER,
74};
75pub use kinetic_scroll::{
76    KineticScrollController, ScrollAxis, DEFAULT_FRICTION, REST_VELOCITY_THRESHOLD,
77    RUBBER_BAND_MAX_LIMIT, SPRING_DAMPING, SPRING_STIFFNESS,
78};
79pub use math3d::{Mat4, Ray3D, Vec3, Vec4};
80pub use orbit_controls::{OrbitControls, OrbitInteractionMode};
81pub use rasterizer::{sd_rounded_rect, sdf_coverage, FrameBuffer, Rasterizer};
82pub use scene3d::{Camera3D, Geometry3D, Light3D, Material3D, Mesh3D, Scene3D, Transform3D};
83pub use shared_target::{render_hybrid_frame, SharedRenderTarget};
84pub use shm_compositor::{
85    CompositorTelemetry, ShmFrameSlot, ShmRingBuffer, SlotState, ZeroCopyCompositor,
86};
87pub use strata_gpu_path as gpu_path;
88pub use strata_layout::{FillRule, StrokeLineCap, StrokeLineJoin, SvgItem};
89pub use swapchain::{
90    HardwareBackend, HardwareSwapchainPresenter, PresentError, PresentMode,
91    SoftwareSurfacePresenter, SurfacePresenter, SwapchainCompositor, SwapchainFormat,
92};
93
94pub use blur::{BackdropFilterPipeline, WGSL_SEPARABLE_GAUSSIAN_BLUR_SHADER};
95pub use gpu3d::{Gpu3DPipeline, Gpu3DUniforms, Gpu3DVertex, WGSL_3D_STANDARD_SHADER};
96pub use gpu_context::{
97    GpuAdapter, GpuBackend, GpuBufferHandle, GpuBufferUsage, GpuCommandEncoder, GpuContext,
98    GpuDevice, GpuDeviceType, GpuFeatures, GpuLimits, GpuMemoryLocation, GpuOffscreenSurface,
99    GpuPresentMode, GpuQueue, GpuRenderPassDescriptor, GpuSurfacePresenter, GpuSwapchain,
100    GpuTextureHandle,
101};
102pub use multi_window_compositor::{MultiWindowCompositor, WindowSwapchainState};
103pub use texture_atlas::{AtlasRegion, GpuTextureAtlas};
104pub use tiling::{OcclusionTracker, Tile, TileCoord, TilingSet, DEFAULT_TILE_SIZE};
105
106pub mod prelude {
107    pub use crate::blur::BackdropFilterPipeline;
108    pub use crate::canvas2d::Canvas2DContext;
109    pub use crate::compositor::{Compositor, DamageTracker, DisplayList, DrawCommand};
110    pub use crate::custom_shader::{CustomShaderPipeline, GpuRenderContext};
111    pub use crate::geometry3d::{
112        generate_box, generate_custom, generate_cylinder, generate_plane, generate_sphere,
113        MeshBuffers, Vertex3D,
114    };
115    pub use crate::gpu3d::{Gpu3DPipeline, WGSL_3D_STANDARD_SHADER};
116    pub use crate::gpu_context::{
117        GpuAdapter, GpuBackend, GpuDevice, GpuDeviceType, GpuPresentMode, GpuSurfacePresenter,
118        GpuSwapchain,
119    };
120    pub use crate::gpu_pipeline::GpuSlugTextPipeline;
121    pub use crate::kinetic_scroll::KineticScrollController;
122    pub use crate::math3d::{Mat4, Ray3D, Vec3, Vec4};
123    pub use crate::multi_window_compositor::MultiWindowCompositor;
124    pub use crate::orbit_controls::OrbitControls;
125    pub use crate::rasterizer::{FrameBuffer, Rasterizer};
126    pub use crate::scene3d::*;
127    pub use crate::shared_target::SharedRenderTarget;
128    pub use crate::shm_compositor::{
129        CompositorTelemetry, ShmFrameSlot, ShmRingBuffer, ZeroCopyCompositor,
130    };
131    pub use crate::swapchain::{
132        PresentError, SoftwareSurfacePresenter, SurfacePresenter, SwapchainCompositor,
133        SwapchainFormat,
134    };
135    pub use crate::texture_atlas::GpuTextureAtlas;
136}