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    rasterize_canvas_commands, Canvas2DContext, CanvasCommand, CanvasPathVerb, Transform2D,
52};
53pub use compositor::{Compositor, DamageTracker, DisplayList, DrawCommand};
54pub use custom_shader::{
55    CustomShaderPipeline, FaceCullMode, GpuRenderCallback, GpuRenderContext, PrimitiveTopology,
56    WgslShaderSource, WGSL_COMPUTE_TELEMETRY_SHADER, WGSL_PBR_3D_SHADER,
57};
58pub use font::{
59    get_glyph, get_glyph_or_fallback, map_common_unicode, FontFallbackChain, GenericFontFamily,
60    OsPlatform, SystemFontResolver, FONT_GLYPH_HEIGHT, FONT_GLYPH_WIDTH, TOFU_GLYPH,
61};
62pub use geometry3d::{
63    generate_box, generate_custom, generate_cylinder, generate_plane, generate_sphere, MeshBuffers,
64    Vertex3D,
65};
66pub use gpu_pipeline::{
67    GpuBatch, GpuBatchCollector, GpuBatchSummary, GpuCompareFunction, GpuDepthStencilState,
68    GpuPathBatch, GpuPathPipeline, GpuPresentationPipeline, GpuPrimitiveTopology, GpuQuadInstance,
69    GpuRenderPipeline, GpuShaderCompiler, GpuShaderModule, GpuSlugTextPipeline, GpuUniforms,
70    GpuVertex, GpuVertexAttribute, GpuVertexBufferLayout, GpuVertexFormat, GpuVertexStepMode,
71    QUAD_VERTICES, WGSL_ANALYTICAL_QUAD_SHADER,
72};
73pub use kinetic_scroll::{
74    KineticScrollController, ScrollAxis, DEFAULT_FRICTION, REST_VELOCITY_THRESHOLD,
75    RUBBER_BAND_MAX_LIMIT, SPRING_DAMPING, SPRING_STIFFNESS,
76};
77pub use math3d::{Mat4, Ray3D, Vec3, Vec4};
78pub use orbit_controls::{OrbitControls, OrbitInteractionMode};
79pub use rasterizer::{sd_rounded_rect, sdf_coverage, FrameBuffer, Rasterizer};
80pub use scene3d::{Camera3D, Geometry3D, Light3D, Material3D, Mesh3D, Scene3D, Transform3D};
81pub use shared_target::{render_hybrid_frame, SharedRenderTarget};
82pub use shm_compositor::{
83    CompositorTelemetry, ShmFrameSlot, ShmRingBuffer, SlotState, ZeroCopyCompositor,
84};
85pub use strata_gpu_path as gpu_path;
86pub use strata_layout::{FillRule, StrokeLineCap, StrokeLineJoin, SvgItem};
87pub use swapchain::{
88    HardwareBackend, HardwareSwapchainPresenter, PresentError, PresentMode,
89    SoftwareSurfacePresenter, SurfacePresenter, SwapchainCompositor, SwapchainFormat,
90};
91
92pub use blur::{BackdropFilterPipeline, WGSL_SEPARABLE_GAUSSIAN_BLUR_SHADER};
93pub use gpu3d::{Gpu3DPipeline, Gpu3DUniforms, Gpu3DVertex, WGSL_3D_STANDARD_SHADER};
94pub use gpu_context::{
95    GpuAdapter, GpuBackend, GpuBufferHandle, GpuBufferUsage, GpuCommandEncoder, GpuContext,
96    GpuDevice, GpuDeviceType, GpuFeatures, GpuLimits, GpuMemoryLocation, GpuOffscreenSurface,
97    GpuPresentMode, GpuQueue, GpuRenderPassDescriptor, GpuSurfacePresenter, GpuSwapchain,
98    GpuTextureHandle,
99};
100pub use multi_window_compositor::{MultiWindowCompositor, WindowSwapchainState};
101pub use texture_atlas::{AtlasRegion, GpuTextureAtlas};
102pub use tiling::{OcclusionTracker, Tile, TileCoord, TilingSet, DEFAULT_TILE_SIZE};
103
104pub mod prelude {
105    pub use crate::blur::BackdropFilterPipeline;
106    pub use crate::canvas2d::Canvas2DContext;
107    pub use crate::compositor::{Compositor, DamageTracker, DisplayList, DrawCommand};
108    pub use crate::custom_shader::{CustomShaderPipeline, GpuRenderContext};
109    pub use crate::geometry3d::{
110        generate_box, generate_custom, generate_cylinder, generate_plane, generate_sphere,
111        MeshBuffers, Vertex3D,
112    };
113    pub use crate::gpu3d::{Gpu3DPipeline, WGSL_3D_STANDARD_SHADER};
114    pub use crate::gpu_context::{
115        GpuAdapter, GpuBackend, GpuDevice, GpuDeviceType, GpuPresentMode, GpuSurfacePresenter,
116        GpuSwapchain,
117    };
118    pub use crate::gpu_pipeline::GpuSlugTextPipeline;
119    pub use crate::kinetic_scroll::KineticScrollController;
120    pub use crate::math3d::{Mat4, Ray3D, Vec3, Vec4};
121    pub use crate::multi_window_compositor::MultiWindowCompositor;
122    pub use crate::orbit_controls::OrbitControls;
123    pub use crate::rasterizer::{FrameBuffer, Rasterizer};
124    pub use crate::scene3d::*;
125    pub use crate::shared_target::SharedRenderTarget;
126    pub use crate::shm_compositor::{
127        CompositorTelemetry, ShmFrameSlot, ShmRingBuffer, ZeroCopyCompositor,
128    };
129    pub use crate::swapchain::{
130        PresentError, SoftwareSurfacePresenter, SurfacePresenter, SwapchainCompositor,
131        SwapchainFormat,
132    };
133    pub use crate::texture_atlas::GpuTextureAtlas;
134}