StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | //! StratoUI Renderer |
| 2 | //! |
| 3 | //! A high-performance, GPU-accelerated 2D renderer built on wgpu. |
| 4 | //! Designed for modern UI frameworks with a focus on performance and flexibility. |
| 5 | //! |
| 6 | //! ## Features |
| 7 | //! - Advanced GPU device management with multi-adapter support |
| 8 | //! - Intelligent resource management with automatic pooling and deframmentation |
| 9 | //! - Sophisticated memory management with multi-tier allocation |
| 10 | //! - Dynamic shader compilation with hot-reload support |
| 11 | //! - Modular pipeline system with render graph optimization |
| 12 | //! - Efficient buffer management with lock-free operations |
| 13 | //! - Comprehensive performance profiling and monitoring |
| 14 | //! - Enterprise-grade error handling and recovery |
| 15 | |
| 16 | pub mod batch; |
| 17 | pub mod buffer; |
| 18 | pub mod device; |
| 19 | pub mod font_config; |
| 20 | pub mod font_system; |
| 21 | pub mod glyph_atlas; |
| 22 | pub mod gpu; // Modular GPU pipeline |
| 23 | pub mod memory; |
| 24 | pub mod pipeline; |
| 25 | pub mod profiler; |
| 26 | pub mod resources; |
| 27 | pub mod shader; |
| 28 | pub mod text; |
| 29 | pub mod texture; |
| 30 | pub mod vertex; |
| 31 | |
| 32 | pub mod backend; |
| 33 | |
| 34 | pub mod integration; |
| 35 | |
| 36 | // Re-export commonly used types |
| 37 | pub use backend::commands::RenderCommand; |
| 38 | pub use backend::Backend; |
| 39 | pub use batch::RenderBatch; |
| 40 | pub use buffer::{BufferManager, BufferPool, DynamicBuffer}; |
| 41 | pub use device::{AdapterInfo, DeviceManager, ManagedDevice}; |
| 42 | pub use integration::{IntegratedRenderer, RenderContext, RenderStats, RendererBuilder}; |
| 43 | pub use memory::{AllocationStrategy, MemoryManager, MemoryPool}; |
| 44 | pub use pipeline::{PipelineManager, RenderGraph, RenderNode}; |
| 45 | pub use profiler::{FrameStats, PerformanceReport, Profiler}; |
| 46 | pub use resources::{ResourceHandle, ResourceManager, ResourceType}; |
| 47 | pub use shader::{CompiledShader, ShaderManager, ShaderSource}; |
| 48 | |
| 49 | /// Renderer configuration |
| 50 | #[derive(Debug, Clone)] |
| 51 | pub struct RendererConfig { |
| 52 | /// Enable MSAA |
| 53 | pub msaa_samples: u32, |
| 54 | /// Enable vsync |
| 55 | pub vsync: bool, |
| 56 | /// Maximum texture atlas size |
| 57 | pub max_texture_size: u32, |
| 58 | /// Enable GPU validation (debug mode) |
| 59 | pub validation: bool, |
| 60 | } |
| 61 | |
| 62 | impl Default for RendererConfig { |
| 63 | fn default() -> Self { |
| 64 | Self { |
| 65 | msaa_samples: 4, |
| 66 | vsync: true, |
| 67 | max_texture_size: 4096, |
| 68 | validation: cfg!(debug_assertions), |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | /// Initialize the renderer |
| 74 | pub fn init(config: RendererConfig) -> anyhow::Result<()> { |
| 75 | tracing::info!("Initializing StratoUI Renderer with config: {:?}", config); |
| 76 | Ok(()) |
| 77 | } |
| 78 | |
| 79 | #[cfg(test)] |
| 80 | mod tests { |
| 81 | use super::*; |
| 82 | |
| 83 | #[test] |
| 84 | fn test_default_config() { |
| 85 | let config = RendererConfig::default(); |
| 86 | assert_eq!(config.msaa_samples, 4); |
| 87 | assert!(config.vsync); |
| 88 | } |
| 89 | } |
| 90 |