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
//! wgpu rendering: scene traversal, material pipelines, shadows, and post-fx.
//!
//! [`Renderer`] is the main entry point on native. It owns GPU pipelines for
//! each topology (triangles, lines, points, sprites, skinned meshes), uploads
//! geometry and textures through internal caches, and exposes [`Renderer::apply_postfx`]
//! for fullscreen effects used by both native [`crate::postprocessing`] and the
//! wasm `WebRenderer` path.
//!
//! [`RenderTarget`] / [`CubeRenderTarget`] are offscreen color (+ depth) buffers
//! compatible with three.js `WebGLRenderTarget` usage in the JS shim.
//!
//! On native targets, [`crate::renderer::headless`] provides [`HeadlessRenderer`] for
//! offscreen RGBA readback without managing a window surface.
/// What the device can do — compute and storage, which WebGL2 lacks. See
/// [`caps`].
// No outer doc comments on these three: each carries `//!` docs of its own,
// and an outer `///` here makes the intra-doc links inside them resolve in
// *this* scope instead of the module's. The warning for that names no file.
/// Bloom as compute passes over a finished frame. See [`bloom`].
// `set_viewport` / `set_scissor` state and the partial clear behind them.
/// Pack RGBA to tightly-packed RGB on the GPU, so the alpha never crosses the
/// readback. See [`rgb_pack`].
/// Depth-only ambient occlusion as a compute pass. See [`ssao`].
/// [`ssao`] composited onto a live surface. See [`ssao_composite`].
/// GPU-side timing for the main pass. See [`gpu_timer`].
// The renderer itself, in a file named after it; this module is the facade.
// Material depth/colour-write state as pipeline variants.
// Shader-material assembly and validation, for `ShaderMaterial::validate`.
// Not part of the public surface: the module layout is an implementation
// detail and the only supported entry point is that method.
pub use ;
// Public so the WGSL sources can be parse-validated by `tests/shader_validation.rs`
// without a GPU. Not part of the stable API surface.
// Batteries-included headless offscreen renderer (native-only: pollster).
// Multi-sample accumulation for the offline renderer. Only `headless` reads it,
// and that is native-only, so this follows the same gate — otherwise it is dead
// code on wasm32 and weight in the bundle for nothing.
/// Whether the *shader* has to apply the sRGB transfer curve itself.
///
/// Three storage conventions live side by side and the difference matters
/// everywhere a value is written, sampled, blended or resolved:
///
/// * `Rgba16Float` stores linear light. Nothing converts, in either direction.
/// * An sRGB-suffixed format stores encoded bytes and the *hardware* converts:
/// it encodes on write, decodes on sample, and — the reason this predicate
/// exists — decodes, averages and re-encodes on a multisample resolve.
/// * A plain `Unorm` format stores encoded bytes and the hardware does not know
/// it. The shader has to encode on the way out and decode on the way in, and
/// any hardware operation over those bytes is a mean over a curve.
///
/// Only the third needs the shader's help, and it is one predicate rather than
/// two because the write and the read always agree: whoever encodes decodes.
/// It used to be spelled `format != Rgba16Float` in two places, which quietly
/// made an sRGB target *double*-encode — a 50% coverage edge stored 0.7379
/// where the light was 0.5 — and double-decode on the way back.
pub
/// The value to clear a `format` target to so it ends up holding the
/// *linear* colour `color` — `scene.background`, a `clear()` colour, a
/// viewport gap — the way everything else drawn into it does.
///
/// [`Color`](crate::math::Color) is linear ([`from_hex`](crate::math::Color::from_hex)
/// decodes, as three.js does with colour management on), so this follows
/// [`shader_applies_transfer`]: an sRGB or float target takes the linear value
/// and the hardware (or a later pass) encodes it; a plain `Unorm` target —
/// a WebGPU canvas is usually `bgra8unorm` — is written verbatim, so the
/// value is encoded here, exactly as the shader encodes its own output.
/// A hex background therefore lands on the image as that hex on either kind,
/// which is three.js's behaviour (`WebGLBackground` converts the clear colour
/// to the output colour space before `gl.clearColor`).
///
/// The opposite rule — `powf(2.2)` on sRGB targets, verbatim on `Unorm` —
/// treats the colour as if it were still sRGB-encoded: a `from_hex`
/// background is decoded twice and comes out near black.
pub
pub use ;
pub use GpuCubeTexture;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;