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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
//! The transients a frame of this renderer has, described once.
//!
//! Each function names one target the forward renderer and its effects create
//! in the render graph: its format, its usage and its sample count. They are
//! this crate's rather than `crcbl-frame`'s because they are facts about this
//! renderer's frame — the HDR scene target, the depth pyramid, the bloom chain
//! — and a caller drawing only a UI has none of them.
use ;
use crateTransientImageDesc;
/// The HDR scene target: `Rgba16Float`, rendered into and then sampled.
///
/// **HDR from P1**, per `docs/plan/ROADMAP.md`'s correction. `Rgba16Float`
/// rather than the swapchain's format is the entire structural commitment;
/// the tonemap pass that resolves it is the other half.
pub const
/// The display-space image the tonemap writes when a resolve follows it:
/// the caller's own target format, rendered into and then sampled.
///
/// **The format is a parameter where every other description here fixes
/// one**, and it has to be: this image stands in for the caller's target
/// between the tonemap and the resolve, so a format of this module's
/// choosing would resolve one encoding into another. The antialiasing
/// resolve is the only pass that reads it.
///
/// `TRANSFER_SRC` for [`scene_color`]'s reason — a headless render can read
/// the display-space frame back before the resolve filters it, which is what
/// makes "the antialiasing pass changed the picture" checkable.
pub const
/// One level of topic 48's bloom chain:
/// `Rgba16Float`, rendered into and then sampled.
///
/// [`scene_color`]'s description without the `TRANSFER_SRC` — nothing reads
/// a chain level back, and a usage flag naming a use nothing makes is a
/// claim about a resource rather than a fact about one.
///
/// **`Rgba16Float` and not something narrower.** The chain carries the
/// scene's above-display range, which is the part of it that blooms at all;
/// an eight-bit level would clip exactly that before the tonemap saw it, and
/// a threshold-free bloom would then be a bloom of a picture the frame does
/// not contain.
///
/// **One description per level, at that level's own extent**, because
/// `crcbl_render::bloom` builds its chain out of separate single-mip images
/// rather than one image with mips — that module's header gives the two
/// independent reasons, and both of them are about what a pass can attach.
/// Distinct extents are distinct descriptions, so the pool hands out a
/// distinct physical image for each and every pass gets a correct render
/// area.
pub const
/// The depth buffer: `D32Float`, reversed-Z, written by the depth prepass
/// and **sampled** by the screen-space occlusion pass.
///
/// `SAMPLED` since topic 46's AO slice, which is the
/// prepass that made this image something downstream reads. It costs nothing
/// on a frame that adds no such pass: a usage flag is a promise about what
/// the image may be bound as, not a copy or a layout.
pub const
/// One level of the Hi-Z depth pyramid: `D32Float`, rendered into through
/// `SV_Depth` and then fetched.
///
/// [`scene_depth`]'s description at a level's own extent, which is the
/// point of it being a description of its own: `crcbl_render::hiz` builds
/// the pyramid out of separate single-level images for [`bloom_mip`]'s two
/// reasons, so a level is its own extent and the pool hands out its own
/// physical image for it.
///
/// **A depth format rather than `R32Float`.** `shaders/hiz.slang`'s header
/// carries the whole of it: `R32Float` is unfilterable in WebGPU, and the
/// pyramid would be a different texture type from the prepass that is its
/// own level 0. The seam has since grown
/// [`SampleType::UnfilterableFloat`](crcbl_hal::SampleType::UnfilterableFloat)
/// for the probe visibility maps, so the first half of that reason is now
/// answerable; the second is not, and it is the one that decided this.
pub const
/// A screen-space occlusion channel: `Rgba8Unorm`, rendered into and then
/// fetched.
///
/// Topic 46's AO chain — `ssao.slang` writes one of
/// these, `ssao_blur.slang` reads it and writes another and
/// `ssao_upsample.slang` writes the last, which is why this is one
/// description rather than three that agree today.
///
/// **`r` is the visibility and `gba` are the bent direction.** Eight bits
/// each: the scalar is a fraction of a hemisphere a 4×4 kernel has just
/// averaged sixteen samples into, and the direction is a unit vector three
/// filters have averaged and renormalised, so the quantisation is far below
/// what either has already smoothed away. `ssao.slang`'s header carries the
/// encoding and why it is three channels rather than an octahedral pair.
///
/// **It was `R8Unorm` until the bent direction arrived**, and the three
/// channels are the bandwidth the AO tier split is about, which
/// `docs/notes/rendering.md` records.
pub const
/// A screen-space contact-shadow visibility mask: `R8Unorm`, rendered into
/// and fetched by the forward pass.
///
/// Separate from [`ambient_occlusion`], whose extra
/// channels carry a bent normal and therefore cannot back the `R8Unorm`
/// contact-shadow pipeline.
pub const
/// The reflectivity channel: `Rgba8Unorm`, `rgb` the surface's `F0` and `a`
/// its roughness, written by the forward pass beside its colour target.
///
/// Topic 47's screen-space reflections run after
/// that pass, so the only per-pixel data they would otherwise have are the
/// depth buffer and the scene colour — neither of which says which surfaces
/// reflect or how sharply. `mesh.slang`'s `FragmentOutput` is the other half
/// of this description, and it carries the material's *inputs* rather than an
/// evaluated shading term.
///
/// Eight bits per channel on the argument [`ambient_occlusion`] already
/// makes for its one: every value here is bounded in `0..=1`, and the
/// quantisation is below what a reflection approximating a whole room can
/// resolve.
///
/// `TRANSFER_SRC` for [`scene_color`]'s reason — so a headless probe can read
/// the attachment back and say what it holds, which is what makes "the
/// forward pass writes the bound material row" a test result rather than a
/// claim about a buffer nothing looks at.
///
/// `SAMPLED` since the reflection slice, and not before it: the attachment
/// landed one slice ahead of the pass that reads it, and a usage flag naming
/// a binding nothing binds is a claim about a resource rather than a fact
/// about one. `crcbl_render::ssr` is that reader.
pub const
/// The motion-vector channel: `crate::forward`'s `MOTION_FORMAT`, written
/// by the forward pass beside its colour and reflectivity targets.
///
/// Topic 43 §9's third attachment — the one that
/// blocked TAA, temporal SSR, temporal upscaling, per-object motion blur and
/// SSGI's accumulation. What it holds is **current minus previous, in
/// texture coordinates, `+y` down**: a pass holding the previous frame reads
/// its history at `uv - motion`. `mesh.slang`'s `motion_vector` writes it
/// and `MOTION_FORMAT` states the convention on the host side.
///
/// The format is named there rather than here for [`ambient_occlusion`]'s
/// reason inverted: the shader's return struct and the pipeline's colour
/// target have to agree, and the pass that builds the pipeline is the one
/// that owns the answer.
///
/// **Cleared to zero, and no `TRANSFER_SRC` or `SAMPLED` yet.** Nothing
/// reads the attachment — `crcbl_render::forward`'s `DebugView::Motion`
/// observes the *subtraction*, through the scene target, rather than this
/// image — and a usage flag naming a use nothing makes is a claim about a
/// resource rather than a fact about one, which is [`bloom_mip`]'s argument.
/// The first consumer is the one that adds the flag it needs.
pub const