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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//! # EZ Tier (Tier 2) - Easy Mode Rendering
//!
//! The EZ tier provides the simplest possible API for shader compilation and rendering
//! with intelligent defaults and minimal configuration. This tier wraps the EX tier
//! into a unified, beginner-friendly interface.
//!
//! **✅ STATUS**: Complete and production-ready! Perfect for learning and prototyping.
//!
//! ## Philosophy
//!
//! - **Simple**: One-liner setup with intelligent defaults
//! - **Focused**: Let users focus on shaders, not Vulkan boilerplate
//! - **Safe**: Guaranteed memory safety with foolproof APIs
//! - **Beginner-Friendly**: Perfect for learning and rapid prototyping
//! - **Progressive**: Drop down to EX/CORE when more control needed
//!
//! ## Key Components
//!
//! | Component | Purpose | Status |
//! |-----------|---------|--------|
//! | `EzRenderer` | Unified renderer with defaults | ✅ Complete |
//! | `EzFrame` | Frame rendering context | ✅ Complete |
//! | `EzConfig` | Optional configuration | ✅ Complete |
//! | Buffer Helpers | One-liner buffer creation | ✅ Complete |
//! | Image Helpers | One-liner image creation | ✅ Complete |
//! | Pipeline Helpers | `quick_pipeline()`, `quick_compute()` | ✅ Complete |
//!
//! ## Code Reduction Achievement
//!
//! EZ tier achieves ~30 lines for a complete triangle (vs 100 lines in EX, 400 in CORE):
//!
//! - **Triangle**: ~30 lines (13x reduction from CORE)
//! - **Buffer creation**: 1 line (30x reduction from CORE)
//! - **Compute pipeline**: 1 line (50x reduction from CORE)
//! - **Setup**: 1 line (80x reduction from CORE)
//!
//! ## Current Usage Example
//!
//! ```rust,no_run
//! use shdrlib::ez::*;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // One-liner setup with intelligent defaults
//! let mut renderer = EzRenderer::new()?;
//!
//! // Create buffers
//! let vertices: Vec<f32> = vec![0.0, -0.5, 0.5, 0.5, -0.5, 0.5];
//! let vertex_buffer = renderer.create_vertex_buffer(&vertices)?;
//!
//! // Create pipelines
//! let graphics = renderer.quick_pipeline(VERTEX_GLSL, FRAGMENT_GLSL)?;
//! let compute = renderer.quick_compute(COMPUTE_GLSL)?;
//!
//! // Render loop with closure-based API
//! renderer.render_frame(|frame| {
//! frame.bind_pipeline(graphics)?;
//! frame.bind_vertex_buffers(0, &[vertex_buffer.handle()], &[0]);
//! frame.set_viewport(0.0, 0.0, 800.0, 600.0);
//! frame.set_scissor(0, 0, 800, 600);
//! frame.draw(3, 1, 0, 0);
//! Ok(())
//! })?;
//! # Ok(())
//! # }
//! # const VERTEX_GLSL: &str = "#version 450\nvoid main() {}";
//! # const FRAGMENT_GLSL: &str = "#version 450\nvoid main() {}";
//! # const COMPUTE_GLSL: &str = "#version 450\nvoid main() {}";
//! ```
//!
//! ## When to Use EZ
//!
//! **Use EZ when:**
//! - Learning Vulkan and shader programming basics
//! - Rapid prototyping of rendering ideas
//! - Teaching graphics programming concepts
//! - Building simple demos or experiments
//! - Focusing on shaders, not Vulkan boilerplate
//! - Exploring graphics techniques quickly
//!
//! **Don't use EZ when:**
//! - Building production applications (use EX tier)
//! - Need fine-grained configuration control (use EX tier)
//! - Optimizing for specific hardware (use EX or CORE tier)
//! - Building complex render graphs (use EX tier)
//! - Implementing custom resource management (use CORE tier)
//!
//! ## Tier Comparison
//!
//! | Feature | CORE | EX | EZ |
//! |---------|------|----|----|
//! | Lines for triangle | ~400 | ~100 | ~30 |
//! | Setup complexity | Maximum | Medium | Minimal |
//! | Control level | Total | Explicit | Limited |
//! | Safety | Manual | Guaranteed | Guaranteed |
//! | Configuration | Explicit | Explicit | Defaults |
//! | Buffer creation | ~30 lines | 1 line | 1 line |
//! | Compute pipeline | ~50 lines | ~15 lines | 1 line |
//! | Best for | Frameworks | Applications | Learning |
//!
//! ## Features
//!
//! ### Renderer (`EzRenderer`)
//! - `new()` / `with_config()` - One-liner setup
//! - `quick_pipeline()` - Graphics pipeline in one call
//! - `quick_compute()` - Compute pipeline in one call
//! - `render_frame()` - Closure-based rendering
//!
//! ### Buffer Helpers
//! - `create_vertex_buffer()` - Type-safe vertex buffer
//! - `create_index_buffer()` - Type-safe index buffer
//! - `create_uniform_buffer::<T>()` - Type-safe uniform buffer
//! - `create_storage_buffer()` - Storage buffer for compute
//! - `write_buffer()` - Easy data upload
//!
//! ### Image Helpers
//! - `create_render_target()` - Color attachment
//! - `create_depth_stencil()` - Depth buffer
//! - `create_texture()` - Sampled texture
//! - `create_storage_image()` - Storage image for compute
//!
//! ### Frame API (`EzFrame`)
//! - `bind_pipeline()` / `bind_compute_pipeline()` - Bind pipelines
//! - `bind_vertex_buffers()` / `bind_index_buffer()` - Bind buffers
//! - `draw()` / `draw_indexed()` - Drawing commands
//! - `dispatch()` - Compute dispatch
//! - `set_viewport()` / `set_scissor()` - Dynamic state
//! - `bind_descriptor_sets()` - Descriptor binding
//! - `push_constants()` - Push constants
//!
//! ## Progressive Disclosure
//!
//! EZ doesn't lock you in! Access lower tiers when needed:
//!
//! ```rust,no_run
//! use shdrlib::ez::*;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut renderer = EzRenderer::new()?;
//!
//! // Drop down to EX tier for more control
//! let shader_manager = renderer.shader_manager_mut();
//! let runtime = renderer.runtime_mut();
//!
//! // Or drop to CORE tier for maximum control
//! let device = runtime.device();
//! let raw_device_handle = device.handle(); // ash::Device
//! # Ok(())
//! # }
//! ```
//!
//! ## Available Demos
//!
//! See `demos/ez/` for complete working examples:
//!
//! - **01_hello_triangle.rs** - Complete triangle in 30 lines
//! - **02_compute_multiply.rs** - Compute shader example
//! - **03_buffers_demo.rs** - Comprehensive buffer management
//!
//! Run with: `cargo run --bin ez_01_hello_triangle`
// Re-exports for convenience
pub use EzError;
pub use ;