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
//! The core render node trait for the render graph.
use crateGpuContext;
use crateRenderContext;
/// Trait for render graph nodes that can execute rendering operations.
///
/// Implement this trait to create custom render passes that integrate with the
/// render graph system. Each node receives the previous pass's output (if any)
/// and writes to a target texture view.
///
/// # Execution Flow
///
/// 1. `check_hot_reload()` is called once per frame for all nodes
/// 2. `execute()` is called in sequence, with ping-pong buffer management
/// 3. The final node renders directly to the screen
///
/// # Implementing Custom Nodes
///
/// ```ignore
/// struct MyCustomNode {
/// pipeline: wgpu::RenderPipeline,
/// bind_group: wgpu::BindGroup,
/// }
///
/// impl RenderNode for MyCustomNode {
/// fn execute(
/// &self,
/// ctx: &mut RenderContext,
/// target: &wgpu::TextureView,
/// input: Option<&wgpu::TextureView>,
/// ) {
/// let mut pass = ctx.encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
/// color_attachments: &[Some(wgpu::RenderPassColorAttachment {
/// view: target,
/// // ... configure load/store ops
/// })],
/// // ...
/// });
/// pass.set_pipeline(&self.pipeline);
/// pass.set_bind_group(0, &self.bind_group, &[]);
/// pass.draw(0..3, 0..1); // Full-screen triangle
/// }
/// }
/// ```