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<&RenderableWindow>`
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
44pub mod batched;
45pub mod capability;
46pub mod gpu_profiling;
47mod atlas;
48mod blend;
49mod blit;
50mod buffer_pool;
51mod camera;
52mod color;
53mod compute;
54mod context;
55mod extension;
56mod features;
57mod frame;
58mod framebuffer;
59mod indirect;
60mod line_renderer;
61mod material;
62mod point_renderer;
63mod quad_renderer;
64mod mesh;
65mod query;
66mod readback;
67mod render_graph;
68mod renderer;
69mod sampler_cache;
70mod sprite;
71mod target;
72pub mod transform;
73mod types;
74mod window;
75mod window_manager;
76
77// Re-export all modules
78pub use atlas::*;
79pub use blend::*;
80pub use capability::{GpuRequirements, RenderCapability};
81pub use extension::*;
82pub use blit::*;
83pub use buffer_pool::*;
84pub use camera::*;
85pub use color::*;
86pub use compute::*;
87pub use context::*;
88pub use features::*;
89pub use frame::*;
90pub use framebuffer::*;
91pub use indirect::*;
92pub use line_renderer::*;
93pub use material::*;
94pub use point_renderer::*;
95pub use quad_renderer::*;
96pub use mesh::*;
97pub use query::*;
98pub use readback::*;
99pub use render_graph::*;
100pub use renderer::*;
101pub use sampler_cache::*;
102pub use sprite::*;
103pub use target::*;
104pub use transform::{DataRangeParams, DataTransform};
105pub use types::*;
106pub use window::*;
107pub use window_manager::*;
108
109// Re-export wgpu under 'wgpu' module
110pub use wgpu;