1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! # shdrlib
//!
//! A high-level shader compilation and rendering library for Rust, built on top of `wgpu` and `naga`.
//!
//! shdrlib abstracts away the complexity of GPU programming, allowing developers to focus on shader
//! logic rather than boilerplate setup. It provides a streamlined API for shader compilation,
//! pipeline management, and GPU-accelerated rendering.
//!
//! ## Features
//!
//! - Multi-language shader support (WGSL, GLSL, SPIR-V)
//! - Automatic GPU device and queue management
//! - Pipeline builder pattern for render configuration
//! - Asset management system for shaders and pipelines
//! - Offscreen and window-based rendering support
//!
//! ## Quick Start
//!
//! ```no_run
//! use shdrlib::{AssetManager, RuntimeManager, Language};
//!
//! let shader_source = r#"
//! @vertex
//! fn vs_main(@builtin(vertex_index) idx: u32) -> @builtin(position) vec4<f32> {
//! return vec4<f32>(0.0, 0.0, 0.0, 1.0);
//! }
//! @fragment
//! fn fs_main() -> @location(0) vec4<f32> {
//! return vec4<f32>(1.0, 0.0, 0.5, 1.0);
//! }
//! "#;
//!
//! // Initialize asset manager (handles GPU setup automatically)
//! let mut assets = AssetManager::new();
//!
//! // Add shaders
//! assets.add_shader(
//! "vertex",
//! shader_source,
//! naga::ShaderStage::Vertex,
//! Language::WGSL,
//! ).unwrap();
//!
//! assets.add_shader(
//! "fragment",
//! shader_source,
//! naga::ShaderStage::Fragment,
//! Language::WGSL,
//! ).unwrap();
//!
//! // Create pipeline and render
//! assets.create_pipeline(
//! "main_pipeline",
//! "vertex",
//! Some("fragment"),
//! vec![],
//! wgpu::TextureFormat::Rgba8UnormSrgb,
//! ).unwrap();
//! ```
// Frontend: parsing shaders to Naga IR
// Backend: wgpu integration
// Managers: asset and runtime management
// Re-export commonly used types
pub use ;
pub use ShaderObject;
pub use ;
pub use ;
pub use RuntimeManager;