astrelis_render/lib.rs
1//! Astrelis Render - Modular rendering framework for Astrelis
2//!
3//! This crate provides:
4//! - Graphics context management
5//! - Window rendering contexts
6//! - Frame and render pass management
7//! - Compute pass management
8//! - Framebuffer abstraction for offscreen rendering
9//! - Render target abstraction (Surface/Framebuffer)
10//! - Blend mode presets for common scenarios
11//! - GPU feature detection and management
12//! - Indirect draw buffer support for GPU-driven rendering
13//! - Texture blitting for fullscreen quad rendering
14//! - Sprite sheet support for animations
15//! - Low-level extensible Renderer for WGPU resource management
16//! - Building blocks for higher-level renderers (TextRenderer, SceneRenderer, etc.)
17//!
18//! ## Error Handling
19//!
20//! This crate uses consistent error handling patterns:
21//!
22//! ### Result Types
23//! - **Creation methods** return `Result<T, GraphicsError>` for GPU initialization
24//! - Example: `GraphicsContext::new_owned_sync()` returns `Result<Arc<Self>, GraphicsError>`
25//! - **Fallible operations** return `Result<T, E>` with specific error types
26//! - Example: `Readback::read()` returns `Result<Vec<u8>, ReadbackError>`
27//! - **Use `.expect()` for examples/tests** where error handling isn't critical
28//! - Example: `let ctx = GraphicsContext::new_owned_sync().expect("GPU required")`
29//!
30//! ### Option Types
31//! - **Optional resources** return `Option<&T>` for possibly-missing values
32//! - Example: `WindowManager::get_window(id)` returns `Option<&RenderWindow>`
33//! - **Hit testing** returns `Option<T>` for no-hit scenarios
34//! - Example: `hit_test(point)` returns `Option<WidgetId>`
35//!
36//! ### Panicking vs Fallible
37//! - **Avoid panic-suffixed methods** - Use `.expect()` at call sites instead
38//! - ❌ Bad: `resource_or_panic()` method
39//! - ✅ Good: `resource().expect("Resource required")` at call site
40//! - **Provide both variants** for common operations
41//! - `resource()` - Panics if unavailable (use when required)
42//! - `try_resource()` - Returns `Option` (use when optional)
43
44mod atlas;
45pub mod batched;
46mod blend;
47mod blit;
48mod buffer_pool;
49mod camera;
50pub mod capability;
51mod color;
52mod compute;
53mod context;
54mod depth;
55mod extension;
56mod features;
57mod frame;
58mod framebuffer;
59pub mod gpu_profiling;
60mod indirect;
61mod line_renderer;
62mod material;
63mod mesh;
64mod point_renderer;
65mod quad_renderer;
66mod query;
67mod readback;
68mod render_graph;
69mod renderer;
70mod sampler_cache;
71mod sprite;
72mod target;
73pub mod transform;
74mod types;
75mod window;
76mod window_manager;
77
78// Re-export all modules
79pub use atlas::*;
80pub use blend::*;
81pub use blit::*;
82pub use buffer_pool::*;
83pub use camera::*;
84pub use capability::{GpuRequirements, RenderCapability};
85pub use color::*;
86pub use compute::*;
87pub use context::*;
88pub use depth::*;
89pub use extension::*;
90pub use features::*;
91pub use frame::*;
92pub use framebuffer::*;
93pub use indirect::*;
94pub use line_renderer::*;
95pub use material::*;
96pub use mesh::*;
97pub use point_renderer::*;
98pub use quad_renderer::*;
99pub use query::*;
100pub use readback::*;
101pub use render_graph::*;
102pub use renderer::*;
103pub use sampler_cache::*;
104pub use sprite::*;
105pub use target::*;
106pub use transform::{DataRangeParams, DataTransform};
107pub use types::*;
108pub use window::*;
109pub use window_manager::*;
110
111// Re-export wgpu under 'wgpu' module
112pub use wgpu;