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
//! The camera blocks: what the forward pass and the G-buffer pre-pass need to
//! place a fragment, and the per-draw model pair the pre-pass differentiates for
//! motion vectors.
/// Per-frame view-projection uniforms, uploaded once per frame and shared across
/// every draw in it. `view` is the standalone view matrix the vertex shader uses
/// to compute view-space depth for cascade selection in the fragment shader.
///
/// **The field names are a published contract.** A world-authored Metal shader
/// declares its own `ViewUniforms` and binds it at Metal buffer(0); the runtime
/// validator (`metal::shader_layout`) compares that declaration against this
/// struct field by field, by name. Renaming one here rejects every world shader
/// that spells it the old way. The `.slang` source declares the same bytes with
/// its own spelling (`view_mat`, and `cam_x`/`cam_y`/`cam_z` in place of
/// `cam_pos`), which is why the two are checked as byte ranges rather than by
/// name.
/// Per-frame view inputs to the unified G-buffer pre-pass. The jittered current
/// VP drives the rasterised position (matching the main pass); `view` takes the
/// normal + position into view space (where SSR / SSAO / SSGI / RT work); the
/// un-jittered cur/prev VPs derive a jitter-free motion vector. Matches `GbView`
/// in `shaders/gbuffer_prepass.slang`. 256 bytes (four float4x4, all naturally
/// 16-aligned, no padding).
/// Per-draw model matrices for the G-buffer pre-pass. Matches `GbModel` in
/// `shaders/gbuffer_prepass.slang`, which Metal and DirectX bind as a constant
/// buffer; Vulkan carries the same pair plus the roughness in one push-constant
/// block (`vulkan::uniforms::GbModelPush`), because a pipeline layout may declare
/// only one. For a static or skinned object with no motion the caller sets
/// `prev == cur`.