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
//! Binding declarations a shader makes at `@group(0)`, read from the WGSL at build time.
//!
//! The engine reads a pass's declarations in `@binding` order and resolves each name itself. A name
//! in [`RESERVED`] is a resource the engine owns. Any other name is the [`BufferSpec`] label of one of the
//! model's own buffers, with an optional `_in` or `_out` suffix. The suffix is a naming convention, and the
//! access mode picks the side the name resolves to.
//!
//! [`BufferSpec`]: crate::authoring::model::gpu_agent_model::BufferSpec
/// Kind of resource a binding declares, as the engine needs it for a layout entry.
/// One `@group(0) @binding(n)` declaration. Its position in a pass's slice is `n`.
/// Returns the buffer label that `decl` refers to, and whether the pass writes it.
///
/// Returns `None` for a reserved name, which the engine resolves without consulting the model's buffers.
/// Names that the engine resolves itself.
///
/// | Name | Resource |
/// |---|---|
/// | `params` | The pass's own uniform block |
/// | `dims` | Grid and display texture size, for a grid model |
/// | `output` | The display texture |
/// | `cell_start`, `sorted` | The neighbour index |
/// | `counters` | The persistent counters, and a grid model's reduce totals |
/// | `partials` | The reduction's leaf output |
///
/// A model cannot label a buffer with one of these names, or with a label ending in `_in` or `_out`. A binding
/// named after such a label would resolve to the engine's own resource, or to the label without its suffix. Both
/// engines panic at construction on a reserved or suffixed label.
pub const RESERVED: & = &;