animader-cli 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/build-node.mjs +7 -3
- package/adapters/export-node.mjs +4 -2
- package/adapters/generations.mjs +1 -29
- package/adapters/node-fs.mjs +12 -0
- package/adapters/snapshot.mjs +29 -15
- package/lib/editor-resources.mjs +422 -0
- package/lib/new.mjs +11 -0
- package/lib/rmtree.mjs +49 -0
- package/package.json +5 -4
- package/resources/editor/.animader/schemas/bridge.sjon +79 -0
- package/resources/editor/.animader/schemas/it.sjon +836 -0
- package/resources/editor/.animader/schemas/machine.sjon +305 -0
- package/resources/editor/.animader/schemas/metadata.json +112 -0
- package/resources/editor/.animader/schemas/midi.sjon +373 -0
- package/resources/editor/.animader/schemas/pacer.sjon +384 -0
- package/resources/editor/.animader/schemas/piece.sjon +176 -0
- package/resources/editor/.animader/schemas/pngine.sjon +2626 -0
- package/resources/editor/.animader/schemas/session.sjon +311 -0
- package/resources/editor/.animader/schemas/tempura.sjon +519 -0
- package/resources/editor/.animader/schemas/world.sjon +279 -0
- package/resources/editor/sjon-lsp.sjon +16 -0
- package/starters/circle/README.md +20 -0
- package/starters/ember/README.md +48 -0
- package/toolchain/manifest.json +13 -13
|
@@ -0,0 +1,2626 @@
|
|
|
1
|
+
; PNGine WebGPU schema.
|
|
2
|
+
;
|
|
3
|
+
; Single source of truth for what a PNGine `.sjon` document may contain. The
|
|
4
|
+
; compiler (`src/dsl_sjon/Compiler.zig`) preloads this manifest once
|
|
5
|
+
; (`sjon.preloadSchema`) and hands it to every `Host.validateDocument`, so
|
|
6
|
+
; the user document parses at offset 0 and the data forms below are validated
|
|
7
|
+
; against this plugin with no filesystem (works on wasm32-freestanding). It is
|
|
8
|
+
; `@embedFile`'d via the `pngine_schema` build import and feeds the web editor's
|
|
9
|
+
; TS / JSON-Schema export.
|
|
10
|
+
;
|
|
11
|
+
; It grew in phases (the core forms first, then shapes, textures, depth/stencil
|
|
12
|
+
; and indexed draws, then samplers, imageBitmap, MRT/blend/MSAA, queries, copies
|
|
13
|
+
; and `(pass …)`); every one of those is here now, and 3.0.0 re-shaped the
|
|
14
|
+
; whole file against the WebGPU IDL.
|
|
15
|
+
;
|
|
16
|
+
; ---- Defaults policy — three DISTINCT notions, never conflated ----
|
|
17
|
+
; 1. Schema `:default V` is a PNGine OPINION. On key absence SJON materializes V
|
|
18
|
+
; into the effective view (→ HostResult.materialized_defaults), so the emitter
|
|
19
|
+
; always bakes a concrete value into the bytecode. Use it where PNGine commits
|
|
20
|
+
; to a value even when WebGPU has none. Note this is NOT a licence to default
|
|
21
|
+
; a REQUIRED member: `load-op` used to be the example here, and it was the
|
|
22
|
+
; wrong one — WebGPU requires loadOp precisely so the author states it, and
|
|
23
|
+
; 3.0.0 made it required here too.
|
|
24
|
+
; 2. A key with NO `:default`, left absent, defers to WebGPU's OWN spec default at
|
|
25
|
+
; runtime — the emitter writes nothing and PNGine invents nothing.
|
|
26
|
+
; 3. js_codegen's omit-when-default (`--html`) is a SIZE ENCODING, not a semantic
|
|
27
|
+
; source: it may drop a descriptor field ONLY when the emitted value equals
|
|
28
|
+
; WebGPU's spec default (e.g. a buffer-binding offset 0 / size = rest-of-buffer),
|
|
29
|
+
; leaning on WebGPU to refill it identically. A materialized OPINION that differs
|
|
30
|
+
; from the WebGPU default (a pass-lowered sampler's `linear` filters, or an
|
|
31
|
+
; authored `:default` on a key whose IDL default is something else) is
|
|
32
|
+
; NEVER omitted. (loadOp/storeOp/clearValue used to be the example: they
|
|
33
|
+
; are required / default-less since 3.0.0.)
|
|
34
|
+
(plugin :name pngine :version "0.1.0"
|
|
35
|
+
|
|
36
|
+
; ---- numeric refinements ----
|
|
37
|
+
; `:unit (unit-shape :reject true)` closes the silent `1.0f → 0` defect: SJON
|
|
38
|
+
; lexes a trailing letter as a unit suffix (`number_with_unit`), which a plain
|
|
39
|
+
; `:underlying number` slot would accept and the reader would drop to 0. Reject
|
|
40
|
+
; makes it a validation error (`unit_not_allowed`) with a span on the literal.
|
|
41
|
+
; `:repr (repr-shape :type u32)` tags these as GPU u32: the validator rejects an
|
|
42
|
+
; out-of-range / non-integer LITERAL (`repr_out_of_range`) before the emitter
|
|
43
|
+
; silently wraps it, and SJON's exporter emits the branded `U32` TS alias so the
|
|
44
|
+
; editor gets real per-field GPU types. Repr checks literals only — expressions
|
|
45
|
+
; (`:size (* NUM 4 4)`) and define-refs are evaluated later, untouched here.
|
|
46
|
+
;
|
|
47
|
+
; ---- the `x` / `x-value` pair ----
|
|
48
|
+
; Every numeric kind here comes in two: `x-value` carries the bounds and the
|
|
49
|
+
; repr, and `x` is `(scalar-or-ref-shape :base x-value :ref define-ref)` — a
|
|
50
|
+
; literal, a bounded expression, or a bare `(define …)` name. KEYS NAME `x`.
|
|
51
|
+
; The pair is `count` / `count-value`'s, applied to the rest: a number slot
|
|
52
|
+
; is "literal | expression | checked reference" everywhere, because an author
|
|
53
|
+
; who can write `:vertex-count NUM_PARTICLES` and not `:size NUM_PARTICLES`
|
|
54
|
+
; is looking at an accident, not a rule.
|
|
55
|
+
;
|
|
56
|
+
; This could not be written until SJON's union reporting changed. A `scalar-or-ref`
|
|
57
|
+
; desugars to a union, and a union that matched nothing used to report only
|
|
58
|
+
; its ALTERNATIVE NAMES — so adding the reference arm would have retired every
|
|
59
|
+
; bound below it: `:max-anisotropy 32` would have said "no alternative
|
|
60
|
+
; matched: anisotropy-value | define-ref" where it used to name 1..16. SJON
|
|
61
|
+
; reports the arm the value's SHAPE selected, so the bounds still speak. The
|
|
62
|
+
; three inline tests in Compiler.zig are the ratchet.
|
|
63
|
+
;
|
|
64
|
+
; Two numeric slots have no `define-ref` arm, and neither is an oversight:
|
|
65
|
+
; `write-mask` (its symbol arm is the closed member set `all`) and a
|
|
66
|
+
; `(wasm-call :args […])` element (`wasm-arg`, whose symbol arm is the
|
|
67
|
+
; builtin set `canvas-width` …). A third alternative would put a bare name
|
|
68
|
+
; within reach of TWO arms, and SJON's rule declines to guess between them —
|
|
69
|
+
; the slot would lose the report it just gained. A constant is written
|
|
70
|
+
; `(* MASK 1)` / `(* SCALE 1)` there.
|
|
71
|
+
(value-kind :name byte-count-value
|
|
72
|
+
:description "Non-negative integer byte size / offset / stride."
|
|
73
|
+
:underlying number
|
|
74
|
+
:numeric (numeric-bounds :min 0 :integer true)
|
|
75
|
+
:unit (unit-shape :reject true)
|
|
76
|
+
:repr (repr-shape :type u32))
|
|
77
|
+
(value-kind :name byte-count
|
|
78
|
+
:description "Byte size / offset / stride: a literal, a bounded expression, or a bare (define …) reference."
|
|
79
|
+
:underlying scalar-or-ref
|
|
80
|
+
:scalar-or-ref (scalar-or-ref-shape :base byte-count-value :ref define-ref))
|
|
81
|
+
; WebGPU's alignment rules on byte offsets and sizes, as `:multiple-of`
|
|
82
|
+
; bounds (SJON 1.2.0). Like every numeric-bounds, these judge a LITERAL; an
|
|
83
|
+
; expression (`:offset (* N 4)`) is evaluated by the emitter, untouched here.
|
|
84
|
+
(value-kind :name byte-count-4-aligned-value
|
|
85
|
+
:description "Byte offset / size that WebGPU requires to be a multiple of 4."
|
|
86
|
+
:underlying number
|
|
87
|
+
:numeric (numeric-bounds :min 0 :integer true :multiple-of 4)
|
|
88
|
+
:unit (unit-shape :reject true)
|
|
89
|
+
:repr (repr-shape :type u32))
|
|
90
|
+
(value-kind :name byte-count-4-aligned
|
|
91
|
+
:description "A 4-aligned byte offset / size: a literal, a bounded expression, or a bare (define …) reference."
|
|
92
|
+
:underlying scalar-or-ref
|
|
93
|
+
:scalar-or-ref (scalar-or-ref-shape :base byte-count-4-aligned-value :ref define-ref))
|
|
94
|
+
(value-kind :name byte-count-256-aligned-value
|
|
95
|
+
:description "Byte offset that WebGPU requires to be a multiple of 256."
|
|
96
|
+
:underlying number
|
|
97
|
+
:numeric (numeric-bounds :min 0 :integer true :multiple-of 256)
|
|
98
|
+
:unit (unit-shape :reject true)
|
|
99
|
+
:repr (repr-shape :type u32))
|
|
100
|
+
(value-kind :name byte-count-256-aligned
|
|
101
|
+
:description "A 256-aligned byte offset: a literal, a bounded expression, or a bare (define …) reference."
|
|
102
|
+
:underlying scalar-or-ref
|
|
103
|
+
:scalar-or-ref (scalar-or-ref-shape :base byte-count-256-aligned-value :ref define-ref))
|
|
104
|
+
(value-kind :name pool-size-value
|
|
105
|
+
:description "Ping-pong pool size (1..255). The ceiling is the wire's: the
|
|
106
|
+
pool index is a byte everywhere it is encoded, so a larger pool
|
|
107
|
+
cannot be addressed. Bounds a LITERAL; the emitter re-checks the
|
|
108
|
+
expression spelling (`:pool (* 100 3)`), which repr cannot see."
|
|
109
|
+
:underlying number
|
|
110
|
+
:numeric (numeric-bounds :min 1 :max 255 :integer true)
|
|
111
|
+
:unit (unit-shape :reject true)
|
|
112
|
+
:repr (repr-shape :type u32))
|
|
113
|
+
(value-kind :name pool-size
|
|
114
|
+
:description "Ping-pong pool size: a literal, a bounded expression, or a bare (define …) reference."
|
|
115
|
+
:underlying scalar-or-ref
|
|
116
|
+
:scalar-or-ref (scalar-or-ref-shape :base pool-size-value :ref define-ref))
|
|
117
|
+
(value-kind :name binding-index-value
|
|
118
|
+
:description "Non-negative binding / group / pool index. The PNGB wire stores these as u8, so 255 is the ceiling (WebGPU's own maxBindingsPerBindGroup default is 1000, but PNGine's uniform table and descriptor encoding are byte-indexed)."
|
|
119
|
+
:underlying number
|
|
120
|
+
:numeric (numeric-bounds :min 0 :max 255 :integer true)
|
|
121
|
+
:unit (unit-shape :reject true)
|
|
122
|
+
:repr (repr-shape :type u32))
|
|
123
|
+
(value-kind :name binding-index
|
|
124
|
+
:description "Binding / group / pool index: a literal, a bounded expression, or a bare (define …) reference."
|
|
125
|
+
:underlying scalar-or-ref
|
|
126
|
+
:scalar-or-ref (scalar-or-ref-shape :base binding-index-value :ref define-ref))
|
|
127
|
+
(value-kind :name count-value
|
|
128
|
+
:description "Non-negative integer draw / dispatch count (literals + expressions)."
|
|
129
|
+
:underlying number
|
|
130
|
+
:numeric (numeric-bounds :min 0 :integer true)
|
|
131
|
+
:unit (unit-shape :reject true)
|
|
132
|
+
:repr (repr-shape :type u32))
|
|
133
|
+
; A count may also be a bare `(define …)` reference, e.g.
|
|
134
|
+
; `:instance-count NUM_PARTICLES`. The reference half is a cross-ref to the
|
|
135
|
+
; define form (SJON 1.2.0 `scalar-or-ref-shape :ref`), so a misspelt constant is
|
|
136
|
+
; a located `union_no_branch_matched` at validation — it used to be an
|
|
137
|
+
; unlocated "emit failed" from the emitter's env lookup. The emitter still
|
|
138
|
+
; resolves the symbol through its expr env; the schema only guarantees the
|
|
139
|
+
; name exists.
|
|
140
|
+
(value-kind :name define-ref
|
|
141
|
+
:description "Reference to a declared (define :name …) constant."
|
|
142
|
+
:underlying symbol
|
|
143
|
+
:cross-ref (cross-ref :target define))
|
|
144
|
+
; The unbounded real: the element kind of every numeric vector (clear
|
|
145
|
+
; colors, blend constants, float lists) and, since 3.0.0, the
|
|
146
|
+
; `(define …)` value. No bounds to keep, but the unit reject stays — `:base
|
|
147
|
+
; number` (the primitive shortcut) took `1f` and the reader used its
|
|
148
|
+
; magnitude, one reading of the `1.0f` defect the scalar slots close.
|
|
149
|
+
;
|
|
150
|
+
; On `(define :value …)` the rule holds in full: a constant is a real, negative
|
|
151
|
+
; and fractional allowed, and the SLOT that reads it decides integrality and
|
|
152
|
+
; range at use — `0.5` is `:vertex-count`'s located reject and legal in
|
|
153
|
+
; `:clear-value`. The reference arm lets a constant name another constant,
|
|
154
|
+
; declared before or after it; the emitter resolves the set document-wide
|
|
155
|
+
; and refuses a cycle with a span.
|
|
156
|
+
(value-kind :name real-value
|
|
157
|
+
:description "An unbounded real literal: negative and fractional allowed; a unit suffix is rejected."
|
|
158
|
+
:underlying number
|
|
159
|
+
:unit (unit-shape :reject true))
|
|
160
|
+
(value-kind :name real
|
|
161
|
+
:description "An unbounded real: a literal, a bounded expression, or a bare (define …) reference."
|
|
162
|
+
:underlying scalar-or-ref
|
|
163
|
+
:scalar-or-ref (scalar-or-ref-shape :base real-value :ref define-ref))
|
|
164
|
+
(value-kind :name count
|
|
165
|
+
:description "Draw / dispatch count: a literal, a bounded expression, or a bare (define …) reference."
|
|
166
|
+
:underlying scalar-or-ref
|
|
167
|
+
:scalar-or-ref (scalar-or-ref-shape :base count-value :ref define-ref))
|
|
168
|
+
; ---- the domain names ----
|
|
169
|
+
; `count` names a draw / dispatch count and `byte-count` names bytes; a slot
|
|
170
|
+
; that is neither — a sample count, a query index or count, a stencil
|
|
171
|
+
; reference or clear value, a pixel rect, a texel origin, a pool offset — is
|
|
172
|
+
; the general `u32`, and a bitmask is `mask32` (hex literals read as the
|
|
173
|
+
; number they spell: `0xFF` is 255, `pngine inspect` shows the decimal). Same
|
|
174
|
+
; bounds and repr as `count`; the name says the domain, and the exported
|
|
175
|
+
; `.d.ts` alias follows it.
|
|
176
|
+
(value-kind :name u32-value
|
|
177
|
+
:description "Non-negative integer that rides the wire as u32."
|
|
178
|
+
:underlying number
|
|
179
|
+
:numeric (numeric-bounds :min 0 :integer true)
|
|
180
|
+
:unit (unit-shape :reject true)
|
|
181
|
+
:repr (repr-shape :type u32))
|
|
182
|
+
(value-kind :name u32
|
|
183
|
+
:description "A non-negative integer: a literal, a bounded expression, or a bare (define …) reference."
|
|
184
|
+
:underlying scalar-or-ref
|
|
185
|
+
:scalar-or-ref (scalar-or-ref-shape :base u32-value :ref define-ref))
|
|
186
|
+
(value-kind :name query-count-value
|
|
187
|
+
:description "Number of queries in a (query-set …): an integer in [1, 4096] (GPUQuerySetDescriptor.count's createQuerySet bound)."
|
|
188
|
+
:underlying number
|
|
189
|
+
:numeric (numeric-bounds :min 1 :max 4096 :integer true)
|
|
190
|
+
:unit (unit-shape :reject true)
|
|
191
|
+
:repr (repr-shape :type u32))
|
|
192
|
+
(value-kind :name query-count
|
|
193
|
+
:description "Query-set size: a literal, a bounded expression, or a bare (define …) reference, at most 4096."
|
|
194
|
+
:underlying scalar-or-ref
|
|
195
|
+
:scalar-or-ref (scalar-or-ref-shape :base query-count-value :ref define-ref))
|
|
196
|
+
(value-kind :name mask32-value
|
|
197
|
+
:description "32-bit bitmask (0..0xFFFFFFFF); a hex literal reads as the number it spells."
|
|
198
|
+
:underlying number
|
|
199
|
+
:numeric (numeric-bounds :min 0 :integer true)
|
|
200
|
+
:unit (unit-shape :reject true)
|
|
201
|
+
:repr (repr-shape :type u32))
|
|
202
|
+
(value-kind :name mask32
|
|
203
|
+
:description "A 32-bit bitmask: a literal (hex welcome), a bounded expression, or a bare (define …) reference."
|
|
204
|
+
:underlying scalar-or-ref
|
|
205
|
+
:scalar-or-ref (scalar-or-ref-shape :base mask32-value :ref define-ref))
|
|
206
|
+
; A WebGPU device-limit value. Non-negative integer, u32-range in the schema
|
|
207
|
+
; (the PNGB wire carries u64 for forward-compat). Passed VERBATIM to
|
|
208
|
+
; requiredLimits at device creation — an unsatisfiable request fails loud there
|
|
209
|
+
; (the promise rejects / native exits nonzero), never silently clamps.
|
|
210
|
+
(value-kind :name device-limit-value
|
|
211
|
+
:description "A WebGPU device limit value: a non-negative integer (u32-range; the wire is u64)."
|
|
212
|
+
:underlying number
|
|
213
|
+
:numeric (numeric-bounds :min 0 :integer true)
|
|
214
|
+
:unit (unit-shape :reject true)
|
|
215
|
+
:repr (repr-shape :type u32))
|
|
216
|
+
(value-kind :name device-limit
|
|
217
|
+
:description "A WebGPU device limit: a literal, a bounded expression, or a bare (define …) reference."
|
|
218
|
+
:underlying scalar-or-ref
|
|
219
|
+
:scalar-or-ref (scalar-or-ref-shape :base device-limit-value :ref define-ref))
|
|
220
|
+
(value-kind :name unorm-value
|
|
221
|
+
:description "A float in [0,1] (the depth clear value)."
|
|
222
|
+
:underlying number
|
|
223
|
+
:numeric (numeric-bounds :min 0 :max 1)
|
|
224
|
+
:unit (unit-shape :reject true)
|
|
225
|
+
:repr (repr-shape :type f32))
|
|
226
|
+
(value-kind :name unorm
|
|
227
|
+
:description "A float in [0,1] (the depth clear value): a literal, a bounded expression, or a bare (define …) reference."
|
|
228
|
+
:underlying scalar-or-ref
|
|
229
|
+
:scalar-or-ref (scalar-or-ref-shape :base unorm-value :ref define-ref))
|
|
230
|
+
; WebGPU's three bias terms are two different types, and conflating them cost
|
|
231
|
+
; this schema a value: `GPUDepthBiasValue` is a `long` (signed 32-bit) while
|
|
232
|
+
; `depthBiasSlopeScale` / `depthBiasClamp` are floats. One `f32`-repr kind for
|
|
233
|
+
; all three let `:depth-bias -1` through the schema and into a u32 read, which
|
|
234
|
+
; dropped it silently (webgpu_wireframe's wireframe pass layered over the solid
|
|
235
|
+
; one by exactly that -1, and shipped without it).
|
|
236
|
+
(value-kind :name depth-bias-int-value
|
|
237
|
+
:description "Constant depth bias: a signed integer (GPUDepthBiasValue is a long)."
|
|
238
|
+
:underlying number
|
|
239
|
+
:numeric (numeric-bounds :integer true)
|
|
240
|
+
:unit (unit-shape :reject true)
|
|
241
|
+
:repr (repr-shape :type i32))
|
|
242
|
+
(value-kind :name depth-bias-int
|
|
243
|
+
:description "Constant depth bias: a literal, a bounded expression, or a bare (define …) reference."
|
|
244
|
+
:underlying scalar-or-ref
|
|
245
|
+
:scalar-or-ref (scalar-or-ref-shape :base depth-bias-int-value :ref define-ref))
|
|
246
|
+
(value-kind :name depth-bias-value
|
|
247
|
+
:description "Depth bias slope-scale / clamp: a real."
|
|
248
|
+
:underlying number
|
|
249
|
+
:unit (unit-shape :reject true)
|
|
250
|
+
:repr (repr-shape :type f32))
|
|
251
|
+
(value-kind :name depth-bias
|
|
252
|
+
:description "Depth bias slope-scale / clamp: a literal, a bounded expression, or a bare (define …) reference."
|
|
253
|
+
:underlying scalar-or-ref
|
|
254
|
+
:scalar-or-ref (scalar-or-ref-shape :base depth-bias-value :ref define-ref))
|
|
255
|
+
(value-kind :name lod-clamp-value
|
|
256
|
+
:description "Sampler mip level-of-detail clamp (non-negative real; WebGPU defaults lodMinClamp 0, lodMaxClamp 32)."
|
|
257
|
+
:underlying number
|
|
258
|
+
:numeric (numeric-bounds :min 0)
|
|
259
|
+
:unit (unit-shape :reject true)
|
|
260
|
+
:repr (repr-shape :type f32))
|
|
261
|
+
(value-kind :name lod-clamp
|
|
262
|
+
:description "Sampler LOD clamp: a literal, a bounded expression, or a bare (define …) reference."
|
|
263
|
+
:underlying scalar-or-ref
|
|
264
|
+
:scalar-or-ref (scalar-or-ref-shape :base lod-clamp-value :ref define-ref))
|
|
265
|
+
(value-kind :name anisotropy-value
|
|
266
|
+
:description "Sampler max anisotropy (integer in [1,16]; values > 1 require linear mag/min/mipmap filters)."
|
|
267
|
+
:underlying number
|
|
268
|
+
:numeric (numeric-bounds :min 1 :max 16 :integer true)
|
|
269
|
+
:unit (unit-shape :reject true)
|
|
270
|
+
:repr (repr-shape :type u32))
|
|
271
|
+
(value-kind :name anisotropy
|
|
272
|
+
:description "Sampler max anisotropy: a literal, a bounded expression, or a bare (define …) reference."
|
|
273
|
+
:underlying scalar-or-ref
|
|
274
|
+
:scalar-or-ref (scalar-or-ref-shape :base anisotropy-value :ref define-ref))
|
|
275
|
+
; Digit-leading spellings (`1d`, `2d-array`) lex as unit-bearing numbers; SJON
|
|
276
|
+
; 1.2.0 lets a symbol member-set declare them and matches on the parsed
|
|
277
|
+
; (magnitude, unit) pair, so the value reaches the emitter as a
|
|
278
|
+
; `number_with_unit` node, not a symbol — read it with `Reader.memberSpelling`
|
|
279
|
+
; and map through `values.textureDimensionCode` / `viewDimensionCode`
|
|
280
|
+
; (`Emitter.dimensionCode`), never `Reader.symbol` (which returns null on it).
|
|
281
|
+
(value-kind :name texture-dimension
|
|
282
|
+
:description "GPUTextureDimension, spelled as the WebGPU spec spells it: 1d, 2d (default), 3d."
|
|
283
|
+
:underlying symbol
|
|
284
|
+
:members (member-set
|
|
285
|
+
(member :name 1d :description "One-dimensional texture.")
|
|
286
|
+
(member :name 2d :description "Two-dimensional texture (the default); with a third :size element > 1 it is a 2d array.")
|
|
287
|
+
(member :name 3d :description "Three-dimensional (volume) texture; the third :size element is its slice count.")))
|
|
288
|
+
(value-kind :name subresource-count-value
|
|
289
|
+
:description "Positive integer texture subresource count (≥ 1) — mip levels or array/3d layers. Absent: a texture allocates 1; a texture view exposes every level/layer from its base."
|
|
290
|
+
:underlying number
|
|
291
|
+
:numeric (numeric-bounds :min 1 :integer true)
|
|
292
|
+
:unit (unit-shape :reject true)
|
|
293
|
+
:repr (repr-shape :type u32))
|
|
294
|
+
(value-kind :name subresource-count
|
|
295
|
+
:description "Texture subresource count: a literal, a bounded expression, or a bare (define …) reference."
|
|
296
|
+
:underlying scalar-or-ref
|
|
297
|
+
:scalar-or-ref (scalar-or-ref-shape :base subresource-count-value :ref define-ref))
|
|
298
|
+
(value-kind :name subresource-index-value
|
|
299
|
+
:description "Zero-based texture subresource index (≥ 0) — a texture view's base mip level or base array layer. Defaults to 0. (subresource-count is ≥ 1; a base index is ≥ 0.)"
|
|
300
|
+
:underlying number
|
|
301
|
+
:numeric (numeric-bounds :min 0 :integer true)
|
|
302
|
+
:unit (unit-shape :reject true)
|
|
303
|
+
:repr (repr-shape :type u32))
|
|
304
|
+
(value-kind :name subresource-index
|
|
305
|
+
:description "Texture subresource index: a literal, a bounded expression, or a bare (define …) reference."
|
|
306
|
+
:underlying scalar-or-ref
|
|
307
|
+
:scalar-or-ref (scalar-or-ref-shape :base subresource-index-value :ref define-ref))
|
|
308
|
+
(value-kind :name view-dimension
|
|
309
|
+
:description "GPUTextureViewDimension, spelled as the WebGPU spec spells it: 1d, 2d, 2d-array, cube, cube-array, 3d."
|
|
310
|
+
:underlying symbol
|
|
311
|
+
:members (member-set
|
|
312
|
+
(member :name 1d :description "One-dimensional view (texture_1d).")
|
|
313
|
+
(member :name 2d :description "Two-dimensional view (texture_2d) — the default.")
|
|
314
|
+
(member :name 2d-array :description "Array of 2d layers (texture_2d_array).")
|
|
315
|
+
(member :name cube :description "Cube map — six 2d layers (texture_cube).")
|
|
316
|
+
(member :name cube-array :description "Array of cube maps — 6·N layers (texture_cube_array).")
|
|
317
|
+
(member :name 3d :description "Volume view (texture_3d).")))
|
|
318
|
+
(value-kind :name texture-aspect
|
|
319
|
+
:description "GPUTextureAspect — which aspect(s) of a depth/stencil texture a view exposes."
|
|
320
|
+
:underlying symbol
|
|
321
|
+
:members (member-set
|
|
322
|
+
(member :name all :description "All available aspects (color, or depth+stencil).")
|
|
323
|
+
(member :name stencil-only :description "Only the stencil aspect of a depth-stencil texture.")
|
|
324
|
+
(member :name depth-only :description "Only the depth aspect of a depth-stencil texture.")))
|
|
325
|
+
|
|
326
|
+
; ---- cross-reference symbols (resolved across the source + lowered forest) ----
|
|
327
|
+
(value-kind :name module-ref
|
|
328
|
+
:description "Reference to a declared (shader-module :name …)."
|
|
329
|
+
:underlying symbol
|
|
330
|
+
:cross-ref (cross-ref :target shader-module))
|
|
331
|
+
; A fragment reference names the `wgsl` group and ONLY that group — never a
|
|
332
|
+
; union with `shader-module`. A reference slot names one target group (the
|
|
333
|
+
; overhaul's ref-kind rule), and the two are different things: a fragment is
|
|
334
|
+
; text to be assembled, a module is a GPUShaderModule.
|
|
335
|
+
(value-kind :name wgsl-ref
|
|
336
|
+
:description "Reference to a declared (wgsl :name …) fragment."
|
|
337
|
+
:underlying symbol
|
|
338
|
+
:cross-ref (cross-ref :target wgsl))
|
|
339
|
+
(value-kind :name buffer-ref
|
|
340
|
+
:description "Reference to a declared (buffer :name …)."
|
|
341
|
+
:underlying symbol
|
|
342
|
+
:cross-ref (cross-ref :target buffer))
|
|
343
|
+
(value-kind :name data-ref
|
|
344
|
+
:description "Reference to a declared (data :name …)."
|
|
345
|
+
:underlying symbol
|
|
346
|
+
:cross-ref (cross-ref :target data))
|
|
347
|
+
(value-kind :name render-pipeline-ref
|
|
348
|
+
:description "Reference to a declared (render-pipeline :name …)."
|
|
349
|
+
:underlying symbol
|
|
350
|
+
:cross-ref (cross-ref :target render-pipeline))
|
|
351
|
+
(value-kind :name compute-pipeline-ref
|
|
352
|
+
:description "Reference to a declared (compute-pipeline :name …)."
|
|
353
|
+
:underlying symbol
|
|
354
|
+
:cross-ref (cross-ref :target compute-pipeline))
|
|
355
|
+
(value-kind :name bind-group-ref
|
|
356
|
+
:description "Reference to a declared (bind-group :name …)."
|
|
357
|
+
:underlying symbol
|
|
358
|
+
:cross-ref (cross-ref :target bind-group))
|
|
359
|
+
(value-kind :name render-bundle-ref
|
|
360
|
+
:description "Reference to a declared (render-bundle :name …)."
|
|
361
|
+
:underlying symbol
|
|
362
|
+
:cross-ref (cross-ref :target render-bundle))
|
|
363
|
+
(value-kind :name queue-ref
|
|
364
|
+
:description "Reference to a declared (queue :name …)."
|
|
365
|
+
:underlying symbol
|
|
366
|
+
:cross-ref (cross-ref :target queue))
|
|
367
|
+
(value-kind :name compute-pass-ref
|
|
368
|
+
:description "Reference to a declared (compute-pass :name …), including one lowered from (init …) sugar."
|
|
369
|
+
:underlying symbol
|
|
370
|
+
:cross-ref (cross-ref :target compute-pass))
|
|
371
|
+
; `pipeline-ref` = `(cross-ref :target [render-pipeline compute-pipeline])`
|
|
372
|
+
; lived here until the descriptor cut. Its ONE consumer was the bind-group's
|
|
373
|
+
; `:layout-pipeline`, and `bind-group-layout-spec` below is the same group
|
|
374
|
+
; plus `bind-group-layout` — so the render/compute one-namespace property
|
|
375
|
+
; that closed the shared-namespace hole is unchanged, and keeping both meant two buckets over
|
|
376
|
+
; overlapping target sets reporting ONE collision twice.
|
|
377
|
+
;
|
|
378
|
+
; A bind group's `:layout` names the layout it is built against: a pipeline's
|
|
379
|
+
; auto-derived layout, or an explicit (bind-group-layout …). One key, because
|
|
380
|
+
; GPUBindGroupDescriptor.layout is one member — it was two mutually
|
|
381
|
+
; exclusive keys and an exactly-one group.
|
|
382
|
+
;
|
|
383
|
+
; A TARGET GROUP (`:target [a b c]`), never a union of ref kinds. A union
|
|
384
|
+
; resolves first-match while the emitter's tables are separate id spaces, so a
|
|
385
|
+
; render-pipeline and a bind-group-layout sharing a name would resolve one way
|
|
386
|
+
; here and bind the other downstream — the same hole, closed for `pipeline-ref`
|
|
387
|
+
; and `frame-step` the same way on 2026-08-17. As a group the three forms are
|
|
388
|
+
; ONE namespace: the collision is a `duplicate_cross_ref_target` at the second
|
|
389
|
+
; declaration, so a reference here resolves to exactly one form by
|
|
390
|
+
; construction, and the emitter's "did it resolve to a pipeline?" test is a
|
|
391
|
+
; lookup in its own tables rather than a guess.
|
|
392
|
+
(value-kind :name bind-group-layout-spec
|
|
393
|
+
:description "The layout a bind group is built against: a render-/compute-pipeline whose auto-layout it targets, or an explicit (bind-group-layout …). One namespace across the three."
|
|
394
|
+
:underlying symbol
|
|
395
|
+
:cross-ref (cross-ref :target [render-pipeline compute-pipeline bind-group-layout]))
|
|
396
|
+
|
|
397
|
+
; ---- runtime builtin data sources (write-buffer :data) ----
|
|
398
|
+
(value-kind :name builtin-data-source
|
|
399
|
+
:description "Runtime-provided uniform data the player writes each frame."
|
|
400
|
+
:underlying symbol
|
|
401
|
+
:members (member-set
|
|
402
|
+
(member :name pngine-inputs :description "16 B: time, canvasWidth, canvasHeight, aspect (all f32).")
|
|
403
|
+
(member :name scene-time-inputs :description "12 B: time, canvasWidth, canvasHeight (all f32) — the first 12 bytes of pngine-inputs. True scene timing is not modelled yet.")
|
|
404
|
+
(member :name pngine-frame-inputs :description "20 B: the 16 B of pngine-inputs, then frameIndex (u32) — the executor's frame counter, which is also the ping-pong pool phase. For a jitter sequence (TAA) or any per-frame rotation.")
|
|
405
|
+
(member :name pointer-inputs :description "48 B: x, y, clickX, clickY, dx, dy, buttons, pressure, modifiers, scrollX, scrollY, _pad (all f32).")))
|
|
406
|
+
; The two ref arms are ONE cross-ref target group, never a union of two ref
|
|
407
|
+
; kinds: a union resolves first-match while the emitter looks the name up in
|
|
408
|
+
; separate id tables. A group gives one namespace — a
|
|
409
|
+
; `(data …)` and a `(wasm-call …)` that share a name collide at the second
|
|
410
|
+
; declaration, so "which table" is decided by the document, not by arm order.
|
|
411
|
+
(value-kind :name data-or-wasm-ref
|
|
412
|
+
:description "Reference to a declared (data :name …) or (wasm-call :name …). One namespace across the two."
|
|
413
|
+
:underlying symbol
|
|
414
|
+
:cross-ref (cross-ref :target [data wasm-call]))
|
|
415
|
+
(value-kind :name write-buffer-source
|
|
416
|
+
:description "write-buffer :data source: a runtime builtin, a (data …) reference, or a (wasm-call …) whose result is written each frame."
|
|
417
|
+
:underlying union
|
|
418
|
+
:union (union-shape :alternatives [builtin-data-source data-or-wasm-ref]))
|
|
419
|
+
|
|
420
|
+
; `byte-size` was `[byte-count data-ref]` — a union whose ref arm meant "size
|
|
421
|
+
; this buffer from that data without filling it". Every corpus use of it also
|
|
422
|
+
; carried `:mapped-at-creation <the same data>`, naming one thing twice, and
|
|
423
|
+
; `:data` sizes the buffer now. The arm is gone; a buffer's `:size` is a byte
|
|
424
|
+
; count.
|
|
425
|
+
|
|
426
|
+
; ---- enums ----
|
|
427
|
+
(value-kind :name buffer-usage
|
|
428
|
+
:description "GPUBufferUsage flag — what the buffer may be used for."
|
|
429
|
+
:underlying symbol
|
|
430
|
+
:members (member-set
|
|
431
|
+
(member :name vertex :description "Usable as a vertex buffer in draw calls.")
|
|
432
|
+
(member :name index :description "Usable as an index buffer in indexed draws.")
|
|
433
|
+
(member :name uniform :description "Bindable as a uniform buffer (var<uniform>).")
|
|
434
|
+
(member :name storage :description "Bindable as a read/write storage buffer (var<storage>).")
|
|
435
|
+
(member :name copy-dst :description "Destination of copies and write-buffer ops.")
|
|
436
|
+
(member :name copy-src :description "Source of copy operations.")
|
|
437
|
+
(member :name indirect :description "Holds indirect draw/dispatch arguments.")
|
|
438
|
+
(member :name query-resolve :description "Receives resolve-query-set results.")
|
|
439
|
+
(member :name map-read :description "Mappable for CPU readback; combines with copy-dst and nothing else.")
|
|
440
|
+
(member :name map-write :description "Mappable for CPU upload (write); combines with copy-src and nothing else.")))
|
|
441
|
+
(value-kind :name primitive-topology
|
|
442
|
+
:description "GPUPrimitiveTopology — how vertices are assembled into primitives."
|
|
443
|
+
:underlying symbol
|
|
444
|
+
:members (member-set
|
|
445
|
+
(member :name triangle-list :description "Each triplet of vertices is a triangle.")
|
|
446
|
+
(member :name triangle-strip :description "Each vertex after the first two forms a triangle with the previous two.")
|
|
447
|
+
(member :name line-list :description "Each pair of vertices is a line.")
|
|
448
|
+
(member :name line-strip :description "Each vertex after the first extends a line from the previous one.")
|
|
449
|
+
(member :name point-list :description "Each vertex is a point.")))
|
|
450
|
+
(value-kind :name load-op
|
|
451
|
+
:description "GPULoadOp — what happens to an attachment at render-pass start."
|
|
452
|
+
:underlying symbol
|
|
453
|
+
:members (member-set
|
|
454
|
+
(member :name clear :description "Clear the attachment to the clear value at pass start.")
|
|
455
|
+
(member :name load :description "Preserve the attachment's existing contents.")))
|
|
456
|
+
(value-kind :name store-op
|
|
457
|
+
:description "GPUStoreOp — what happens to an attachment at render-pass end."
|
|
458
|
+
:underlying symbol
|
|
459
|
+
:members (member-set
|
|
460
|
+
(member :name store :description "Keep the pass result in the attachment.")
|
|
461
|
+
(member :name discard :description "Discard the result (the attachment reads back as cleared).")))
|
|
462
|
+
(value-kind :name vertex-format
|
|
463
|
+
:description "GPUVertexFormat — wire format of one vertex attribute."
|
|
464
|
+
:underlying symbol
|
|
465
|
+
:members (member-set
|
|
466
|
+
; 8-bit
|
|
467
|
+
(member :name uint8 :description "One 8-bit unsigned int (1 B) → u32.")
|
|
468
|
+
(member :name uint8x2 :description "Two 8-bit unsigned ints (2 B) → vec2u.")
|
|
469
|
+
(member :name uint8x4 :description "Four 8-bit unsigned ints (4 B) → vec4u.")
|
|
470
|
+
(member :name sint8 :description "One 8-bit signed int (1 B) → i32.")
|
|
471
|
+
(member :name sint8x2 :description "Two 8-bit signed ints (2 B) → vec2i.")
|
|
472
|
+
(member :name sint8x4 :description "Four 8-bit signed ints (4 B) → vec4i.")
|
|
473
|
+
(member :name unorm8 :description "One 8-bit unsigned normalized (1 B) → f32 in [0,1].")
|
|
474
|
+
(member :name unorm8x2 :description "Two 8-bit unsigned normalized (2 B) → vec2f in [0,1].")
|
|
475
|
+
(member :name unorm8x4 :description "Four 8-bit unsigned normalized (4 B) → vec4f in [0,1].")
|
|
476
|
+
(member :name snorm8 :description "One 8-bit signed normalized (1 B) → f32 in [-1,1].")
|
|
477
|
+
(member :name snorm8x2 :description "Two 8-bit signed normalized (2 B) → vec2f in [-1,1].")
|
|
478
|
+
(member :name snorm8x4 :description "Four 8-bit signed normalized (4 B) → vec4f in [-1,1].")
|
|
479
|
+
; 16-bit
|
|
480
|
+
(member :name uint16 :description "One 16-bit unsigned int (2 B) → u32.")
|
|
481
|
+
(member :name uint16x2 :description "Two 16-bit unsigned ints (4 B) → vec2u.")
|
|
482
|
+
(member :name uint16x4 :description "Four 16-bit unsigned ints (8 B) → vec4u.")
|
|
483
|
+
(member :name sint16 :description "One 16-bit signed int (2 B) → i32.")
|
|
484
|
+
(member :name sint16x2 :description "Two 16-bit signed ints (4 B) → vec2i.")
|
|
485
|
+
(member :name sint16x4 :description "Four 16-bit signed ints (8 B) → vec4i.")
|
|
486
|
+
(member :name unorm16 :description "One 16-bit unsigned normalized (2 B) → f32 in [0,1].")
|
|
487
|
+
(member :name unorm16x2 :description "Two 16-bit unsigned normalized (4 B) → vec2f in [0,1].")
|
|
488
|
+
(member :name unorm16x4 :description "Four 16-bit unsigned normalized (8 B) → vec4f in [0,1].")
|
|
489
|
+
(member :name snorm16 :description "One 16-bit signed normalized (2 B) → f32 in [-1,1].")
|
|
490
|
+
(member :name snorm16x2 :description "Two 16-bit signed normalized (4 B) → vec2f in [-1,1].")
|
|
491
|
+
(member :name snorm16x4 :description "Four 16-bit signed normalized (8 B) → vec4f in [-1,1].")
|
|
492
|
+
(member :name float16 :description "One 16-bit float (2 B) → f32.")
|
|
493
|
+
(member :name float16x2 :description "Two 16-bit floats (4 B) → vec2f.")
|
|
494
|
+
(member :name float16x4 :description "Four 16-bit floats (8 B) → vec4f.")
|
|
495
|
+
; 32-bit
|
|
496
|
+
(member :name float32 :description "One 32-bit float (4 B) → f32.")
|
|
497
|
+
(member :name float32x2 :description "Two 32-bit floats (8 B) → vec2f.")
|
|
498
|
+
(member :name float32x3 :description "Three 32-bit floats (12 B) → vec3f.")
|
|
499
|
+
(member :name float32x4 :description "Four 32-bit floats (16 B) → vec4f.")
|
|
500
|
+
(member :name uint32 :description "One 32-bit unsigned int (4 B) → u32.")
|
|
501
|
+
(member :name uint32x2 :description "Two 32-bit unsigned ints (8 B) → vec2u.")
|
|
502
|
+
(member :name uint32x3 :description "Three 32-bit unsigned ints (12 B) → vec3u.")
|
|
503
|
+
(member :name uint32x4 :description "Four 32-bit unsigned ints (16 B) → vec4u.")
|
|
504
|
+
(member :name sint32 :description "One 32-bit signed int (4 B) → i32.")
|
|
505
|
+
(member :name sint32x2 :description "Two 32-bit signed ints (8 B) → vec2i.")
|
|
506
|
+
(member :name sint32x3 :description "Three 32-bit signed ints (12 B) → vec3i.")
|
|
507
|
+
(member :name sint32x4 :description "Four 32-bit signed ints (16 B) → vec4i.")
|
|
508
|
+
; packed
|
|
509
|
+
(member :name unorm10-10-10-2 :description "Packed 10/10/10/2-bit unsigned normalized (4 B) → vec4f in [0,1].")
|
|
510
|
+
(member :name unorm8x4-bgra :description "Four 8-bit unsigned normalized in BGRA order (4 B) → vec4f in [0,1].")))
|
|
511
|
+
(value-kind :name step-mode
|
|
512
|
+
:description "GPUVertexStepMode — whether a vertex buffer advances per vertex or per instance."
|
|
513
|
+
:underlying symbol
|
|
514
|
+
:members (member-set
|
|
515
|
+
(member :name vertex :description "Advance by array-stride per vertex (resets each instance).")
|
|
516
|
+
(member :name instance :description "Advance by array-stride per instance.")))
|
|
517
|
+
(value-kind :name entry-point
|
|
518
|
+
:description "Shader entry-point function name (a WGSL @vertex/@fragment/@compute fn)."
|
|
519
|
+
:underlying symbol)
|
|
520
|
+
; Follows `entry-point`: a free symbol naming something inside opaque WGSL,
|
|
521
|
+
; which the EMITTER cross-checks against reflection. SJON cannot check it —
|
|
522
|
+
; the override declarations live inside a `:code` string the validator does
|
|
523
|
+
; not parse.
|
|
524
|
+
(value-kind :name override-name
|
|
525
|
+
:description "A WGSL `override` identifier, as written in the shader. An @id(N)-annotated override is still named by its identifier here — pngine resolves the value at compile time, so the numeric id never reaches a runtime."
|
|
526
|
+
:underlying symbol)
|
|
527
|
+
; Deliberately NOT :repr-tagged. A constant's width is whatever its WGSL
|
|
528
|
+
; `override` declares (f32/u32/i32/bool), which the schema cannot see; the
|
|
529
|
+
; emitter type-checks the value against the reflected type instead. A repr
|
|
530
|
+
; tag here would be a guess that rejects valid documents.
|
|
531
|
+
(value-kind :name override-value
|
|
532
|
+
:description "The value to specialise a WGSL `override` with: an integer or real literal, or a bounded expression over (define …) constants. A bool override takes 0 or 1."
|
|
533
|
+
:underlying number
|
|
534
|
+
:unit (unit-shape :reject true))
|
|
535
|
+
(value-kind :name override-number
|
|
536
|
+
:description "An override's value: a literal, a bounded expression, or a bare (define …) reference."
|
|
537
|
+
:underlying scalar-or-ref
|
|
538
|
+
:scalar-or-ref (scalar-or-ref-shape :base override-value :ref define-ref))
|
|
539
|
+
(value-kind :name layout-mode
|
|
540
|
+
:description "Pipeline layout mode: auto derives bind-group layouts from the WGSL."
|
|
541
|
+
:underlying symbol
|
|
542
|
+
:members (member-set :values [auto]))
|
|
543
|
+
|
|
544
|
+
; ---- builtin symbol sets the emitter maps to runtime encodings ----
|
|
545
|
+
(value-kind :name view-source
|
|
546
|
+
:description "Builtin attachment view: context-current-texture is the canvas's current texture."
|
|
547
|
+
:underlying symbol
|
|
548
|
+
:members (member-set
|
|
549
|
+
(member :name context-current-texture :description "The canvas's current swapchain texture.")))
|
|
550
|
+
(value-kind :name color-target-format
|
|
551
|
+
:description "Color target format. preferred-canvas-format resolves to the platform's canvas format at runtime."
|
|
552
|
+
:underlying symbol
|
|
553
|
+
:members (member-set
|
|
554
|
+
(member :name preferred-canvas-format :description "Resolved at runtime to the platform's canvas format (bgra8unorm on macOS, rgba8unorm elsewhere).")
|
|
555
|
+
(member :name bgra8unorm :description "4×8-bit unorm, BGRA order; common canvas format.")
|
|
556
|
+
(member :name rgba8unorm :description "4×8-bit unorm; renderable, filterable, blendable.")
|
|
557
|
+
(member :name rgba16float :description "4×16-bit float; renderable, filterable, blendable; HDR-capable.")
|
|
558
|
+
(member :name r32uint :description "1×32-bit unsigned int; renderable, not blendable (e.g. a primitive-id MRT pick target).")
|
|
559
|
+
; ---- base-renderable color / srgb / packed (RENDER_ATTACHMENT without a device feature) ----
|
|
560
|
+
(member :name r8unorm :description "1×8-bit unorm; renderable, filterable, blendable.")
|
|
561
|
+
(member :name r8uint :description "1×8-bit unsigned int; renderable, not blendable.")
|
|
562
|
+
(member :name r8sint :description "1×8-bit signed int; renderable, not blendable.")
|
|
563
|
+
(member :name rg8unorm :description "2×8-bit unorm; renderable, filterable, blendable.")
|
|
564
|
+
(member :name rg8uint :description "2×8-bit unsigned int; renderable, not blendable.")
|
|
565
|
+
(member :name rg8sint :description "2×8-bit signed int; renderable, not blendable.")
|
|
566
|
+
(member :name rgba8unorm-srgb :description "4×8-bit unorm, sRGB-encoded; renderable, filterable, blendable.")
|
|
567
|
+
(member :name rgba8uint :description "4×8-bit unsigned int; renderable, not blendable.")
|
|
568
|
+
(member :name rgba8sint :description "4×8-bit signed int; renderable, not blendable.")
|
|
569
|
+
(member :name r16uint :description "1×16-bit unsigned int; renderable, not blendable.")
|
|
570
|
+
(member :name r16sint :description "1×16-bit signed int; renderable, not blendable.")
|
|
571
|
+
(member :name r16float :description "1×16-bit float; renderable, filterable, blendable.")
|
|
572
|
+
(member :name rg16uint :description "2×16-bit unsigned int; renderable, not blendable.")
|
|
573
|
+
(member :name rg16sint :description "2×16-bit signed int; renderable, not blendable.")
|
|
574
|
+
(member :name rg16float :description "2×16-bit float; renderable, filterable, blendable.")
|
|
575
|
+
(member :name r32sint :description "1×32-bit signed int; renderable, not blendable.")
|
|
576
|
+
(member :name r32float :description "1×32-bit float; renderable; blendable only with the float32-blendable feature.")
|
|
577
|
+
(member :name rg32uint :description "2×32-bit unsigned int; renderable, not blendable.")
|
|
578
|
+
(member :name rg32sint :description "2×32-bit signed int; renderable, not blendable.")
|
|
579
|
+
(member :name rg32float :description "2×32-bit float; renderable; blendable only with the float32-blendable feature.")
|
|
580
|
+
(member :name rgba16uint :description "4×16-bit unsigned int; renderable, not blendable.")
|
|
581
|
+
(member :name rgba16sint :description "4×16-bit signed int; renderable, not blendable.")
|
|
582
|
+
(member :name rgba32uint :description "4×32-bit unsigned int; renderable, not blendable.")
|
|
583
|
+
(member :name rgba32sint :description "4×32-bit signed int; renderable, not blendable.")
|
|
584
|
+
(member :name rgba32float :description "4×32-bit float; renderable; blendable only with the float32-blendable feature.")
|
|
585
|
+
(member :name rgb10a2uint :description "Packed 10/10/10/2-bit unsigned int; renderable, not blendable.")
|
|
586
|
+
(member :name rgb10a2unorm :description "Packed 10/10/10/2-bit unorm; renderable, filterable, blendable.")
|
|
587
|
+
; ---- feature-gated render targets (the runtime requests the feature so they render where the adapter allows) ----
|
|
588
|
+
(member :name r8snorm :description "1×8-bit signed norm; render-attachment + blendable need texture-formats-tier1.")
|
|
589
|
+
(member :name rg8snorm :description "2×8-bit signed norm; render-attachment + blendable need texture-formats-tier1.")
|
|
590
|
+
(member :name rgba8snorm :description "4×8-bit signed norm; render-attachment + blendable need texture-formats-tier1.")
|
|
591
|
+
(member :name rg11b10ufloat :description "Packed 11/11/10-bit unsigned float; render-attachment needs rg11b10ufloat-renderable (implied by texture-formats-tier1).")
|
|
592
|
+
(member :name bgra8unorm-srgb :description "4×8-bit unorm, BGRA, sRGB; renderable; needs core-features-and-limits (present on any core, non-compat device).")
|
|
593
|
+
(member :name r16unorm :description "1×16-bit unorm; renderable + blendable with texture-formats-tier1.")
|
|
594
|
+
(member :name r16snorm :description "1×16-bit signed norm; renderable + blendable with texture-formats-tier1.")
|
|
595
|
+
(member :name rg16unorm :description "2×16-bit unorm; renderable + blendable with texture-formats-tier1.")
|
|
596
|
+
(member :name rg16snorm :description "2×16-bit signed norm; renderable + blendable with texture-formats-tier1.")
|
|
597
|
+
(member :name rgba16unorm :description "4×16-bit unorm; renderable + blendable with texture-formats-tier1.")
|
|
598
|
+
(member :name rgba16snorm :description "4×16-bit signed norm; renderable + blendable with texture-formats-tier1.")))
|
|
599
|
+
|
|
600
|
+
; ---- query sets: GPU timestamp / occlusion queries ----
|
|
601
|
+
(value-kind :name query-type
|
|
602
|
+
:description "GPUQueryType — what a query in the set measures."
|
|
603
|
+
:underlying symbol
|
|
604
|
+
:members (member-set
|
|
605
|
+
(member :name occlusion :description "Counts samples passing depth/stencil within an (occlusion-query …) bracket.")
|
|
606
|
+
(member :name timestamp :description "Records a GPU timestamp in nanoseconds (64-bit).")))
|
|
607
|
+
(value-kind :name query-set-ref
|
|
608
|
+
:description "Reference to a declared (query-set :name …)."
|
|
609
|
+
:underlying symbol
|
|
610
|
+
:cross-ref (cross-ref :target query-set))
|
|
611
|
+
; Heads admitted positionally inside an (occlusion-query …) bracket.
|
|
612
|
+
; Every draw WebGPU brackets, at least one — the bracket is a plain
|
|
613
|
+
; begin/draws/end sequence, and it admits the indirect pair the wire has
|
|
614
|
+
; always allowed.
|
|
615
|
+
(value-kind :name occlusion-draw-item :underlying form :heads (head-set
|
|
616
|
+
:min-children 1
|
|
617
|
+
(head :name draw)
|
|
618
|
+
(head :name draw-indexed)
|
|
619
|
+
(head :name draw-indirect)
|
|
620
|
+
(head :name draw-indexed-indirect)))
|
|
621
|
+
|
|
622
|
+
; ---- Phase 2a: textures, shape generators, depth/stencil, indexed draws ----
|
|
623
|
+
(value-kind :name texture-ref
|
|
624
|
+
:description "Reference to a declared (texture :name …)."
|
|
625
|
+
:underlying symbol
|
|
626
|
+
:cross-ref (cross-ref :target texture))
|
|
627
|
+
(value-kind :name texture-view-ref
|
|
628
|
+
:description "Reference to a declared (texture-view :name …)."
|
|
629
|
+
:underlying symbol
|
|
630
|
+
:cross-ref (cross-ref :target texture-view))
|
|
631
|
+
(value-kind :name texture-format
|
|
632
|
+
:description "GPUTextureFormat (PNGine subset). preferred-canvas-format resolves at runtime."
|
|
633
|
+
:underlying symbol
|
|
634
|
+
:members (member-set
|
|
635
|
+
(member :name rgba8unorm :description "4×8-bit unorm; renderable, filterable, blendable.")
|
|
636
|
+
(member :name rgba8snorm :description "4×8-bit signed norm in [-1,1]; filterable, not baseline-renderable.")
|
|
637
|
+
(member :name bgra8unorm :description "4×8-bit unorm, BGRA order; common canvas format.")
|
|
638
|
+
(member :name rgba16float :description "4×16-bit float; renderable, filterable, blendable.")
|
|
639
|
+
(member :name rgba32float :description "4×32-bit float; renderable; filterable only with the float32-filterable feature.")
|
|
640
|
+
(member :name depth24plus :description "At least 24-bit depth; depth-comparison only, not filterable.")
|
|
641
|
+
(member :name depth24plus-stencil8 :description "At least 24-bit depth plus 8-bit stencil.")
|
|
642
|
+
(member :name depth32float :description "32-bit float depth.")
|
|
643
|
+
(member :name stencil8 :description "8-bit stencil only; no depth aspect.")
|
|
644
|
+
(member :name depth16unorm :description "16-bit unorm depth; depth-comparison only, not filterable.")
|
|
645
|
+
(member :name r8unorm :description "1×8-bit unorm; renderable, filterable.")
|
|
646
|
+
(member :name rg8unorm :description "2×8-bit unorm; renderable, filterable.")
|
|
647
|
+
(member :name r16float :description "1×16-bit float; renderable, filterable.")
|
|
648
|
+
(member :name rg16float :description "2×16-bit float; renderable, filterable.")
|
|
649
|
+
(member :name r32float :description "1×32-bit float; renderable; filterable only with the float32-filterable feature.")
|
|
650
|
+
(member :name r32uint :description "1×32-bit unsigned int; not filterable.")
|
|
651
|
+
; ---- base (no-feature) color / srgb / packed; compressed (BC/ETC2/EAC/ASTC) are deferred (need an upload path) ----
|
|
652
|
+
(member :name rgba8unorm-srgb :description "4×8-bit unorm, sRGB-encoded; renderable, filterable, blendable.")
|
|
653
|
+
(member :name rgba8uint :description "4×8-bit unsigned int; renderable, not filterable.")
|
|
654
|
+
(member :name rgba8sint :description "4×8-bit signed int; renderable, not filterable.")
|
|
655
|
+
(member :name r8snorm :description "1×8-bit signed norm in [-1,1]; filterable, not baseline-renderable.")
|
|
656
|
+
(member :name r8uint :description "1×8-bit unsigned int; renderable, not filterable.")
|
|
657
|
+
(member :name r8sint :description "1×8-bit signed int; renderable, not filterable.")
|
|
658
|
+
(member :name rg8snorm :description "2×8-bit signed norm; filterable, not baseline-renderable.")
|
|
659
|
+
(member :name rg8uint :description "2×8-bit unsigned int; renderable, not filterable.")
|
|
660
|
+
(member :name rg8sint :description "2×8-bit signed int; renderable, not filterable.")
|
|
661
|
+
(member :name r16uint :description "1×16-bit unsigned int; renderable, not filterable.")
|
|
662
|
+
(member :name r16sint :description "1×16-bit signed int; renderable, not filterable.")
|
|
663
|
+
(member :name rg16uint :description "2×16-bit unsigned int; renderable, not filterable.")
|
|
664
|
+
(member :name rg16sint :description "2×16-bit signed int; renderable, not filterable.")
|
|
665
|
+
(member :name r32sint :description "1×32-bit signed int; renderable, not filterable.")
|
|
666
|
+
(member :name rg32uint :description "2×32-bit unsigned int; renderable, not filterable.")
|
|
667
|
+
(member :name rg32sint :description "2×32-bit signed int; renderable, not filterable.")
|
|
668
|
+
(member :name rg32float :description "2×32-bit float; renderable; filterable only with the float32-filterable feature.")
|
|
669
|
+
(member :name rgba16uint :description "4×16-bit unsigned int; renderable, not filterable.")
|
|
670
|
+
(member :name rgba16sint :description "4×16-bit signed int; renderable, not filterable.")
|
|
671
|
+
(member :name rgba32uint :description "4×32-bit unsigned int; renderable, not filterable.")
|
|
672
|
+
(member :name rgba32sint :description "4×32-bit signed int; renderable, not filterable.")
|
|
673
|
+
(member :name rgb10a2unorm :description "Packed 10/10/10/2-bit unorm; renderable, filterable, blendable.")
|
|
674
|
+
(member :name rgb10a2uint :description "Packed 10/10/10/2-bit unsigned int; renderable, not filterable.")
|
|
675
|
+
(member :name rg11b10ufloat :description "Packed 11/11/10-bit unsigned float; filterable; renderable only with the rg11b10ufloat-renderable feature.")
|
|
676
|
+
(member :name rgb9e5ufloat :description "Packed 9/9/9-bit float, shared 5-bit exponent; filterable, not renderable.")
|
|
677
|
+
; ---- feature-gated (encoded unconditionally; the runtime requests the device feature so they render where the adapter allows) ----
|
|
678
|
+
(member :name bgra8unorm-srgb :description "4×8-bit unorm, BGRA order, sRGB-encoded; needs core-features-and-limits (present on any core, non-compat device).")
|
|
679
|
+
(member :name r16unorm :description "1×16-bit unorm; needs texture-formats-tier1. Renderable + blendable when enabled.")
|
|
680
|
+
(member :name r16snorm :description "1×16-bit signed norm; needs texture-formats-tier1. Renderable + blendable when enabled.")
|
|
681
|
+
(member :name rg16unorm :description "2×16-bit unorm; needs texture-formats-tier1. Renderable + blendable when enabled.")
|
|
682
|
+
(member :name rg16snorm :description "2×16-bit signed norm; needs texture-formats-tier1. Renderable + blendable when enabled.")
|
|
683
|
+
(member :name rgba16unorm :description "4×16-bit unorm; needs texture-formats-tier1. Renderable + blendable when enabled.")
|
|
684
|
+
(member :name rgba16snorm :description "4×16-bit signed norm; needs texture-formats-tier1. Renderable + blendable when enabled.")
|
|
685
|
+
(member :name depth32float-stencil8 :description "32-bit float depth plus 8-bit stencil; needs the depth32float-stencil8 device feature.")
|
|
686
|
+
(member :name preferred-canvas-format :description "Resolved at runtime to the platform's canvas format.")))
|
|
687
|
+
(value-kind :name texture-usage
|
|
688
|
+
:description "GPUTextureUsage flag — what the texture may be used for."
|
|
689
|
+
:underlying symbol
|
|
690
|
+
:members (member-set
|
|
691
|
+
(member :name copy-src :description "Source of copy operations.")
|
|
692
|
+
(member :name copy-dst :description "Destination of copies and image uploads.")
|
|
693
|
+
(member :name texture-binding :description "Bindable as a sampled texture in shaders.")
|
|
694
|
+
(member :name storage-binding :description "Bindable as a storage texture in shaders.")
|
|
695
|
+
(member :name render-attachment :description "Usable as a color or depth/stencil attachment.")))
|
|
696
|
+
(value-kind :name texture-size-mode
|
|
697
|
+
:description "Texture sizing: `canvas` tracks the canvas size at runtime."
|
|
698
|
+
:underlying symbol
|
|
699
|
+
:members (member-set
|
|
700
|
+
(member :name canvas :description "Track the canvas size at runtime (resizes with it).")))
|
|
701
|
+
; One dimension of a GPUExtent3D. `:min 1`, not `:min 0`: a zero-texel
|
|
702
|
+
; dimension is invalid GPU in every direction, and the keys this replaces
|
|
703
|
+
; (`:width`/`:height`, typed `byte-count`) accepted 0 and encoded it.
|
|
704
|
+
(value-kind :name extent-value
|
|
705
|
+
:description "One dimension of a GPUExtent3D, in texels (at least 1)."
|
|
706
|
+
:underlying number
|
|
707
|
+
:numeric (numeric-bounds :min 1 :integer true)
|
|
708
|
+
:unit (unit-shape :reject true)
|
|
709
|
+
:repr (repr-shape :type u32))
|
|
710
|
+
(value-kind :name extent
|
|
711
|
+
:description "One GPUExtent3D dimension: a literal, a bounded expression, or a bare (define …) reference."
|
|
712
|
+
:underlying scalar-or-ref
|
|
713
|
+
:scalar-or-ref (scalar-or-ref-shape :base extent-value :ref define-ref))
|
|
714
|
+
; GPUExtent3D's sequence form: [w], [w h], [w h d]. The missing dimensions are
|
|
715
|
+
; WebGPU's own defaults (height 1, depthOrArrayLayers 1), not pngine's — which
|
|
716
|
+
; is why they are absent rather than materialized (see the defaults policy at
|
|
717
|
+
; the top of this file). A vector, because a sequence of scalars is a vector;
|
|
718
|
+
; three keys, because it was three keys.
|
|
719
|
+
(value-kind :name extent3
|
|
720
|
+
:description "Texture size as [width], [width height], or [width height depth-or-array-layers]; the missing dimensions default to 1."
|
|
721
|
+
:underlying vector
|
|
722
|
+
:vector (vector-shape :element extent :min-len 1 :max-len 3))
|
|
723
|
+
; GPUTextureDescriptor.size is ONE required member, so it is one required key
|
|
724
|
+
; over the three things a pngine texture may be sized by. Three
|
|
725
|
+
; different underlyings — vector, symbol member, cross-ref — so the union
|
|
726
|
+
; cannot be ambiguous. `texture-size-mode` precedes `image-bitmap-ref` because
|
|
727
|
+
; both are symbols and `canvas` must be read as the mode; the emitter's
|
|
728
|
+
; reserved-name check keeps a form from claiming the name.
|
|
729
|
+
(value-kind :name texture-size
|
|
730
|
+
:description "Texture size: an [w h d] extent, `canvas` to track the canvas, or an (image-bitmap …) to take the decoded image's size."
|
|
731
|
+
:underlying union
|
|
732
|
+
:union (union-shape :alternatives [extent3 texture-size-mode image-bitmap-ref]))
|
|
733
|
+
; A canvas-tracking texture at a FRACTION of the canvas — half-resolution
|
|
734
|
+
; ambient occlusion, a quarter-resolution bloom chain. It is a pngine concept,
|
|
735
|
+
; like `canvas` itself: WebGPU has no relative extent, the runtime resolves
|
|
736
|
+
; both at create time and again on resize. `:exclusive-min true` because a
|
|
737
|
+
; zero-texel texture is invalid GPU in every direction; the 8 is a sanity
|
|
738
|
+
; ceiling on supersampling, not a device limit.
|
|
739
|
+
(value-kind :name canvas-scale-value
|
|
740
|
+
:description "Fraction of the canvas, per dimension, for a `:size canvas` texture (0.5 = half resolution). Rounded to whole texels, never below 1."
|
|
741
|
+
:underlying number
|
|
742
|
+
:numeric (numeric-bounds :min 0 :max 8 :exclusive-min true)
|
|
743
|
+
:unit (unit-shape :reject true)
|
|
744
|
+
:repr (repr-shape :type f32))
|
|
745
|
+
(value-kind :name canvas-scale
|
|
746
|
+
:description "Canvas scale: a literal, a bounded expression, or a bare (define …) reference."
|
|
747
|
+
:underlying scalar-or-ref
|
|
748
|
+
:scalar-or-ref (scalar-or-ref-shape :base canvas-scale-value :ref define-ref))
|
|
749
|
+
(value-kind :name index-format
|
|
750
|
+
:description "GPUIndexFormat — byte width of index-buffer entries."
|
|
751
|
+
:underlying symbol
|
|
752
|
+
:members (member-set
|
|
753
|
+
(member :name uint16 :description "16-bit indices (primitive-restart value 0xFFFF).")
|
|
754
|
+
(member :name uint32 :description "32-bit indices (primitive-restart value 0xFFFFFFFF).")))
|
|
755
|
+
(value-kind :name cull-mode
|
|
756
|
+
:description "GPUCullMode — which polygon faces are discarded before rasterization."
|
|
757
|
+
:underlying symbol
|
|
758
|
+
:members (member-set
|
|
759
|
+
(member :name none :description "Draw all polygons.")
|
|
760
|
+
(member :name front :description "Discard front-facing polygons.")
|
|
761
|
+
(member :name back :description "Discard back-facing polygons.")))
|
|
762
|
+
(value-kind :name front-face
|
|
763
|
+
:description "GPUFrontFace — which vertex winding counts as front-facing."
|
|
764
|
+
:underlying symbol
|
|
765
|
+
:members (member-set
|
|
766
|
+
(member :name ccw :description "Counter-clockwise winding is front-facing.")
|
|
767
|
+
(member :name cw :description "Clockwise winding is front-facing.")))
|
|
768
|
+
(value-kind :name shape-format
|
|
769
|
+
:description "Vertex attribute specifier for shape generators (component layout per vertex)."
|
|
770
|
+
:underlying symbol
|
|
771
|
+
:members (member-set
|
|
772
|
+
(member :name position3 :description "Position as 3 floats (x y z).")
|
|
773
|
+
(member :name position4 :description "Position as 4 floats (x y z w).")
|
|
774
|
+
(member :name normal3 :description "Normal as 3 floats.")
|
|
775
|
+
(member :name color3 :description "Color as 3 floats (rgb).")
|
|
776
|
+
(member :name color4 :description "Color as 4 floats (rgba).")
|
|
777
|
+
(member :name uv2 :description "Texture coordinates as 2 floats (indexed meshes: XY-plane projection).")))
|
|
778
|
+
|
|
779
|
+
; ---- Phase 2c: samplers + sampled textures ----
|
|
780
|
+
(value-kind :name sampler-ref
|
|
781
|
+
:description "Reference to a declared (sampler :name …)."
|
|
782
|
+
:underlying symbol
|
|
783
|
+
:cross-ref (cross-ref :target sampler))
|
|
784
|
+
; ---- Phase 2c-assets: imageBitmap from a blob (decoded image → texture) ----
|
|
785
|
+
(value-kind :name image-bitmap-ref
|
|
786
|
+
:description "Reference to a declared (image-bitmap :name …)."
|
|
787
|
+
:underlying symbol
|
|
788
|
+
:cross-ref (cross-ref :target image-bitmap))
|
|
789
|
+
(value-kind :name filter-mode
|
|
790
|
+
:description "GPUFilterMode — texel sampling filter."
|
|
791
|
+
:underlying symbol
|
|
792
|
+
:members (member-set
|
|
793
|
+
(member :name nearest :description "Sample the texel nearest to the coordinates.")
|
|
794
|
+
(member :name linear :description "Linearly interpolate between neighboring texels.")))
|
|
795
|
+
(value-kind :name address-mode
|
|
796
|
+
:description "GPUAddressMode — behavior of texture coordinates outside [0,1]."
|
|
797
|
+
:underlying symbol
|
|
798
|
+
:members (member-set
|
|
799
|
+
(member :name clamp-to-edge :description "Clamp coordinates to the edge texel.")
|
|
800
|
+
(member :name repeat :description "Wrap around to the opposite side.")
|
|
801
|
+
(member :name mirror-repeat :description "Wrap, mirroring the texture on odd repeats.")))
|
|
802
|
+
(value-kind :name compare-function
|
|
803
|
+
:description "GPUCompareFunction — predicate for depth / stencil / sampler comparison tests."
|
|
804
|
+
:underlying symbol
|
|
805
|
+
:members (member-set
|
|
806
|
+
(member :name never :description "Never passes.")
|
|
807
|
+
(member :name less :description "Passes if provided value < stored value.")
|
|
808
|
+
(member :name equal :description "Passes if provided value = stored value.")
|
|
809
|
+
(member :name less-equal :description "Passes if provided value <= stored value.")
|
|
810
|
+
(member :name greater :description "Passes if provided value > stored value.")
|
|
811
|
+
(member :name not-equal :description "Passes if provided value != stored value.")
|
|
812
|
+
(member :name greater-equal :description "Passes if provided value >= stored value.")
|
|
813
|
+
(member :name always :description "Always passes.")))
|
|
814
|
+
(value-kind :name stencil-operation
|
|
815
|
+
:description "GPUStencilOperation — how the stencil value is updated after a test."
|
|
816
|
+
:underlying symbol
|
|
817
|
+
:members (member-set
|
|
818
|
+
(member :name keep :description "Keep the current stencil value.")
|
|
819
|
+
(member :name zero :description "Set the stencil value to 0.")
|
|
820
|
+
(member :name replace :description "Set the stencil value to the pass's stencil-reference.")
|
|
821
|
+
(member :name invert :description "Bitwise-invert the current stencil value.")
|
|
822
|
+
(member :name increment-clamp :description "Increment, clamping at the maximum value.")
|
|
823
|
+
(member :name decrement-clamp :description "Decrement, clamping at 0.")
|
|
824
|
+
(member :name increment-wrap :description "Increment, wrapping to 0 past the maximum.")
|
|
825
|
+
(member :name decrement-wrap :description "Decrement, wrapping to the maximum below 0.")))
|
|
826
|
+
(value-kind :name depth-stencil-section :underlying form :heads (head-set
|
|
827
|
+
(head :name stencil-front :max 1)
|
|
828
|
+
(head :name stencil-back :max 1)))
|
|
829
|
+
|
|
830
|
+
; ---- Phase 2d: MRT / MSAA / advanced render state ----
|
|
831
|
+
; A render-pass attachment view: the canvas (context-current-texture) or a
|
|
832
|
+
; declared (texture …) — e.g. an MSAA color target, or a resolve target.
|
|
833
|
+
(value-kind :name attachment-view
|
|
834
|
+
:underlying union
|
|
835
|
+
:union (union-shape :alternatives [view-source texture-ref]))
|
|
836
|
+
(value-kind :name blend-factor
|
|
837
|
+
:description "GPUBlendFactor — multiplier applied to source / destination color in the blend equation."
|
|
838
|
+
:underlying symbol
|
|
839
|
+
:members (member-set
|
|
840
|
+
(member :name zero :description "(0, 0, 0, 0)")
|
|
841
|
+
(member :name one :description "(1, 1, 1, 1)")
|
|
842
|
+
(member :name src :description "(Rs, Gs, Bs, As) — the fragment's color.")
|
|
843
|
+
(member :name dst :description "(Rd, Gd, Bd, Ad) — the attachment's color.")
|
|
844
|
+
(member :name src-alpha :description "(As, As, As, As) — the fragment's alpha.")
|
|
845
|
+
(member :name dst-alpha :description "(Ad, Ad, Ad, Ad) — the attachment's alpha.")
|
|
846
|
+
(member :name one-minus-src :description "(1-Rs, 1-Gs, 1-Bs, 1-As)")
|
|
847
|
+
(member :name one-minus-dst :description "(1-Rd, 1-Gd, 1-Bd, 1-Ad)")
|
|
848
|
+
(member :name one-minus-src-alpha :description "(1-As, 1-As, 1-As, 1-As) — classic premultiplied-alpha dst factor.")
|
|
849
|
+
(member :name one-minus-dst-alpha :description "(1-Ad, 1-Ad, 1-Ad, 1-Ad)")
|
|
850
|
+
(member :name src-alpha-saturated :description "(min(As, 1-Ad), …, 1)")
|
|
851
|
+
(member :name constant :description "The blend-constant color.")
|
|
852
|
+
(member :name one-minus-constant :description "One minus the blend-constant color.")
|
|
853
|
+
; ---- dual-source blend: the shader's second color output (@blend_src(1)); needs the dual-source-blending device feature ----
|
|
854
|
+
(member :name src1 :description "(Rs1, Gs1, Bs1, As1) — the fragment shader's second color output; needs dual-source-blending.")
|
|
855
|
+
(member :name one-minus-src1 :description "(1-Rs1, 1-Gs1, 1-Bs1, 1-As1) — needs dual-source-blending.")
|
|
856
|
+
(member :name src1-alpha :description "(As1, As1, As1, As1) — the second output's alpha; needs dual-source-blending.")
|
|
857
|
+
(member :name one-minus-src1-alpha :description "(1-As1, 1-As1, 1-As1, 1-As1) — needs dual-source-blending.")))
|
|
858
|
+
(value-kind :name blend-operation
|
|
859
|
+
:description "GPUBlendOperation — how the factored source and destination colors combine."
|
|
860
|
+
:underlying symbol
|
|
861
|
+
:members (member-set
|
|
862
|
+
(member :name add :description "src*srcFactor + dst*dstFactor")
|
|
863
|
+
(member :name subtract :description "src*srcFactor - dst*dstFactor")
|
|
864
|
+
(member :name reverse-subtract :description "dst*dstFactor - src*srcFactor")
|
|
865
|
+
(member :name min :description "min(src, dst) — factors ignored.")
|
|
866
|
+
(member :name max :description "max(src, dst) — factors ignored.")))
|
|
867
|
+
(value-kind :name write-mask-value
|
|
868
|
+
:description "Channel bitmask 0-15 (R=1 G=2 B=4 A=8; spec ALL=0xF)."
|
|
869
|
+
:underlying number
|
|
870
|
+
:numeric (numeric-bounds :min 0 :max 15 :integer true)
|
|
871
|
+
:unit (unit-shape :reject true)
|
|
872
|
+
:repr (repr-shape :type u32))
|
|
873
|
+
; The symbol half used to be the PRIMITIVE `symbol`, which accepts any
|
|
874
|
+
; spelling: `:write-mask everything` validated, and the emitter's "any
|
|
875
|
+
; non-numeric means all channels" fallback wrote 0xF — a target the author
|
|
876
|
+
; believed was masked rendered every channel, with no diagnostic anywhere.
|
|
877
|
+
; One member, closed.
|
|
878
|
+
(value-kind :name write-mask-symbol
|
|
879
|
+
:description "The one symbolic write mask: all (every channel, WebGPU's GPUColorWrite.ALL = 15)."
|
|
880
|
+
:underlying symbol
|
|
881
|
+
:members (member-set :values [all]))
|
|
882
|
+
; A `(scalar-or-ref-shape …)` rather than a hand-written `(union-shape …)` of
|
|
883
|
+
; the same two kinds, and the difference is the diagnostic: SJON's arm report
|
|
884
|
+
; is gated on the scalar-or-ref flag (a hand-written union keeps the collapsed
|
|
885
|
+
; report, deliberately — its alternatives may legitimately overlap). Spelled
|
|
886
|
+
; this way, `:write-mask MASK` says `all` is the only symbol it takes; spelled
|
|
887
|
+
; as a union it said "no alternative matched: write-mask-value |
|
|
888
|
+
; write-mask-symbol". `:ref` need not be a cross-ref kind — the meta-schema
|
|
889
|
+
; defines it as "a symbolic reference", and a closed member set is one.
|
|
890
|
+
(value-kind :name write-mask
|
|
891
|
+
:description "Color write mask: an integer bitmask (R=1 G=2 B=4 A=8) or the symbol all (15). Emitter-resolved."
|
|
892
|
+
:underlying scalar-or-ref
|
|
893
|
+
:scalar-or-ref (scalar-or-ref-shape :base write-mask-value :ref write-mask-symbol))
|
|
894
|
+
|
|
895
|
+
; ---- explicit bind-group-layout (uniform_access feature) ----
|
|
896
|
+
; A `(bind-group-layout …)` declares the binding layout explicitly (per-entry
|
|
897
|
+
; visibility + one resource sub-form: buffer / sampler / texture /
|
|
898
|
+
; storage-texture) instead of inferring it from a pipeline's auto-layout.
|
|
899
|
+
; visibility is a shader-stage set the emitter ORs into the WebGPU descriptor
|
|
900
|
+
; mask (vertex 0x01 / fragment 0x02 / compute 0x04).
|
|
901
|
+
(value-kind :name visibility
|
|
902
|
+
:description "GPUShaderStage — a shader stage that may access the binding."
|
|
903
|
+
:underlying symbol
|
|
904
|
+
:members (member-set
|
|
905
|
+
(member :name vertex :description "Accessible to vertex shaders (mask 0x1).")
|
|
906
|
+
(member :name fragment :description "Accessible to fragment shaders (mask 0x2).")
|
|
907
|
+
(member :name compute :description "Accessible to compute shaders (mask 0x4).")))
|
|
908
|
+
(value-kind :name visibility-list
|
|
909
|
+
:description "Shader-stage set the emitter ORs into the WebGPU visibility mask."
|
|
910
|
+
:underlying vector :vector (vector-shape :element visibility))
|
|
911
|
+
(value-kind :name buffer-binding-type
|
|
912
|
+
:description "GPUBufferBindingType — how the buffer binding is exposed to WGSL."
|
|
913
|
+
:underlying symbol
|
|
914
|
+
:members (member-set
|
|
915
|
+
(member :name uniform :description "var<uniform> — read-only uniform access.")
|
|
916
|
+
(member :name storage :description "var<storage, read_write> — writable storage.")
|
|
917
|
+
(member :name read-only-storage :description "var<storage, read> — read-only storage.")))
|
|
918
|
+
(value-kind :name bind-group-layout-ref
|
|
919
|
+
:description "Reference to a declared (bind-group-layout :name …)."
|
|
920
|
+
:underlying symbol
|
|
921
|
+
:cross-ref (cross-ref :target bind-group-layout))
|
|
922
|
+
(value-kind :name pipeline-layout-ref
|
|
923
|
+
:description "Reference to a declared (pipeline-layout :name …)."
|
|
924
|
+
:underlying symbol
|
|
925
|
+
:cross-ref (cross-ref :target pipeline-layout))
|
|
926
|
+
; GPUPipelineDescriptorBase.layout is ONE required member of type
|
|
927
|
+
; `GPUPipelineLayout | "auto"`, so it is ONE key. It was two keys and
|
|
928
|
+
; an exclusive-group, which said the same thing in three places and let the
|
|
929
|
+
; exported types describe a shape WebGPU does not have.
|
|
930
|
+
; `layout-mode` comes FIRST in the union: SJON tries alternatives in order, so
|
|
931
|
+
; `auto` is matched as the mode before it could ever be read as a name — which
|
|
932
|
+
; is what reserves it (`(pipeline-layout :name auto)` is rejected by the
|
|
933
|
+
; emitter's reserved-name check).
|
|
934
|
+
(value-kind :name pipeline-layout-spec
|
|
935
|
+
:description "GPUPipelineDescriptorBase.layout: auto (derive from the WGSL), or an explicit (pipeline-layout …)."
|
|
936
|
+
:underlying union
|
|
937
|
+
:union (union-shape :alternatives [layout-mode pipeline-layout-ref]))
|
|
938
|
+
; Positional sub-form heads for the explicit bind-group-layout: an (entry …)
|
|
939
|
+
; layout entry and its (buffer …) resource. Both are SLOT-LOCAL forms:
|
|
940
|
+
; declared inline under their parent form and resolved LOCAL-FIRST, so the
|
|
941
|
+
; natural names `entry`/`buffer` shadow within scope — no collision with the
|
|
942
|
+
; global `entry` (render-pipeline stage) or `buffer` (top-level resource) forms.
|
|
943
|
+
; Extends to local (sampler …)/(texture …) resources later.
|
|
944
|
+
(value-kind :name bgl-entry-item :underlying form :heads (head-set :names [entry]))
|
|
945
|
+
; Exactly ONE resource per entry (GPUBindGroupLayoutEntry). Both levels are
|
|
946
|
+
; stated on purpose. `:min-children 1 :max-children 1` (SJON after 1.2.0)
|
|
947
|
+
; counts the WHOLE set — the half per-head bounds cannot express, and what the
|
|
948
|
+
; emitter's `requireOneOf` used to carry. The per-head `:max 1`s are then
|
|
949
|
+
; arithmetically redundant, and kept for their diagnostic: the set yields to
|
|
950
|
+
; the head, so two `(buffer …)` report "at most one `buffer`" (the line to
|
|
951
|
+
; delete) rather than the set's weaker "too many resources".
|
|
952
|
+
(value-kind :name bgl-resource :underlying form :heads (head-set
|
|
953
|
+
:min-children 1 :max-children 1
|
|
954
|
+
(head :name buffer :max 1)
|
|
955
|
+
(head :name sampler :max 1)
|
|
956
|
+
(head :name texture :max 1)
|
|
957
|
+
(head :name storage-texture :max 1)))
|
|
958
|
+
; The three non-buffer resource kinds. Each symbol member IS its WebGPU spelling,
|
|
959
|
+
; so the emitter passes it into the descriptor JSON verbatim (like buffer-binding-type).
|
|
960
|
+
(value-kind :name canvas-alpha-mode
|
|
961
|
+
:description "GPUCanvasAlphaMode — how the canvas alpha channel composites with the page."
|
|
962
|
+
:underlying symbol
|
|
963
|
+
:members (member-set
|
|
964
|
+
(member :name opaque :description "Alpha is ignored; the canvas composites as opaque (the WebGPU spec default; cheaper, no fringe on colored pages).")
|
|
965
|
+
(member :name premultiplied :description "Color values are premultiplied by alpha and blend with the page, so a transparent clear lets the page show through. Never a default: an absent (canvas …) form is opaque, as the IDL says.")))
|
|
966
|
+
(value-kind :name sampler-binding-type
|
|
967
|
+
:description "GPUSamplerBindingType — how a sampler binding is exposed to WGSL."
|
|
968
|
+
:underlying symbol
|
|
969
|
+
:members (member-set
|
|
970
|
+
(member :name filtering :description "sampler — filtering sampler (default).")
|
|
971
|
+
(member :name non-filtering :description "sampler — non-filtering sampler.")
|
|
972
|
+
(member :name comparison :description "sampler_comparison — depth-compare sampler.")))
|
|
973
|
+
(value-kind :name texture-sample-type
|
|
974
|
+
:description "GPUTextureSampleType — the sample type of a bound texture."
|
|
975
|
+
:underlying symbol
|
|
976
|
+
:members (member-set
|
|
977
|
+
(member :name float :description "texture_2d<f32> — filterable float (default).")
|
|
978
|
+
(member :name unfilterable-float :description "Non-filterable float (needs a non-filtering sampler).")
|
|
979
|
+
(member :name depth :description "texture_depth_2d.")
|
|
980
|
+
(member :name sint :description "texture_2d<i32>.")
|
|
981
|
+
(member :name uint :description "texture_2d<u32>.")))
|
|
982
|
+
(value-kind :name storage-texture-access
|
|
983
|
+
:description "GPUStorageTextureAccess — how a storage-texture binding is accessed in WGSL."
|
|
984
|
+
:underlying symbol
|
|
985
|
+
:members (member-set
|
|
986
|
+
(member :name write-only :description "texture_storage_*<…, write> (default).")
|
|
987
|
+
(member :name read-only :description "texture_storage_*<…, read>.")
|
|
988
|
+
(member :name read-write :description "texture_storage_*<…, read_write>.")))
|
|
989
|
+
|
|
990
|
+
; ---- strings ----
|
|
991
|
+
(value-kind :name file-path
|
|
992
|
+
:description "File path relative to the source document (non-empty, no newlines)."
|
|
993
|
+
:underlying string
|
|
994
|
+
:string-bounds (string-bounds :format path))
|
|
995
|
+
; The one string kind that carries CONTENT rather than a name or a path.
|
|
996
|
+
; SJON's `:format` set is email|uri|path|uuid|semver, so there is no schema
|
|
997
|
+
; check for base64 — the emitter decodes and reports `data_base64_invalid`
|
|
998
|
+
; with the offending offset, which is a better diagnostic than a format
|
|
999
|
+
; mismatch could be anyway. ASCII whitespace is stripped before decoding, so
|
|
1000
|
+
; a wrapped triple-quoted literal is legal and diffs by line.
|
|
1001
|
+
(value-kind :name base64-text
|
|
1002
|
+
:description "Standard base64 (RFC 4648, padded). ASCII whitespace is ignored, so the text may be wrapped across lines."
|
|
1003
|
+
:underlying string)
|
|
1004
|
+
|
|
1005
|
+
; ---- vectors ----
|
|
1006
|
+
(value-kind :name float-list :underlying vector :vector (vector-shape :element real))
|
|
1007
|
+
; Viewport: the two shapes the emitter accepts — a 5-element rect is invalid.
|
|
1008
|
+
(value-kind :name viewport-rect4
|
|
1009
|
+
:description "Viewport [x y w h]; minDepth/maxDepth default to 0 and 1."
|
|
1010
|
+
:underlying vector :vector (vector-shape :element real :len 4))
|
|
1011
|
+
(value-kind :name viewport-rect6
|
|
1012
|
+
:description "Viewport [x y w h minDepth maxDepth]; depths in [0,1]."
|
|
1013
|
+
:underlying vector :vector (vector-shape :element real :len 6))
|
|
1014
|
+
(value-kind :name viewport-rect
|
|
1015
|
+
:description "Viewport rectangle: [x y w h] or [x y w h minDepth maxDepth]."
|
|
1016
|
+
:underlying union
|
|
1017
|
+
:union (union-shape :alternatives [viewport-rect4 viewport-rect6]))
|
|
1018
|
+
; Integer pixels / texels / indices: `u32` elements (a literal, a bounded
|
|
1019
|
+
; expression, or a bare (define …) reference — non-negative integer), where
|
|
1020
|
+
; `real` used to let `[0.5 0 1 1.25]` through to be truncated.
|
|
1021
|
+
(value-kind :name pixel-rect
|
|
1022
|
+
:description "Rectangle [x y w h] in integer pixels."
|
|
1023
|
+
:underlying vector :vector (vector-shape :element u32 :len 4))
|
|
1024
|
+
(value-kind :name origin3
|
|
1025
|
+
:description "Copy origin [x y z] in integer texels; z is the destination array layer / depth slice (default 0)."
|
|
1026
|
+
:underlying vector :vector (vector-shape :element u32 :max-len 3))
|
|
1027
|
+
; A buffer/texture with zero usage flags is invalid GPU — require >= 1 (else the
|
|
1028
|
+
; reader emits a buffer with no usage and no diagnostic). `:min-len 1`.
|
|
1029
|
+
(value-kind :name usage-list
|
|
1030
|
+
:description "Buffer usage flags (at least one — a zero-usage buffer is invalid GPU)."
|
|
1031
|
+
:underlying vector :vector (vector-shape :element buffer-usage :min-len 1))
|
|
1032
|
+
; RGBA clear: exactly 4 components (else a 3-element color silently gets alpha 0).
|
|
1033
|
+
(value-kind :name clear-color
|
|
1034
|
+
:description "RGBA clear color: exactly 4 components."
|
|
1035
|
+
:underlying vector :vector (vector-shape :element real :len 4))
|
|
1036
|
+
; RGBA blend-constant: exactly 4 float components, used by the `constant` /
|
|
1037
|
+
; `one-minus-constant` blend factors (setBlendConstant). Same shape as
|
|
1038
|
+
; clear-color; named separately so the description reads for its own role.
|
|
1039
|
+
(value-kind :name blend-constant-color
|
|
1040
|
+
:description "RGBA blend constant: exactly 4 float components (the `constant` blend factor's value)."
|
|
1041
|
+
:underlying vector :vector (vector-shape :element real :len 4))
|
|
1042
|
+
(value-kind :name buffer-ref-list
|
|
1043
|
+
:description "Declared (buffer …) names, bound to vertex slots 0..N in order."
|
|
1044
|
+
:underlying vector :vector (vector-shape :element buffer-ref))
|
|
1045
|
+
(value-kind :name bind-group-ref-list
|
|
1046
|
+
:description "Declared (bind-group …) names, set at @group 0..N in order."
|
|
1047
|
+
:underlying vector :vector (vector-shape :element bind-group-ref))
|
|
1048
|
+
(value-kind :name bind-group-layout-ref-list
|
|
1049
|
+
:description "Declared (bind-group-layout …) names composing a pipeline layout at @group 0..N in order. At least one — a pngine opinion (WebGPU allows an empty list); an empty pipeline layout is `:layout auto` over a shader with no bindings."
|
|
1050
|
+
:underlying vector :vector (vector-shape :element bind-group-layout-ref :min-len 1))
|
|
1051
|
+
(value-kind :name render-bundle-ref-list
|
|
1052
|
+
:description "Declared (render-bundle …) names replayed by a pass."
|
|
1053
|
+
:underlying vector :vector (vector-shape :element render-bundle-ref))
|
|
1054
|
+
; Every list below runs ONCE PER FRAME, so its length multiplies per-frame GPU
|
|
1055
|
+
; work directly. `:max-len 2048` on all three is the command-buffer budget: the
|
|
1056
|
+
; cheapest step that emits anything is a compute pass (begin 1B + set_pipeline
|
|
1057
|
+
; 3B + dispatch 13B + end 1B = 18B), so ~3,640 steps alone exhaust the 64 KB
|
|
1058
|
+
; buffer — and past that the stream TEARS rather than truncates (cmd_count
|
|
1059
|
+
; counts commands whose operand bytes were dropped). 2048 sits below that with
|
|
1060
|
+
; headroom and is 25x the longest list in the corpus (82, webgpu_bitonic_sort).
|
|
1061
|
+
; Mirrored by Emitter.MAX_FRAME_STEPS for the queue-action count, which is
|
|
1062
|
+
; positional and so has no schema length to bound.
|
|
1063
|
+
(value-kind :name queue-ref-list
|
|
1064
|
+
:description "Declared (queue …) names, run in order."
|
|
1065
|
+
:underlying vector :vector (vector-shape :element queue-ref :max-len 2048))
|
|
1066
|
+
(value-kind :name compute-pass-ref-list
|
|
1067
|
+
:description "Declared (compute-pass …) / (init …) names, run in order."
|
|
1068
|
+
:underlying vector :vector (vector-shape :element compute-pass-ref :max-len 2048))
|
|
1069
|
+
; One frame step. The three forms share ONE namespace (SJON 1.2.0 multi-target
|
|
1070
|
+
; cross-ref): a pass and a queue with the same :name is a
|
|
1071
|
+
; `duplicate_cross_ref_target` at the declaration, so a step can never be
|
|
1072
|
+
; ambiguous. (It used to be a union tried in order, while the emitter kept
|
|
1073
|
+
; one table for both pass kinds — a collision silently dropped the render pass.)
|
|
1074
|
+
(value-kind :name frame-step
|
|
1075
|
+
:description "One frame step: a render-pass, compute-pass, queue or step-group name (one namespace across the four)."
|
|
1076
|
+
:underlying symbol
|
|
1077
|
+
:cross-ref (cross-ref :target [render-pass compute-pass queue step-group]))
|
|
1078
|
+
(value-kind :name frame-step-list
|
|
1079
|
+
:description "Passes and queues run every frame, in order."
|
|
1080
|
+
:underlying vector :vector (vector-shape :element frame-step :max-len 2048))
|
|
1081
|
+
; `:min-len 1` because count 0 is not "no color targets" on the wire — it is
|
|
1082
|
+
; the frozen legacy sentinel meaning "substitute the preferred canvas format"
|
|
1083
|
+
; (docs/abi.md §6.5), which is exactly the fabrication 3.0.0 removes.
|
|
1084
|
+
; A depth-only bundle is legal WebGPU and this descriptor cannot express it;
|
|
1085
|
+
; saying so is better than accepting `[]` and encoding the canvas guess.
|
|
1086
|
+
(value-kind :name texture-format-list
|
|
1087
|
+
:description "Color target formats a (render-bundle …) is recorded against (at least one)."
|
|
1088
|
+
:underlying vector :vector (vector-shape :element texture-format :min-len 1))
|
|
1089
|
+
; A `(pass … :reads …)` binds one sampled texture per entry, into the same
|
|
1090
|
+
; group 0 the prelude owns. `:max-len 16` is `maxSampledTexturesPerShaderStage`,
|
|
1091
|
+
; WebGPU's own default limit — the ceiling the whole group shares, so a list at
|
|
1092
|
+
; the bound already leaves nothing for the pass's dependencies.
|
|
1093
|
+
(value-kind :name texture-ref-list
|
|
1094
|
+
:description "Declared (texture …) names a (pass …) samples, bound after its prior-pass dependencies in this order."
|
|
1095
|
+
:underlying vector :vector (vector-shape :element texture-ref :min-len 1 :max-len 16))
|
|
1096
|
+
; 64 is MAX_WGSL_DEPS (src/bytecode/format.zig), reused as a schema bound so
|
|
1097
|
+
; the wire's limit and the authoring limit cannot drift apart.
|
|
1098
|
+
(value-kind :name wgsl-ref-list
|
|
1099
|
+
:description "Fragments a module or pass assembles before its own text, in dependency order."
|
|
1100
|
+
:underlying vector :vector (vector-shape :element wgsl-ref :min-len 1 :max-len 64))
|
|
1101
|
+
; NOT a cross-ref list: these are WGSL identifiers, not names of SJON forms.
|
|
1102
|
+
; The emitter checks them against the assembled module's own declarations.
|
|
1103
|
+
; `wgsl-name` is named rather than the bare `symbol` primitive for the same
|
|
1104
|
+
; reason `entry-point` and `override-name` are (F8): a slot that names
|
|
1105
|
+
; something inside an artifact SJON does not parse still gets a name, so the
|
|
1106
|
+
; closed-symbol sweep records it as a deliberate exception.
|
|
1107
|
+
(value-kind :name wgsl-name
|
|
1108
|
+
:description "An identifier declared inside WGSL — a function, struct, alias or module-scope constant. Opaque to SJON, checked by the emitter against the assembled module's reflection."
|
|
1109
|
+
:underlying symbol)
|
|
1110
|
+
(value-kind :name wgsl-name-list
|
|
1111
|
+
:description "WGSL identifiers a fragment uses but does not declare (its holes), which the importing module must supply."
|
|
1112
|
+
:underlying vector :vector (vector-shape :element wgsl-name :min-len 1 :max-len 64))
|
|
1113
|
+
(value-kind :name data-file-list
|
|
1114
|
+
:description "WASM file paths (a pass's :file) whose data segments become D0, D1, … storage buffers."
|
|
1115
|
+
:underlying vector :vector (vector-shape :element file-path))
|
|
1116
|
+
(value-kind :name offset-list
|
|
1117
|
+
:description "Integer offset list (e.g. per-entry ping-pong pool offsets)."
|
|
1118
|
+
:underlying vector :vector (vector-shape :element u32))
|
|
1119
|
+
(value-kind :name shape-format-list
|
|
1120
|
+
:description "Vertex layout of generated shape data, as ordered attribute specifiers."
|
|
1121
|
+
:underlying vector :vector (vector-shape :element shape-format))
|
|
1122
|
+
(value-kind :name texture-usage-list
|
|
1123
|
+
:description "Texture usage flags (at least one)."
|
|
1124
|
+
:underlying vector :vector (vector-shape :element texture-usage :min-len 1))
|
|
1125
|
+
; GPUExtent3D's sequence rule again, one form over: [x], [x y], [x y z], the
|
|
1126
|
+
; missing dimensions WebGPU's own default of 1. Vector-only — the
|
|
1127
|
+
; alternative was a union with a bare `:workgroups 64` beside `[16 16 1]`,
|
|
1128
|
+
; which would leave the grammar with exactly one member that has two shapes
|
|
1129
|
+
; while texture `:size 512` stays illegal.
|
|
1130
|
+
;
|
|
1131
|
+
; The element is `count` — a literal, a bounded expression, or a bare
|
|
1132
|
+
; `(define …)` name — since 3.0.0 (`[WG 1 1]` works; it used to
|
|
1133
|
+
; be `count-value`, literals and expressions only, because the element
|
|
1134
|
+
; reader resolved no symbols).
|
|
1135
|
+
(value-kind :name dispatch-size
|
|
1136
|
+
:description "Compute dispatch in workgroups as [x], [x y] or [x y z]; the missing dimensions default to 1. Elements are literals, expressions, or (define …) names."
|
|
1137
|
+
:underlying vector :vector (vector-shape :element count :min-len 1 :max-len 3))
|
|
1138
|
+
; `(wasm-call …)` args: the emitter encodes a type tag per arg (+ 4 value bytes for
|
|
1139
|
+
; literals); the legacy spells the builtins `canvas.width`/etc.
|
|
1140
|
+
; Same closure as `write-mask`, one form over: the symbol half was the
|
|
1141
|
+
; primitive, so `:args [canvas-widht]` validated and reached an emitter check
|
|
1142
|
+
; that had to exist because the schema could not say the four names. The
|
|
1143
|
+
; emitter's map is still the authority on the ENCODING; the schema is
|
|
1144
|
+
; the authority on the spelling, and the two are pinned together by
|
|
1145
|
+
; `values.mapWasmArgType` (a member the map does not know is `internal:`).
|
|
1146
|
+
(value-kind :name wasm-arg-builtin
|
|
1147
|
+
:description "A runtime value the player fills in before each (wasm-call …)."
|
|
1148
|
+
:underlying symbol
|
|
1149
|
+
:members (member-set
|
|
1150
|
+
(member :name canvas-width :description "Canvas width in physical pixels.")
|
|
1151
|
+
(member :name canvas-height :description "Canvas height in physical pixels.")
|
|
1152
|
+
(member :name time-total :description "Seconds since playback started.")
|
|
1153
|
+
(member :name time-delta :description "Seconds since the previous frame.")))
|
|
1154
|
+
(value-kind :name wasm-arg
|
|
1155
|
+
:description "WASM call argument: a numeric literal, or a runtime builtin the player fills each frame (canvas-width, canvas-height, time-total, time-delta)."
|
|
1156
|
+
:underlying union :union (union-shape :alternatives [wasm-arg-builtin number]))
|
|
1157
|
+
(value-kind :name wasm-arg-list
|
|
1158
|
+
:description "Arguments passed to a (wasm-call …) function each frame."
|
|
1159
|
+
:underlying vector :vector (vector-shape :element wasm-arg))
|
|
1160
|
+
|
|
1161
|
+
; ---- positional head-sets ----
|
|
1162
|
+
; Per-head `:min`/`:max` (SJON 1.2.0) carry the IDL's cardinality: a
|
|
1163
|
+
; GPURenderPipelineDescriptor has exactly one vertex stage and at most one of
|
|
1164
|
+
; each other state; a compute pipeline has exactly one compute stage. Below
|
|
1165
|
+
; the floor is `positional_missing` (on the parent), above the ceiling
|
|
1166
|
+
; `positional_too_many` (on the extra child) — both located, at validation.
|
|
1167
|
+
; Until 1.3 these were unenforced or hand-checked in the emitter.
|
|
1168
|
+
(value-kind :name pipeline-section :underlying form :heads (head-set
|
|
1169
|
+
(head :name vertex :min 1 :max 1)
|
|
1170
|
+
(head :name fragment :max 1)
|
|
1171
|
+
(head :name primitive :max 1)
|
|
1172
|
+
(head :name depth-stencil :max 1)
|
|
1173
|
+
(head :name multisample :max 1)))
|
|
1174
|
+
; A stage's module and entry point are SCALARS, so they are keys; what
|
|
1175
|
+
; is left positional is the stage's sequences — `GPUVertexState.buffers`
|
|
1176
|
+
; and `GPUFragmentState.targets`, spliced in directly with no wrapper form.
|
|
1177
|
+
(value-kind :name vertex-section :underlying form :heads (head-set
|
|
1178
|
+
(head :name vertex-buffer)
|
|
1179
|
+
(head :name constant)))
|
|
1180
|
+
; `:min 1` on `color-target` is a deliberate PNGine narrowing of
|
|
1181
|
+
; GPUFragmentState.targets, which WebGPU lets be empty (a depth-only fragment
|
|
1182
|
+
; stage). Removing the wrapper costed as "zero targets becomes legal" — but
|
|
1183
|
+
; pngine has no runtime that honours it: wgpu_native_gpu's
|
|
1184
|
+
; pipeline decoder substitutes ONE BGRA8Unorm target when the list is empty,
|
|
1185
|
+
; and gpu.js passes the empty list through, so the two backends would build
|
|
1186
|
+
; DIFFERENT pipelines from the same document. That is exactly the fabrication
|
|
1187
|
+
; 3.0.0 set out to remove, so the floor stays until a backend can
|
|
1188
|
+
; express a depth-only stage. It also closes a hole the wrapper left open:
|
|
1189
|
+
; `(targets)` with no children validated and reached the same fabrication.
|
|
1190
|
+
(value-kind :name fragment-section :underlying form :heads (head-set
|
|
1191
|
+
(head :name color-target :min 1)
|
|
1192
|
+
(head :name constant)))
|
|
1193
|
+
; One stage per compute pipeline, spelled as a form like the other two. The
|
|
1194
|
+
; schema used to argue the flat `:module`/`:entry` shape was natural
|
|
1195
|
+
; here; it is the same GPUProgrammableStage the vertex and fragment stages
|
|
1196
|
+
; carry, and one rule that holds everywhere beats three shapes that each read
|
|
1197
|
+
; well alone.
|
|
1198
|
+
(value-kind :name compute-pipeline-section :underlying form :heads (head-set
|
|
1199
|
+
(head :name compute :min 1 :max 1)))
|
|
1200
|
+
(value-kind :name compute-section :underlying form :heads (head-set :names [constant]))
|
|
1201
|
+
; What an `(import …)` rebinds: the imported document's CONSUMED forms — its
|
|
1202
|
+
; `(define …)` constants and its `(wgsl …)` fragments — spelled as the same
|
|
1203
|
+
; form they replace. A name→value record is repeated child forms, not a key
|
|
1204
|
+
; holding a list — the rule overhaul 02 set and §409 relearned. No `:min`: an
|
|
1205
|
+
; import with no children is the whole document, verbatim. An emitting form
|
|
1206
|
+
; (a texture, a pipeline) is not admitted: it has an emission position, and
|
|
1207
|
+
; re-declaring one at top level is `duplicate_cross_ref_target` anyway.
|
|
1208
|
+
(value-kind :name import-section :underlying form :heads (head-set :names [define wgsl]))
|
|
1209
|
+
(value-kind :name attribute-item :underlying form :heads (head-set :names [attribute]))
|
|
1210
|
+
(value-kind :name color-target-section :underlying form :heads (head-set
|
|
1211
|
+
(head :name blend :max 1)))
|
|
1212
|
+
; GPUBlendState requires BOTH components — `(blend (color …))` alone used to
|
|
1213
|
+
; validate and die on the GPU.
|
|
1214
|
+
(value-kind :name blend-section :underlying form :heads (head-set
|
|
1215
|
+
(head :name color :min 1 :max 1)
|
|
1216
|
+
(head :name alpha :min 1 :max 1)))
|
|
1217
|
+
(value-kind :name render-pass-section :underlying form :heads (head-set
|
|
1218
|
+
(head :name color-attachment)
|
|
1219
|
+
(head :name depth-stencil-attachment :max 1)
|
|
1220
|
+
(head :name draw)
|
|
1221
|
+
(head :name draw-indexed)
|
|
1222
|
+
(head :name draw-indirect)
|
|
1223
|
+
(head :name draw-indexed-indirect)
|
|
1224
|
+
(head :name timestamp-writes :max 1)
|
|
1225
|
+
(head :name occlusion-query)))
|
|
1226
|
+
; ---- (draw-graph …) head-sets ----
|
|
1227
|
+
; Every head below names the GLOBAL form of that name — the same
|
|
1228
|
+
; `(depth-stencil …)`, `(bind-group …)`, `(vertex-buffer …)` a pipeline, a
|
|
1229
|
+
; group and a vertex stage already take — so the hook clones what the author
|
|
1230
|
+
; wrote and a key added to one of those forms reaches the graph with no edit
|
|
1231
|
+
; here. The two exceptions are `(vertex …)` / `(fragment …)`, declared
|
|
1232
|
+
; slot-local under `(in …)`: see the comment there.
|
|
1233
|
+
(value-kind :name stage-ref
|
|
1234
|
+
:description "Reference to a (stage :name …) of the same (draw-graph …)."
|
|
1235
|
+
:underlying symbol
|
|
1236
|
+
:cross-ref (cross-ref :target stage))
|
|
1237
|
+
(value-kind :name draw-graph-section :underlying form :heads (head-set
|
|
1238
|
+
(head :name stage)
|
|
1239
|
+
(head :name geometry)))
|
|
1240
|
+
; A stage is a pass's attachments plus the pipeline state every geometry in
|
|
1241
|
+
; it shares. Its `(bind-group …)` children carry no `:layout` — the graph
|
|
1242
|
+
; fills one in per generated pipeline — which is the spelling §416 gave a
|
|
1243
|
+
; group whose pipeline is left open.
|
|
1244
|
+
(value-kind :name draw-stage-section :underlying form :heads (head-set
|
|
1245
|
+
(head :name color-attachment)
|
|
1246
|
+
(head :name color-target)
|
|
1247
|
+
(head :name depth-stencil-attachment :max 1)
|
|
1248
|
+
(head :name depth-stencil :max 1)
|
|
1249
|
+
(head :name primitive :max 1)
|
|
1250
|
+
(head :name bind-group)))
|
|
1251
|
+
; A geometry is its buffers, its vertex layout, ONE draw command, and one
|
|
1252
|
+
; `(in …)` per stage it appears in. The head-set cannot say "exactly one of
|
|
1253
|
+
; these four", so the hook does.
|
|
1254
|
+
(value-kind :name geometry-section :underlying form :heads (head-set
|
|
1255
|
+
(head :name vertex-buffer)
|
|
1256
|
+
(head :name draw :max 1)
|
|
1257
|
+
(head :name draw-indexed :max 1)
|
|
1258
|
+
(head :name draw-indirect :max 1)
|
|
1259
|
+
(head :name draw-indexed-indirect :max 1)
|
|
1260
|
+
(head :name in)))
|
|
1261
|
+
(value-kind :name in-section :underlying form :heads (head-set
|
|
1262
|
+
(head :name vertex :min 1 :max 1)
|
|
1263
|
+
(head :name fragment :max 1)
|
|
1264
|
+
(head :name primitive :max 1)))
|
|
1265
|
+
; What an `(in …)`'s stage forms may hold: overrides, and nothing else. The
|
|
1266
|
+
; global `(vertex …)` also admits `(vertex-buffer …)` and the global
|
|
1267
|
+
; `(fragment …)` REQUIRES at least one `(color-target …)`; here the geometry owns
|
|
1268
|
+
; the vertex layout and the stage's color attachments derive the color-targets, so
|
|
1269
|
+
; both absences are the narrowing, enforced by this head-set rather than by
|
|
1270
|
+
; the hook.
|
|
1271
|
+
(value-kind :name in-stage-section :underlying form :heads (head-set
|
|
1272
|
+
(head :name constant)))
|
|
1273
|
+
(value-kind :name bind-entry-item :underlying form :heads (head-set :names [entry]))
|
|
1274
|
+
(value-kind :name queue-action :underlying form :heads (head-set :names [write-buffer copy-texture-to-texture copy-external-image-to-texture resolve-query-set copy-buffer-to-buffer]))
|
|
1275
|
+
; Both texture copies take exactly one endpoint of each kind. The heads
|
|
1276
|
+
; are shared but the FORMS are not — each copy declares its own slot-local
|
|
1277
|
+
; `source`/`destination`, resolved local-first, so `(source :image …)` under
|
|
1278
|
+
; one is not `(source :texture …)` under the other.
|
|
1279
|
+
(value-kind :name copy-endpoints-section :underlying form :heads (head-set
|
|
1280
|
+
(head :name source :min 1 :max 1)
|
|
1281
|
+
(head :name destination :min 1 :max 1)))
|
|
1282
|
+
; A compute pass issues at least one command: a pass that dispatches
|
|
1283
|
+
; nothing is always an authoring slip. WebGPU has no such rule — this is
|
|
1284
|
+
; pngine's opinion, and it is one line of schema rather than an emitter check.
|
|
1285
|
+
; Unbounded per head: several dispatches in one pass is legal WebGPU.
|
|
1286
|
+
(value-kind :name compute-pass-command :underlying form :heads (head-set
|
|
1287
|
+
:min-children 1
|
|
1288
|
+
(head :name dispatch)
|
|
1289
|
+
(head :name dispatch-indirect)))
|
|
1290
|
+
; A bundle records EXACTLY ONE draw, and only a direct one. Not an opinion:
|
|
1291
|
+
; the create_render_bundle descriptor carries a single `drawType` byte with
|
|
1292
|
+
; two values, decoded that way by gpu.js, the native backend and the reference
|
|
1293
|
+
; dispatcher alike. `draw-indirect` in a bundle, and a second draw, arrive
|
|
1294
|
+
; when that descriptor does.
|
|
1295
|
+
(value-kind :name render-bundle-command :underlying form :heads (head-set
|
|
1296
|
+
:min-children 1
|
|
1297
|
+
:max-children 1
|
|
1298
|
+
(head :name draw :max 1)
|
|
1299
|
+
(head :name draw-indexed :max 1)))
|
|
1300
|
+
; `(data …)` generators: a positional sub-form whose head selects a procedural shape
|
|
1301
|
+
; (cube/sphere/…) or `wasm-data` (a WASM function that returns the vertex bytes).
|
|
1302
|
+
; At most ONE per (data …) — one byte source, nine spellings. Per-head bounds
|
|
1303
|
+
; say "at most one of each"; "at most one across the nine" is the ceiling over
|
|
1304
|
+
; the SET (SJON after 1.2.0 — it replaced the emitter's `requireOneOf`).
|
|
1305
|
+
; `:max-children` with no floor, since a (data … :float32 […]) / (data …
|
|
1306
|
+
; :file …) carries no generator at all.
|
|
1307
|
+
(value-kind :name data-shape-section :underlying form :heads (head-set
|
|
1308
|
+
:max-children 1
|
|
1309
|
+
(head :name cube :max 1)
|
|
1310
|
+
(head :name plane :max 1)
|
|
1311
|
+
(head :name sphere :max 1)
|
|
1312
|
+
(head :name torus :max 1)
|
|
1313
|
+
(head :name truncated-cone :max 1)
|
|
1314
|
+
(head :name cylinder :max 1)
|
|
1315
|
+
(head :name teapot :max 1)
|
|
1316
|
+
(head :name dragon :max 1)
|
|
1317
|
+
(head :name wasm-data :max 1)
|
|
1318
|
+
(head :name bytes :max 1)))
|
|
1319
|
+
|
|
1320
|
+
; =====================================================================
|
|
1321
|
+
; Top-level forms
|
|
1322
|
+
; =====================================================================
|
|
1323
|
+
|
|
1324
|
+
; This document is another document plus a rebinding of its consumed forms.
|
|
1325
|
+
; The imported forms come first, then this document's own; the `(import …)`
|
|
1326
|
+
; form itself is CONSUMED before validation, like a `(wgsl …)` fragment, so
|
|
1327
|
+
; it lowers to nothing and never reaches the emitter.
|
|
1328
|
+
;
|
|
1329
|
+
; Only a consumed form — `(define …)`, `(wgsl …)` — may be rebound, and that
|
|
1330
|
+
; is not a restriction the emitter has to enforce: two documents declaring
|
|
1331
|
+
; one texture is `duplicate_cross_ref_target` from SJON, reported on the
|
|
1332
|
+
; second declaration. A consumed form has no emission position (moving a
|
|
1333
|
+
; define or a fragment is byte-identical, both probed), so a rebinding
|
|
1334
|
+
; perturbs nothing — the composed document emits exactly what the imported
|
|
1335
|
+
; one emits, with the value or the fragment's text changed. Rebinding a name
|
|
1336
|
+
; the imported document does not declare under that head is refused, which
|
|
1337
|
+
; is what makes a typo loud.
|
|
1338
|
+
(form :name import
|
|
1339
|
+
:description "Compile another document ahead of this one, rebinding its (define …) constants and (wgsl …) fragments. The imported forms come first; the import itself is consumed and emits nothing."
|
|
1340
|
+
:positional import-section
|
|
1341
|
+
(key :name file :type file-path
|
|
1342
|
+
:description "Path to the .sjon document this one extends, resolved like every other :file — relative, no climbing out of the compile's root."))
|
|
1343
|
+
|
|
1344
|
+
(form :name define
|
|
1345
|
+
:description "Named numeric constant, usable in every numeric slot and vector element as a bare name or inside a bounded expression."
|
|
1346
|
+
(key :name name :type symbol
|
|
1347
|
+
:description "Constant name, referenced from numeric slots, vector elements and expressions.")
|
|
1348
|
+
(key :name value :type real
|
|
1349
|
+
:description "The constant's value: a real (negative and fractional allowed), a bounded expression, or another constant's name — the slot that reads the constant decides integrality and range."))
|
|
1350
|
+
|
|
1351
|
+
; Authored WebGPU device requiredLimits. Optional singleton (declare at most
|
|
1352
|
+
; once, no :name). Each present key raises the corresponding GPUSupportedLimits
|
|
1353
|
+
; entry — REQUIREMENTS, not clamps: the runtime passes them verbatim to
|
|
1354
|
+
; device().requestDevice({requiredLimits}); an unsatisfiable value fails loud at
|
|
1355
|
+
; device creation. Also feeds compile-time validation — e.g. raising
|
|
1356
|
+
; :max-compute-workgroup-size-x unlocks @workgroup_size(512). Names are the exact
|
|
1357
|
+
; WebGPU GPUSupportedLimits members (kebab here → camelCase on the wire).
|
|
1358
|
+
(form :name limits
|
|
1359
|
+
:description "Authored WebGPU device requiredLimits (optional singleton)."
|
|
1360
|
+
(key :name max-texture-dimension-1d :type device-limit :optional true
|
|
1361
|
+
:description "Max width of a 1D texture (default 8192).")
|
|
1362
|
+
(key :name max-texture-dimension-2d :type device-limit :optional true
|
|
1363
|
+
:description "Max width/height of a 2D texture (default 8192).")
|
|
1364
|
+
(key :name max-texture-dimension-3d :type device-limit :optional true
|
|
1365
|
+
:description "Max width/height/depth of a 3D texture (default 2048).")
|
|
1366
|
+
(key :name max-texture-array-layers :type device-limit :optional true
|
|
1367
|
+
:description "Max array layers of a 2D texture (default 256).")
|
|
1368
|
+
(key :name max-bind-groups :type device-limit :optional true
|
|
1369
|
+
:description "Max simultaneous bind groups (default 4).")
|
|
1370
|
+
(key :name max-bind-groups-plus-vertex-buffers :type device-limit :optional true
|
|
1371
|
+
:description "Max bind groups + vertex buffers combined (default 24).")
|
|
1372
|
+
(key :name max-bindings-per-bind-group :type device-limit :optional true
|
|
1373
|
+
:description "Max bindings in a single bind group (default 1000).")
|
|
1374
|
+
(key :name max-dynamic-uniform-buffers-per-pipeline-layout :type device-limit :optional true
|
|
1375
|
+
:description "Max dynamic-offset uniform buffers per pipeline layout (default 8).")
|
|
1376
|
+
(key :name max-dynamic-storage-buffers-per-pipeline-layout :type device-limit :optional true
|
|
1377
|
+
:description "Max dynamic-offset storage buffers per pipeline layout (default 4).")
|
|
1378
|
+
(key :name max-sampled-textures-per-shader-stage :type device-limit :optional true
|
|
1379
|
+
:description "Max sampled textures per shader stage (default 16).")
|
|
1380
|
+
(key :name max-samplers-per-shader-stage :type device-limit :optional true
|
|
1381
|
+
:description "Max samplers per shader stage (default 16).")
|
|
1382
|
+
(key :name max-storage-buffers-per-shader-stage :type device-limit :optional true
|
|
1383
|
+
:description "Max storage buffers per shader stage (default 8).")
|
|
1384
|
+
(key :name max-storage-buffers-in-vertex-stage :type device-limit :optional true
|
|
1385
|
+
:description "Max storage buffers in the vertex stage (compat split-stage limit; default 8).")
|
|
1386
|
+
(key :name max-storage-buffers-in-fragment-stage :type device-limit :optional true
|
|
1387
|
+
:description "Max storage buffers in the fragment stage (compat split-stage limit; default 8).")
|
|
1388
|
+
(key :name max-storage-textures-per-shader-stage :type device-limit :optional true
|
|
1389
|
+
:description "Max storage textures per shader stage (default 4).")
|
|
1390
|
+
(key :name max-storage-textures-in-vertex-stage :type device-limit :optional true
|
|
1391
|
+
:description "Max storage textures in the vertex stage (compat split-stage limit; default 4).")
|
|
1392
|
+
(key :name max-storage-textures-in-fragment-stage :type device-limit :optional true
|
|
1393
|
+
:description "Max storage textures in the fragment stage (compat split-stage limit; default 4).")
|
|
1394
|
+
(key :name max-immediate-size :type device-limit :optional true
|
|
1395
|
+
:description "Max size in bytes of a pipeline's immediate-data range; must be a multiple of 4 (default 64).")
|
|
1396
|
+
(key :name max-uniform-buffers-per-shader-stage :type device-limit :optional true
|
|
1397
|
+
:description "Max uniform buffers per shader stage (default 12).")
|
|
1398
|
+
(key :name max-uniform-buffer-binding-size :type device-limit :optional true
|
|
1399
|
+
:description "Max bound range of a uniform buffer in bytes (default 65536).")
|
|
1400
|
+
(key :name max-storage-buffer-binding-size :type device-limit :optional true
|
|
1401
|
+
:description "Max bound range of a storage buffer in bytes (default 134217728).")
|
|
1402
|
+
(key :name min-uniform-buffer-offset-alignment :type device-limit :optional true
|
|
1403
|
+
:description "Required alignment of a dynamic uniform buffer offset (default 256).")
|
|
1404
|
+
(key :name min-storage-buffer-offset-alignment :type device-limit :optional true
|
|
1405
|
+
:description "Required alignment of a dynamic storage buffer offset (default 256).")
|
|
1406
|
+
(key :name max-vertex-buffers :type device-limit :optional true
|
|
1407
|
+
:description "Max vertex buffers in a render pipeline (default 8).")
|
|
1408
|
+
(key :name max-buffer-size :type device-limit :optional true
|
|
1409
|
+
:description "Max size of a buffer in bytes (default 268435456).")
|
|
1410
|
+
(key :name max-vertex-attributes :type device-limit :optional true
|
|
1411
|
+
:description "Max vertex attributes across all buffers (default 16).")
|
|
1412
|
+
(key :name max-vertex-buffer-array-stride :type device-limit :optional true
|
|
1413
|
+
:description "Max stride of a vertex buffer in bytes (default 2048).")
|
|
1414
|
+
(key :name max-inter-stage-shader-variables :type device-limit :optional true
|
|
1415
|
+
:description "Max inter-stage shader variables (default 16).")
|
|
1416
|
+
(key :name max-color-attachments :type device-limit :optional true
|
|
1417
|
+
:description "Max color attachments in a render pass (default 8).")
|
|
1418
|
+
(key :name max-color-attachment-bytes-per-sample :type device-limit :optional true
|
|
1419
|
+
:description "Max total bytes per sample across color attachments (default 32).")
|
|
1420
|
+
(key :name max-compute-workgroup-storage-size :type device-limit :optional true
|
|
1421
|
+
:description "Max var<workgroup> storage in bytes (default 16384).")
|
|
1422
|
+
(key :name max-compute-invocations-per-workgroup :type device-limit :optional true
|
|
1423
|
+
:description "Max x*y*z of a compute @workgroup_size (default 256).")
|
|
1424
|
+
(key :name max-compute-workgroup-size-x :type device-limit :optional true
|
|
1425
|
+
:description "Max X of a compute @workgroup_size (default 256).")
|
|
1426
|
+
(key :name max-compute-workgroup-size-y :type device-limit :optional true
|
|
1427
|
+
:description "Max Y of a compute @workgroup_size (default 256).")
|
|
1428
|
+
(key :name max-compute-workgroup-size-z :type device-limit :optional true
|
|
1429
|
+
:description "Max Z of a compute @workgroup_size (default 64).")
|
|
1430
|
+
(key :name max-compute-workgroups-per-dimension :type device-limit :optional true
|
|
1431
|
+
:description "Max dispatchWorkgroups count per dimension (default 65535)."))
|
|
1432
|
+
|
|
1433
|
+
(form :name canvas
|
|
1434
|
+
:description "Canvas presentation configuration (optional singleton). Carried as a
|
|
1435
|
+
header flag, consumed by the JS runtime at context.configure() before
|
|
1436
|
+
the executor runs. Form absent → opaque, as
|
|
1437
|
+
GPUCanvasConfiguration.alphaMode. Write (canvas :alpha-mode
|
|
1438
|
+
premultiplied) for a canvas the page shows through.
|
|
1439
|
+
Native --frame renders offscreen and ignores it. viewFormats/
|
|
1440
|
+
colorSpace/toneMapping are not modelled: anything list-shaped
|
|
1441
|
+
needs a chained header table, and the 3 reserved header bytes
|
|
1442
|
+
are consumed by the device-limits offset."
|
|
1443
|
+
(key :name alpha-mode :type canvas-alpha-mode :default opaque
|
|
1444
|
+
:description "GPUCanvasConfiguration.alphaMode — opaque (the default) or premultiplied, which lets the page behind the canvas show through wherever the rendered alpha is below 1."))
|
|
1445
|
+
|
|
1446
|
+
; A FRAGMENT: named WGSL that is not a GPU object. It exists only to be
|
|
1447
|
+
; imported, is never validated, minified or shipped on its own, and lowers to
|
|
1448
|
+
; nothing — the assembled module that imports it is what reaches wgslender.
|
|
1449
|
+
;
|
|
1450
|
+
; A fragment may reference names it does not declare (its HOLES), because WGSL
|
|
1451
|
+
; is order-independent at module scope: the assembled text is one unit, so
|
|
1452
|
+
; whichever import or root declares the name satisfies it. That is what lets
|
|
1453
|
+
; one `fbm` fragment be instantiated over three different `noise` functions
|
|
1454
|
+
; without a WGSL extension. `:requires` declares the holes so a missing one is
|
|
1455
|
+
; reported against the fragment rather than as an unresolved identifier
|
|
1456
|
+
; somewhere in an assembled module the author never wrote.
|
|
1457
|
+
(form :name wgsl
|
|
1458
|
+
:description "A named WGSL fragment, from inline :code or a :file, assembled into the modules that :imports it. Not a GPU object: never validated, minified or shipped alone."
|
|
1459
|
+
(key :name name :type symbol
|
|
1460
|
+
:description "Fragment name referenced by another fragment's, a (shader-module …)'s or a (pass …)'s :imports.")
|
|
1461
|
+
(key :name code :type string :optional true
|
|
1462
|
+
:description "WGSL source text, kept verbatim. Exactly one of :code or :file.")
|
|
1463
|
+
(key :name file :type file-path :optional true
|
|
1464
|
+
:description "Path to a .wgsl file, relative to the source document. Exactly one of :code or :file.")
|
|
1465
|
+
(key :name imports :type wgsl-ref-list :optional true
|
|
1466
|
+
:description "Fragments this one is assembled behind, in dependency order. The graph must be acyclic and each fragment appears once per assembled module.")
|
|
1467
|
+
(key :name requires :type wgsl-name-list :optional true
|
|
1468
|
+
:description "WGSL identifiers this fragment uses but does not declare. Every one must be declared by the module that imports it (or by a sibling fragment) — reached or not, since validation runs before dead-code elimination. `validate` checks the list against the fragment's own text and warns both ways: a listed name never used as a hole, a hole never listed.")
|
|
1469
|
+
(exclusive-group :cardinality exactly-one
|
|
1470
|
+
(alt :keys [code])
|
|
1471
|
+
(alt :keys [file])))
|
|
1472
|
+
|
|
1473
|
+
(form :name shader-module
|
|
1474
|
+
:description "A named WGSL module. The source is opaque text to SJON. With :imports it is the ROOT of an assembled module: its fragments' text in dependency order, then its own."
|
|
1475
|
+
(key :name name :type symbol
|
|
1476
|
+
:description "Module name referenced by a pipeline stage's :module key.")
|
|
1477
|
+
(key :name code :type string :optional true
|
|
1478
|
+
:description "WGSL source text, kept verbatim (a triple-quoted string's indentation is part of the shader). Exactly one of :code or :file.")
|
|
1479
|
+
(key :name file :type file-path :optional true
|
|
1480
|
+
:description "Path to a .wgsl file, relative to the source document. Exactly one of :code or :file.")
|
|
1481
|
+
(key :name imports :type wgsl-ref-list :optional true
|
|
1482
|
+
:description "Fragments assembled ahead of this module's own text. Minification and dead-code elimination run once over the whole assembled module, so names stay consistent across fragment boundaries and unreached fragment code is dropped.")
|
|
1483
|
+
(exclusive-group :cardinality exactly-one
|
|
1484
|
+
(alt :keys [code])
|
|
1485
|
+
(alt :keys [file])))
|
|
1486
|
+
|
|
1487
|
+
(form :name data
|
|
1488
|
+
:description "Binary data, from exactly one source: an inline float32 array, a
|
|
1489
|
+
positional shape sub-form (cube/teapot/…) the emitter expands to
|
|
1490
|
+
vertex bytes, a positional `(bytes …)` carrying verbatim bytes
|
|
1491
|
+
from a sidecar file or inline base64, or a `:file` image file the
|
|
1492
|
+
emitter reads from disk and embeds as [mime_len][mime][bytes]
|
|
1493
|
+
(consumed by an image-bitmap). Only the image source is wrapped,
|
|
1494
|
+
and only it cannot size a buffer."
|
|
1495
|
+
:positional data-shape-section
|
|
1496
|
+
(key :name name :type symbol
|
|
1497
|
+
:description "Data name referenced by buffer :data / :index-of and image-bitmap :data.")
|
|
1498
|
+
(key :name float32 :type float-list :optional true
|
|
1499
|
+
:description "Inline float32 array embedded little-endian in the payload.")
|
|
1500
|
+
(key :name file :type file-path :optional true
|
|
1501
|
+
:description "Image file path (relative to the source file) embedded as [mime_len][mime][bytes]; decoded at runtime via createImageBitmap.")
|
|
1502
|
+
(key :name mime :type string :optional true
|
|
1503
|
+
:description "MIME type stored with the :file bytes (e.g. image/png); default application/octet-stream. Ignored when there is no :file.")
|
|
1504
|
+
; One source per (data …): the inline array OR the file (both used to
|
|
1505
|
+
; validate and the file won in silence). The remaining sources are
|
|
1506
|
+
; positional — the eight shape generators, `(wasm-data …)` and `(bytes …)` —
|
|
1507
|
+
; and a head-set is something the group cannot count against; the emitter
|
|
1508
|
+
; refuses a positional source beside either key, and a (data …) with none.
|
|
1509
|
+
(exclusive-group :cardinality at-most-one
|
|
1510
|
+
(alt :keys [float32])
|
|
1511
|
+
(alt :keys [file])))
|
|
1512
|
+
|
|
1513
|
+
(form :name image-bitmap
|
|
1514
|
+
:description "A decoded image created from a (data … :file …) entry. Copied into a texture via a (copy-external-image-to-texture …) queue action."
|
|
1515
|
+
(key :name name :type symbol)
|
|
1516
|
+
(key :name data :type data-ref
|
|
1517
|
+
:description "The (data … :file …) entry holding the encoded image bytes."))
|
|
1518
|
+
|
|
1519
|
+
; ---- shape sub-forms (positional children of `(data …)`) ----
|
|
1520
|
+
; `:open true` so generator-specific numeric config (segments, rings, radius,
|
|
1521
|
+
; thickness, …) is accepted without enumerating it per shape; the emitter reads
|
|
1522
|
+
; the keys it knows. Indexed shapes (teapot, dragon) also produce `_indices`.
|
|
1523
|
+
(form :name cube
|
|
1524
|
+
:description "Procedural cube: 36 deindexed vertices (12 triangles)."
|
|
1525
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1526
|
+
(form :name plane
|
|
1527
|
+
:description "Procedural plane: 6 deindexed vertices (2 triangles)."
|
|
1528
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1529
|
+
(form :name sphere
|
|
1530
|
+
:description "Procedural UV sphere (segments/rings configurable; 24x12 default)."
|
|
1531
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1532
|
+
(form :name torus
|
|
1533
|
+
:description "Procedural torus (radius/thickness/segments configurable)."
|
|
1534
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1535
|
+
(form :name truncated-cone
|
|
1536
|
+
:description "Procedural truncated cone (radii/height/segments configurable)."
|
|
1537
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1538
|
+
(form :name cylinder
|
|
1539
|
+
:description "Procedural cylinder (radius/height/segments configurable)."
|
|
1540
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1541
|
+
(form :name teapot
|
|
1542
|
+
:description "Utah teapot, indexed static mesh: 792 vertices, 992 triangles (~25KB). Pair with a buffer's :index-of."
|
|
1543
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1544
|
+
(form :name dragon
|
|
1545
|
+
:description "Stanford dragon, indexed static mesh: 6710 vertices, 11102 triangles (~222KB; exceeds the <50KB payload target)."
|
|
1546
|
+
:open true (key :name format :type shape-format-list :optional true))
|
|
1547
|
+
|
|
1548
|
+
; Verbatim bytes. The other eight positional sources COMPUTE their bytes and
|
|
1549
|
+
; `:file` on the parent WRAPS its bytes in `[mime_len][mime]` for an
|
|
1550
|
+
; image-bitmap; this one does neither, which is the whole of it. It is also
|
|
1551
|
+
; the only `(data …)` source a host can reach from a lowering hook: a hook
|
|
1552
|
+
; emits forms, so it emits a path (or the base64) and the compiler reads the
|
|
1553
|
+
; bytes — `Compiler.Options.resolver` supplies them with no filesystem at all.
|
|
1554
|
+
(form :name bytes
|
|
1555
|
+
:description "Verbatim bytes as a (data …) source: a sidecar file read at compile time, or inline base64. Stored with no MIME prefix and sized like an inline array, so a buffer's :data can size and fill from it — which (data … :file …) deliberately cannot."
|
|
1556
|
+
(key :name file :type file-path :optional true
|
|
1557
|
+
:description "Binary file path relative to the source document, embedded byte-for-byte. Exactly one of :file or :base64.")
|
|
1558
|
+
(key :name base64 :type base64-text :optional true
|
|
1559
|
+
:description "The bytes inline, base64-encoded, for a document that carries its own data. Exactly one of :file or :base64.")
|
|
1560
|
+
(exclusive-group :cardinality exactly-one
|
|
1561
|
+
(alt :keys [file])
|
|
1562
|
+
(alt :keys [base64])))
|
|
1563
|
+
|
|
1564
|
+
(form :name wasm-data
|
|
1565
|
+
:description "Static WASM data generator (positional child of (data …)): the module's :func is called once at buffer-create time and its returned bytes fill the buffer via mappedAtCreation."
|
|
1566
|
+
(key :name file :type file-path
|
|
1567
|
+
:description "WASM file path relative to the source file.")
|
|
1568
|
+
(key :name func :type symbol
|
|
1569
|
+
:description "Exported function called once to produce the bytes.")
|
|
1570
|
+
(key :name returns :type string
|
|
1571
|
+
:description "Return type → byte count (e.g. array<f32,360> → 1440)."))
|
|
1572
|
+
|
|
1573
|
+
(form :name texture
|
|
1574
|
+
:description "GPU texture. `:size` is an [w h d] extent, `canvas` to track the
|
|
1575
|
+
canvas size at runtime, or an (image-bitmap …) to take the decoded
|
|
1576
|
+
image's size. `pool` creates N sequential ping-pong ids."
|
|
1577
|
+
(key :name name :type symbol)
|
|
1578
|
+
(key :name size :type texture-size
|
|
1579
|
+
:description "Texel size: [w], [w h] or [w h d]; canvas to track the canvas; or an (image-bitmap …) to size from a decoded image.")
|
|
1580
|
+
(key :name format :type texture-format
|
|
1581
|
+
:description "Texel format of the texture.")
|
|
1582
|
+
(key :name usage :type texture-usage-list
|
|
1583
|
+
:description "Allowed texture usages (at least one).")
|
|
1584
|
+
(key :name sample-count :type u32 :optional true
|
|
1585
|
+
:description "Samples per texel: 1 (default) or 4 (MSAA). >1 requires render-attachment usage and a resolve-target on the pass.")
|
|
1586
|
+
(key :name dimension :type texture-dimension :optional true
|
|
1587
|
+
:description "Texture dimensionality: 1d, 2d (default), or 3d. A 3d texture needs a third :size element; sampling 1d/3d/array textures needs a matching texture view.")
|
|
1588
|
+
(key :name mip-level-count :type subresource-count :optional true
|
|
1589
|
+
:description "GPUTextureDescriptor.mipLevelCount — number of mip levels to allocate (default 1). Levels beyond what's written stay uninitialized until generated.")
|
|
1590
|
+
; Only meaningful beside `:size canvas`: an explicit extent is already the
|
|
1591
|
+
; size the author wants, and an (image-bitmap …) is the image's. Refused on
|
|
1592
|
+
; either, rather than silently ignored.
|
|
1593
|
+
(key :name scale :type canvas-scale :optional true
|
|
1594
|
+
:description "Fraction of the canvas this texture takes in each dimension (requires :size canvas). The runtime rounds and clamps to at least 1 texel, at create time and on every resize.")
|
|
1595
|
+
(key :name pool :type pool-size :optional true
|
|
1596
|
+
:description "Create N sequential texture ids for ping-pong (actual id = base + (frame + offset) % N)."))
|
|
1597
|
+
|
|
1598
|
+
; ---- explicit texture view (create_texture_view, opcode 0x0C) ----
|
|
1599
|
+
; A (texture …) bound directly gets a default 2d view; sampling a 1d/3d/array/
|
|
1600
|
+
; cube texture needs an explicit view whose dimension matches the WGSL binding.
|
|
1601
|
+
; Emitted after textures, before bind groups; `(entry :texture-view v)` binds it.
|
|
1602
|
+
(form :name texture-view
|
|
1603
|
+
:description "Explicit GPUTextureView over a (texture …). Required to SAMPLE a 1d/3d/array/cube
|
|
1604
|
+
texture — a texture bound directly (`(entry :texture …)`) gets a default 2d view.
|
|
1605
|
+
Bound via `(entry :texture-view …)`."
|
|
1606
|
+
(key :name name :type symbol)
|
|
1607
|
+
(key :name texture :type texture-ref
|
|
1608
|
+
:description "Source texture this view aliases.")
|
|
1609
|
+
(key :name dimension :type view-dimension :optional true
|
|
1610
|
+
:description "How the view is addressed (GPUTextureViewDescriptor.dimension): 1d, 2d, 2d-array, cube, cube-array or 3d. Must match the WGSL binding (texture_2d_array, texture_3d, …). Default: inferred from the texture.")
|
|
1611
|
+
(key :name aspect :type texture-aspect :optional true
|
|
1612
|
+
:description "Which aspect(s) of a depth/stencil texture the view exposes (default all).")
|
|
1613
|
+
(key :name base-mip-level :type subresource-index :optional true
|
|
1614
|
+
:description "First mip level the view exposes (default 0).")
|
|
1615
|
+
(key :name mip-level-count :type subresource-count :optional true
|
|
1616
|
+
:description "Number of mip levels the view exposes (default: all levels from base-mip-level).")
|
|
1617
|
+
(key :name base-array-layer :type subresource-index :optional true
|
|
1618
|
+
:description "First array layer the view exposes (default 0).")
|
|
1619
|
+
(key :name array-layer-count :type subresource-count :optional true
|
|
1620
|
+
:description "Number of array layers the view exposes (default: all layers from base-array-layer).")
|
|
1621
|
+
(key :name format :type texture-format :optional true
|
|
1622
|
+
:description "Reinterpret the texel format (e.g. an -srgb view of a linear texture); default is the texture's own format."))
|
|
1623
|
+
|
|
1624
|
+
(form :name buffer
|
|
1625
|
+
:description "GPU buffer. `pool` creates N sequential ping-pong ids.
|
|
1626
|
+
`index-of` sources size + initial bytes + index-format from an
|
|
1627
|
+
indexed shape's (teapot/dragon) index data — avoids a synthetic
|
|
1628
|
+
`_indices` data symbol the SJON cross-ref validator can't resolve."
|
|
1629
|
+
(key :name name :type symbol)
|
|
1630
|
+
(key :name size :type byte-count :optional true
|
|
1631
|
+
:description "Size in bytes: an integer, a bounded expression like (* NUM 4 4), or a bare (define …) name. Optional only when :data, :index-of or :file supplies the size instead.")
|
|
1632
|
+
(key :name usage :type usage-list
|
|
1633
|
+
:description "Allowed buffer usages (at least one). A mappable buffer is host memory the GPU may only copy in or out of: map-read pairs with copy-dst, map-write with copy-src, and neither combines with anything else.")
|
|
1634
|
+
(key :name pool :type pool-size :optional true
|
|
1635
|
+
:description "Create N sequential buffer ids for ping-pong (actual id = base + (frame + offset) % N).")
|
|
1636
|
+
(key :name data :type data-ref :optional true
|
|
1637
|
+
:description "(data …) whose bytes fill the buffer at creation via mappedAtCreation, and size it when :size is absent.")
|
|
1638
|
+
(key :name index-of :type data-ref :optional true
|
|
1639
|
+
:description "Source size, initial bytes, and index-format (uint16/uint32) from an indexed shape's (teapot/dragon) index companion. Beside :data it wins: the index data sizes and fills the buffer, and :data is only length-checked, never written.")
|
|
1640
|
+
(key :name index-format :type index-format :optional true
|
|
1641
|
+
:description "Index format (uint16/uint32) when the buffer is bound as a pass's :index-buffer without an :index-of source (e.g. GPU-generated indices).")
|
|
1642
|
+
(key :name file :type file-path :optional true
|
|
1643
|
+
:description "WASM file path (relative to the source file); its l/s/gen exports supply size + initial bytes — size comes from the WASM, not :size. Synthesized by pngine/pass-v1 for `(pass … :file …)` buffers."))
|
|
1644
|
+
|
|
1645
|
+
; Emitter packs a [type:u8][count:u16-LE] descriptor blob → create_query_set.
|
|
1646
|
+
(form :name query-set
|
|
1647
|
+
:description "GPU query set: a pool of :count queries of :type. A render-pass writes it via (timestamp-writes …) or :occlusion-query-set; a (resolve-query-set …) queue op copies results to a buffer."
|
|
1648
|
+
(key :name name :type symbol)
|
|
1649
|
+
(key :name type :type query-type
|
|
1650
|
+
:description "What each query measures: occlusion or timestamp.")
|
|
1651
|
+
(key :name count :type query-count
|
|
1652
|
+
:description "Number of queries in the set, 1 to 4096 (the createQuerySet bound)."))
|
|
1653
|
+
|
|
1654
|
+
(form :name queue
|
|
1655
|
+
:description "Queue actions (write-buffer, copy-buffer-to-buffer, copy-texture-to-texture,
|
|
1656
|
+
copy-external-image-to-texture, resolve-query-set) run in order by the
|
|
1657
|
+
frames that reference it."
|
|
1658
|
+
:positional queue-action
|
|
1659
|
+
(key :name name :type symbol))
|
|
1660
|
+
|
|
1661
|
+
(form :name write-buffer
|
|
1662
|
+
:description "Queue op: write bytes into a buffer before/within a frame (GPUQueue.writeBuffer)."
|
|
1663
|
+
(key :name buffer :type buffer-ref
|
|
1664
|
+
:description "Destination buffer (needs copy-dst usage).")
|
|
1665
|
+
(key :name offset :type byte-count-4-aligned :default 0
|
|
1666
|
+
:description "Byte offset into the destination (WebGPU requires a multiple of 4).")
|
|
1667
|
+
; One key for one member. `:data-from-wasm` was a second spelling of
|
|
1668
|
+
; the same slot, distinguished only by which kind of name it took — so the
|
|
1669
|
+
; document said twice what the widened union now says once, and the
|
|
1670
|
+
; exclusive-group existed to stop an author saying both.
|
|
1671
|
+
(key :name data :type write-buffer-source
|
|
1672
|
+
:description "Source: a (data …) ref, a (wasm-call …) whose result is written each frame, or a runtime builtin — pngine-inputs (16B time/width/height/aspect), scene-time-inputs (12B), pngine-frame-inputs (20B, + frameIndex), pointer-inputs (48B)."))
|
|
1673
|
+
|
|
1674
|
+
; Both ends of a copy are dictionaries in the IDL
|
|
1675
|
+
; (GPUTexelCopyTextureInfo / GPUCopyExternalImageSourceInfo), so they are
|
|
1676
|
+
; child forms, and their members are that form's keys: `:mip-level` and
|
|
1677
|
+
; `:origin` describe the DESTINATION subresource, not the copy. The flat
|
|
1678
|
+
; `:source X :texture Y` spelling is retired rather than kept as a second one.
|
|
1679
|
+
; Their heads are SLOT-LOCAL: `source` carries a texture under one copy
|
|
1680
|
+
; and an image under the other, and neither is a global form.
|
|
1681
|
+
;
|
|
1682
|
+
; There is no `:size`: pngine copies the whole source, which is what both
|
|
1683
|
+
; runtimes do today. A key the bytecode cannot carry would validate and be
|
|
1684
|
+
; dropped in silence — the texture→texture opcode encodes the two texture
|
|
1685
|
+
; ids and nothing else (`wire_schema` L_2V); the external-image opcode encodes
|
|
1686
|
+
; the bitmap id, the texture id and the destination mip level + origin
|
|
1687
|
+
; (L_COPY_EXT_IMG). Neither carries a size. It arrives when the opcode does.
|
|
1688
|
+
(form :name copy-texture-to-texture
|
|
1689
|
+
:description "Queue op: GPU texture→texture copy. context-current-texture names the canvas; otherwise a (texture …) name."
|
|
1690
|
+
:positional copy-endpoints-section
|
|
1691
|
+
(form :name source
|
|
1692
|
+
:description "Copy source (GPUTexelCopyTextureInfo)."
|
|
1693
|
+
(key :name texture :type attachment-view
|
|
1694
|
+
:description "Source texture: context-current-texture or a (texture …) name."))
|
|
1695
|
+
(form :name destination
|
|
1696
|
+
:description "Copy destination (GPUTexelCopyTextureInfo)."
|
|
1697
|
+
(key :name texture :type attachment-view
|
|
1698
|
+
:description "Destination texture: context-current-texture or a (texture …) name.")))
|
|
1699
|
+
|
|
1700
|
+
(form :name copy-external-image-to-texture
|
|
1701
|
+
:description "Queue op: upload a decoded image (image-bitmap) into a texture. mip-level / origin default to 0 per the WebGPU spec."
|
|
1702
|
+
:positional copy-endpoints-section
|
|
1703
|
+
(form :name source
|
|
1704
|
+
:description "Copy source (GPUCopyExternalImageSourceInfo)."
|
|
1705
|
+
(key :name image :type image-bitmap-ref
|
|
1706
|
+
:description "The decoded (image-bitmap …) to upload."))
|
|
1707
|
+
(form :name destination
|
|
1708
|
+
:description "Copy destination (GPUCopyExternalImageDestInfo)."
|
|
1709
|
+
(key :name texture :type texture-ref
|
|
1710
|
+
:description "Destination texture (needs copy-dst usage).")
|
|
1711
|
+
(key :name mip-level :type subresource-index :optional true
|
|
1712
|
+
:description "Destination mip level (default 0).")
|
|
1713
|
+
(key :name origin :type origin3 :optional true
|
|
1714
|
+
:description "Destination origin [x y z] in texels (default [0 0 0]; z selects the array layer / depth slice).")))
|
|
1715
|
+
|
|
1716
|
+
(form :name resolve-query-set
|
|
1717
|
+
:description "Queue op: copy resolved query results from a query set into a buffer (GPUCommandEncoder.resolveQuerySet)."
|
|
1718
|
+
(key :name query-set :type query-set-ref
|
|
1719
|
+
:description "The query set to resolve.")
|
|
1720
|
+
(key :name first-query :type u32 :default 0
|
|
1721
|
+
:description "Index of the first query to resolve.")
|
|
1722
|
+
(key :name query-count :type u32
|
|
1723
|
+
:description "Number of queries to resolve; each resolves to 8 bytes.")
|
|
1724
|
+
(key :name destination :type buffer-ref
|
|
1725
|
+
:description "Destination buffer; must have query-resolve usage.")
|
|
1726
|
+
(key :name destination-offset :type byte-count-256-aligned :default 0
|
|
1727
|
+
:description "Byte offset into the destination (WebGPU requires a multiple of 256)."))
|
|
1728
|
+
|
|
1729
|
+
(form :name copy-buffer-to-buffer
|
|
1730
|
+
:description "Queue op: GPU buffer→buffer copy (e.g. resolved queries → a map-read readback buffer)."
|
|
1731
|
+
(key :name source :type buffer-ref
|
|
1732
|
+
:description "Source buffer (needs copy-src usage).")
|
|
1733
|
+
(key :name source-offset :type byte-count-4-aligned :default 0
|
|
1734
|
+
:description "Byte offset into the source (multiple of 4).")
|
|
1735
|
+
(key :name destination :type buffer-ref
|
|
1736
|
+
:description "Destination buffer (needs copy-dst usage).")
|
|
1737
|
+
(key :name destination-offset :type byte-count-4-aligned :default 0
|
|
1738
|
+
:description "Byte offset into the destination (multiple of 4).")
|
|
1739
|
+
(key :name size :type byte-count-4-aligned
|
|
1740
|
+
:description "Bytes to copy (multiple of 4)."))
|
|
1741
|
+
|
|
1742
|
+
; The legacy nests `module={ url=… }`; SJON flattens to `:file` — `url`
|
|
1743
|
+
; promised fetching the descriptor never did, and the kind is `file-path`,
|
|
1744
|
+
; "relative to the document".
|
|
1745
|
+
(form :name wasm-call
|
|
1746
|
+
:description "A runtime WASM call: load the module at :file, call :func with :args each frame; a (write-buffer :data <name>) writes the result into a buffer."
|
|
1747
|
+
(key :name name :type symbol)
|
|
1748
|
+
(key :name file :type file-path
|
|
1749
|
+
:description "WASM file path relative to the source file (modules deduped by path).")
|
|
1750
|
+
(key :name func :type symbol
|
|
1751
|
+
:description "Exported function to call at frame time.")
|
|
1752
|
+
(key :name returns :type string
|
|
1753
|
+
:description "Result type → byte count (mat4x4→64, vec4→16, f32→4, …).")
|
|
1754
|
+
(key :name args :type wasm-arg-list :optional true
|
|
1755
|
+
:description "Per-frame arguments: numeric literals or runtime builtins."))
|
|
1756
|
+
|
|
1757
|
+
(form :name bind-group
|
|
1758
|
+
:description "Bind group. `pool` + per-entry `ping-pong` drive ping-pong. The
|
|
1759
|
+
layout is a pipeline's auto-layout or an explicit
|
|
1760
|
+
(bind-group-layout …), named by :layout — or left open: with
|
|
1761
|
+
no :layout the emitter derives one GPU bind group per pipeline
|
|
1762
|
+
that binds the group, pruned to what that pipeline reaches."
|
|
1763
|
+
:positional bind-entry-item
|
|
1764
|
+
(key :name name :type symbol)
|
|
1765
|
+
; Optional since the polymorphism queue's item 2 (§416). Absent, the group is
|
|
1766
|
+
; the effect annotation with the pipeline left open: one wire instance per
|
|
1767
|
+
; pipeline a pass or bundle binds it under, each pruned to the entries that
|
|
1768
|
+
; pipeline's entry points reach — the same inference `:layout auto` runs,
|
|
1769
|
+
; from the same reflection. The key itself is the authored escape hatch.
|
|
1770
|
+
(key :name layout :type bind-group-layout-spec :optional true
|
|
1771
|
+
:description "The layout this group is built against: a pipeline (its auto-derived layout) or an explicit (bind-group-layout …). Omit it to derive one bind group per pipeline that binds the group (through a render-pass, compute-pass or render-bundle), each pruned to what that pipeline's entry points reach; a pipeline with an explicit (pipeline-layout …) cannot bind such a group.")
|
|
1772
|
+
; `:group` is `@group(N)` in the WGSL — the word WebGPU and WGSL both use,
|
|
1773
|
+
; and it pairs with the entries' `:binding` the way the shader spells them.
|
|
1774
|
+
; It was `:layout-index`, which named the mechanism rather than the
|
|
1775
|
+
; thing. Meaningful for the PIPELINE arm only: that arm resolves the layout
|
|
1776
|
+
; as `pipeline.getBindGroupLayout(:group)`, while an explicit
|
|
1777
|
+
; (bind-group-layout …) IS the layout and the index selects nothing. The
|
|
1778
|
+
; emitter warns rather than rejects — the value is still encoded, so a
|
|
1779
|
+
; document that states it keeps compiling byte-identically.
|
|
1780
|
+
(key :name group :type binding-index :default 0
|
|
1781
|
+
:description "Which @group index of the pipeline's layout this group binds (spec baseline < 4). Ignored when :layout names an explicit (bind-group-layout …).")
|
|
1782
|
+
(key :name pool :type pool-size :optional true
|
|
1783
|
+
:description "Create N sequential bind-group ids for ping-pong selection.")
|
|
1784
|
+
; CONTRIBUTING pitfall 37, retired for anyone who opts in. `:layout auto`
|
|
1785
|
+
; keeps only the bindings the pipeline's entry points statically reach, so a
|
|
1786
|
+
; group that also binds an unreached resource desyncs from the layout and
|
|
1787
|
+
; ABORTS at the first set_bind_group — a runtime failure with no compile-time
|
|
1788
|
+
; symptom. With this true the emitter drops those entries instead, which is
|
|
1789
|
+
; what lets one bind-group description serve several variants of a material.
|
|
1790
|
+
; Only meaningful on the PIPELINE arm: an explicit (bind-group-layout …) is
|
|
1791
|
+
; the layout, so there is nothing to derive a reachable set from.
|
|
1792
|
+
(key :name prune-unused :type boolean :default false
|
|
1793
|
+
:description "Drop each (entry …) whose (group, binding) no entry point of the :layout pipeline reaches. Prevents the bind-group/auto-layout desync that aborts at set_bind_group. Ignored when :layout names an explicit (bind-group-layout …); refused as redundant on a group with no :layout, which is pruned per pipeline already.")
|
|
1794
|
+
; Slot-local entry form: `(entry :binding N :buffer|:sampler|:texture|:texture-view R)`.
|
|
1795
|
+
; Resolved LOCAL-FIRST under bind-group, so this `entry` is distinct from the
|
|
1796
|
+
; bind-group-layout's entry. (A global `entry` stand-in used to sit above
|
|
1797
|
+
; this form so `:lowering :produces` could name the head; SJON since 1.5 makes
|
|
1798
|
+
; `:produces` resolve slot-local heads and the stand-in is gone.)
|
|
1799
|
+
(form :name entry
|
|
1800
|
+
:description "One bind-group entry: binding → buffer | sampler | texture | texture-view resource
|
|
1801
|
+
(exactly one of :buffer/:sampler/:texture/:texture-view, schema-enforced)."
|
|
1802
|
+
(key :name binding :type binding-index
|
|
1803
|
+
:description "Binding slot matching @binding(N) in the WGSL.")
|
|
1804
|
+
(key :name buffer :type buffer-ref :optional true
|
|
1805
|
+
:description "Bind a (buffer …) at this slot.")
|
|
1806
|
+
(key :name sampler :type sampler-ref :optional true
|
|
1807
|
+
:description "Bind a (sampler …) at this slot.")
|
|
1808
|
+
(key :name texture :type texture-ref :optional true
|
|
1809
|
+
:description "Bind a (texture …) at this slot via its default 2d view.")
|
|
1810
|
+
(key :name texture-view :type texture-view-ref :optional true
|
|
1811
|
+
:description "Bind an explicit (texture-view …) at this slot — for 1d/3d/array/cube sampling.")
|
|
1812
|
+
; `:requires [buffer]` (SJON 1.2.0): a slice on a sampler/texture entry is a
|
|
1813
|
+
; located `dependent_key_missing` at validation, not an emitter reject.
|
|
1814
|
+
(key :name offset :type byte-count :optional true :requires [buffer]
|
|
1815
|
+
:description "GPUBufferBinding.offset — byte offset of the bound slice into :buffer (default 0; requires :buffer; must lie inside the declared buffer size — checked at compile time). Dynamic-offset alignment rules apply (uniform 256, storage 256 by default).")
|
|
1816
|
+
(key :name size :type byte-count :optional true :requires [buffer]
|
|
1817
|
+
:description "GPUBufferBinding.size — byte size of the bound slice (default: the rest of :buffer from :offset; requires :buffer; :offset + :size must fit the declared buffer size — checked at compile time).")
|
|
1818
|
+
(key :name ping-pong :type binding-index :optional true
|
|
1819
|
+
:description "Pool offset for this entry: actual id = base + (frame + offset) % pool.")
|
|
1820
|
+
; Exactly one resource per entry. Declarative replacement for the emit-time check.
|
|
1821
|
+
(exclusive-group :cardinality exactly-one
|
|
1822
|
+
(alt :keys [buffer])
|
|
1823
|
+
(alt :keys [sampler])
|
|
1824
|
+
(alt :keys [texture])
|
|
1825
|
+
(alt :keys [texture-view]))))
|
|
1826
|
+
|
|
1827
|
+
; ---- explicit bind-group-layout (uniform_access) ----
|
|
1828
|
+
; → create_bind_group_layout (opcode 0x06), emitted between samplers and
|
|
1829
|
+
; pipelines (the legacy phase position). Buffer, sampler, texture, and storage-
|
|
1830
|
+
; texture bindings are modeled. Entries and their resource are SLOT-LOCAL
|
|
1831
|
+
; forms: `(entry …)` and its nested `(buffer|sampler|texture|storage-texture …)`,
|
|
1832
|
+
; resolved local-first so the natural names don't collide with the global forms.
|
|
1833
|
+
(form :name bind-group-layout
|
|
1834
|
+
:description "Explicit binding layout (per-entry visibility + resource type) named by a (bind-group … :layout …) instead of a pipeline's auto-layout."
|
|
1835
|
+
:positional bgl-entry-item
|
|
1836
|
+
(key :name name :type symbol)
|
|
1837
|
+
(form :name entry
|
|
1838
|
+
:description "One layout entry: binding index + shader-stage visibility + a resource sub-form."
|
|
1839
|
+
:positional bgl-resource
|
|
1840
|
+
(key :name binding :type binding-index
|
|
1841
|
+
:description "Binding slot matching @binding(N) in the WGSL.")
|
|
1842
|
+
(key :name visibility :type visibility-list
|
|
1843
|
+
:description "Shader stages that may access this binding (ORed into the WebGPU mask: vertex 0x1, fragment 0x2, compute 0x4).")
|
|
1844
|
+
; Nested slot-local resource form: `(buffer :type T)`. Resolved
|
|
1845
|
+
; local-first under the layout entry, distinct from the global `buffer`.
|
|
1846
|
+
(form :name buffer
|
|
1847
|
+
:description "Buffer resource of a layout entry."
|
|
1848
|
+
(key :name type :type buffer-binding-type :optional true
|
|
1849
|
+
:description "How the buffer is exposed to WGSL: uniform, storage, or read-only-storage (WebGPU default: uniform)."))
|
|
1850
|
+
; Non-buffer resources (slot-local, like buffer). Their WebGPU-shape sub-
|
|
1851
|
+
; objects flow verbatim through gpu.js/--html; native's create_bind_group_layout
|
|
1852
|
+
; parser reads each field string-for-string.
|
|
1853
|
+
(form :name sampler
|
|
1854
|
+
:description "Sampler resource of a layout entry."
|
|
1855
|
+
(key :name type :type sampler-binding-type :optional true
|
|
1856
|
+
:description "Sampler binding type (default filtering)."))
|
|
1857
|
+
(form :name texture
|
|
1858
|
+
:description "Sampled-texture resource of a layout entry."
|
|
1859
|
+
(key :name sample-type :type texture-sample-type :optional true
|
|
1860
|
+
:description "Sample type of the bound texture (default float).")
|
|
1861
|
+
(key :name view-dimension :type view-dimension :optional true
|
|
1862
|
+
:description "View dimension: 1d, 2d, 2d-array, cube, cube-array or 3d (default 2d).")
|
|
1863
|
+
(key :name multisampled :type boolean :optional true
|
|
1864
|
+
:description "Whether the binding is a multisampled texture (default false)."))
|
|
1865
|
+
(form :name storage-texture
|
|
1866
|
+
:description "Storage-texture resource of a layout entry."
|
|
1867
|
+
(key :name format :type texture-format
|
|
1868
|
+
:description "Texel format of the storage texture (required; must be storage-capable).")
|
|
1869
|
+
(key :name access :type storage-texture-access :optional true
|
|
1870
|
+
:description "Access mode: write-only (default), read-only, or read-write.")
|
|
1871
|
+
(key :name view-dimension :type view-dimension :optional true
|
|
1872
|
+
:description "View dimension (default 2d)."))))
|
|
1873
|
+
|
|
1874
|
+
; ---- explicit pipeline-layout ----
|
|
1875
|
+
; → create_pipeline_layout (opcode 0x07), emitted between bind-group-layouts and
|
|
1876
|
+
; pipelines. Composes N (bind-group-layout …) into a GPUPipelineLayout that a
|
|
1877
|
+
; (render-pipeline …)/(compute-pipeline …) names in `:layout` instead of
|
|
1878
|
+
; `auto` (deriving from the WGSL). This is the only way to bind @group 0..N to
|
|
1879
|
+
; DIFFERENT explicit layouts (auto derives a single implicit layout per pipeline).
|
|
1880
|
+
(form :name pipeline-layout
|
|
1881
|
+
:description "Explicit pipeline layout: an ordered list of (bind-group-layout …) at @group 0..N. Named by a pipeline's :layout key in place of auto."
|
|
1882
|
+
(key :name name :type symbol)
|
|
1883
|
+
(key :name bind-group-layouts :type bind-group-layout-ref-list
|
|
1884
|
+
:description "The (bind-group-layout …) forms at @group 0, 1, … in order."))
|
|
1885
|
+
|
|
1886
|
+
(form :name sampler
|
|
1887
|
+
:description "GPU sampler. Defaults match GPUSamplerDescriptor: filters nearest, address-mode clamp-to-edge."
|
|
1888
|
+
(key :name name :type symbol)
|
|
1889
|
+
(key :name mag-filter :type filter-mode :default nearest
|
|
1890
|
+
:description "Magnification filter — sampling when one texel covers many pixels. Default nearest, as GPUSamplerDescriptor.magFilter; write :mag-filter linear for smoothing.")
|
|
1891
|
+
(key :name min-filter :type filter-mode :default nearest
|
|
1892
|
+
:description "Minification filter — sampling when many texels cover one pixel. Default nearest, as GPUSamplerDescriptor.minFilter; write :min-filter linear for smoothing.")
|
|
1893
|
+
(key :name address-mode :type address-mode :optional true
|
|
1894
|
+
:description "Addressing for texture coordinates outside [0,1], applied to all three axes. A PNGine shorthand for the IDL's three separate keys, and like them it defaults to clamp-to-edge. Per-axis :address-mode-u/v/w override it.")
|
|
1895
|
+
(key :name address-mode-u :type address-mode :optional true
|
|
1896
|
+
:description "Addressing for the U (S) axis; overrides :address-mode for this axis.")
|
|
1897
|
+
(key :name address-mode-v :type address-mode :optional true
|
|
1898
|
+
:description "Addressing for the V (T) axis; overrides :address-mode for this axis.")
|
|
1899
|
+
(key :name address-mode-w :type address-mode :optional true
|
|
1900
|
+
:description "Addressing for the W (R) axis; overrides :address-mode for this axis (3D / cube sampling).")
|
|
1901
|
+
(key :name mipmap-filter :type filter-mode :optional true
|
|
1902
|
+
:description "Filter applied between mip levels (only visible with a mipmapped texture). Default nearest, as GPUSamplerDescriptor.mipmapFilter; :max-anisotropy above 1 requires linear here as well as on :mag-filter and :min-filter.")
|
|
1903
|
+
(key :name lod-min-clamp :type lod-clamp :optional true
|
|
1904
|
+
:description "Minimum mip level of detail the sampler will use (default 0).")
|
|
1905
|
+
(key :name lod-max-clamp :type lod-clamp :optional true
|
|
1906
|
+
:description "Maximum mip level of detail the sampler will use (default 32).")
|
|
1907
|
+
(key :name max-anisotropy :type anisotropy :optional true
|
|
1908
|
+
:description "Maximum anisotropy for filtering; values > 1 require linear mag/min/mipmap filters.")
|
|
1909
|
+
(key :name compare :type compare-function :optional true
|
|
1910
|
+
:description "Comparison function — makes this a comparison sampler (e.g. depth shadow sampling)."))
|
|
1911
|
+
|
|
1912
|
+
; pngine/pass-v1 authors the canonical positional (vertex …)(fragment …) shape
|
|
1913
|
+
; (via EmittedForm positional children), so the render-pipeline descriptor has
|
|
1914
|
+
; one path.
|
|
1915
|
+
(form :name render-pipeline
|
|
1916
|
+
:description "GPU render pipeline. Positional (vertex …)(fragment …)(primitive …)(depth-stencil …)(multisample …) sections mirror GPURenderPipelineDescriptor."
|
|
1917
|
+
:positional pipeline-section
|
|
1918
|
+
(key :name name :type symbol)
|
|
1919
|
+
; GPUPipelineDescriptorBase.layout: required, and ONE member — see
|
|
1920
|
+
; `pipeline-layout-spec`.
|
|
1921
|
+
(key :name layout :type pipeline-layout-spec
|
|
1922
|
+
:description "auto to derive the bind-group layouts from the WGSL, or a declared (pipeline-layout …)."))
|
|
1923
|
+
|
|
1924
|
+
(form :name compute-pipeline
|
|
1925
|
+
:description "GPU compute pipeline: one positional (compute …) stage naming the WGSL module and its @compute entry point."
|
|
1926
|
+
:positional compute-pipeline-section
|
|
1927
|
+
(key :name name :type symbol)
|
|
1928
|
+
(key :name layout :type pipeline-layout-spec
|
|
1929
|
+
:description "auto to derive the bind-group layouts from the WGSL, or a declared (pipeline-layout …)."))
|
|
1930
|
+
|
|
1931
|
+
; ---- pipeline stage sub-forms (source-authored + hook-emitted) ----
|
|
1932
|
+
; All three are GPUProgrammableStage: a required module, an optional entry
|
|
1933
|
+
; point, and per-stage `(constant …)` overrides. `(module …)`/`(entry …)` were
|
|
1934
|
+
; positional atom forms until this cut — a scalar member of a dictionary is a
|
|
1935
|
+
; key, and spelling it as a form meant two global heads existed for no
|
|
1936
|
+
; reason but the grammar.
|
|
1937
|
+
(form :name vertex
|
|
1938
|
+
:description "Vertex stage (GPUVertexState): the module + entry point, one (vertex-buffer …) per bound vertex slot, and (constant …) overrides."
|
|
1939
|
+
:positional vertex-section
|
|
1940
|
+
(key :name module :type module-ref
|
|
1941
|
+
:description "The (shader-module …) holding the @vertex entry.")
|
|
1942
|
+
(key :name entry :type entry-point :optional true
|
|
1943
|
+
:description "Entry-point function name (defaults to the module's sole @vertex fn)."))
|
|
1944
|
+
(form :name fragment
|
|
1945
|
+
:description "Fragment stage (GPUFragmentState): the module + entry point, one (color-target …) per color attachment, and (constant …) overrides."
|
|
1946
|
+
:positional fragment-section
|
|
1947
|
+
(key :name module :type module-ref
|
|
1948
|
+
:description "The (shader-module …) holding the @fragment entry.")
|
|
1949
|
+
(key :name entry :type entry-point :optional true
|
|
1950
|
+
:description "Entry-point function name (defaults to the module's sole @fragment fn)."))
|
|
1951
|
+
(form :name compute
|
|
1952
|
+
:description "Compute stage (GPUProgrammableStage): the module + @compute entry point of a (compute-pipeline …), and (constant …) overrides."
|
|
1953
|
+
:positional compute-section
|
|
1954
|
+
(key :name module :type module-ref
|
|
1955
|
+
:description "The (shader-module …) holding the @compute entry.")
|
|
1956
|
+
(key :name entry :type entry-point :optional true
|
|
1957
|
+
:description "Entry-point function name (defaults to the module's sole @compute fn)."))
|
|
1958
|
+
; Authored per STAGE, mirroring WebGPU's GPUProgrammableStage.constants and
|
|
1959
|
+
; the per-entry-point reflection — but RESOLVED per module, because pngine
|
|
1960
|
+
; specialises the shader text at compile time instead of passing a constants
|
|
1961
|
+
; dict to a runtime. Two stages that specialise one module differently are
|
|
1962
|
+
; refused rather than silently duplicating the module.
|
|
1963
|
+
(form :name constant
|
|
1964
|
+
:description "Specialise a WGSL `override` with a compile-time value. The declaration becomes a `const` in the shipped shader, so the value is fixed at build time and the name is free to be minified. It does NOT remove an untaken branch: wgslender's dead-code elimination works by reachability from entry points, not by folding conditions, so `if (QUALITY > 1u)` keeps both arms (measured, journal §343). Specialisation is per assembled MODULE, so two roots importing one fragment may fix its override at two different values."
|
|
1965
|
+
(key :name name :type override-name
|
|
1966
|
+
:description "The WGSL `override` identifier this value is for.")
|
|
1967
|
+
(key :name value :type override-number
|
|
1968
|
+
:description "The value. Must fit the override's declared WGSL type: a fractional value for a u32/i32 override, or anything but 0/1 for a bool, is rejected."))
|
|
1969
|
+
(form :name primitive
|
|
1970
|
+
:description "Primitive assembly state (GPUPrimitiveState). Mirror the source: omit the whole form when unauthored."
|
|
1971
|
+
; `:default triangle-list` is REQUIRED here, and it is the one default in
|
|
1972
|
+
; this file the emitter deliberately does not bake. A `(variant …)` needs a
|
|
1973
|
+
; discriminant it can resolve — SJON answers `missing_discriminant_key` when
|
|
1974
|
+
; the key is neither authored nor defaulted — while a default is MATERIALIZED
|
|
1975
|
+
; into the effective view, which the defaults policy at the top of this file
|
|
1976
|
+
; says the emitter bakes. Both hold: the schema defaults the key so the
|
|
1977
|
+
; variant below resolves, and `appendPrimitive` emits `topology` only when
|
|
1978
|
+
; `authorNode` says the author wrote it, so a document that omits it still
|
|
1979
|
+
; ships no topology (measured: +27 bytes on the one corpus document that
|
|
1980
|
+
; omits it). The value is WebGPU's own default, so the two readings agree —
|
|
1981
|
+
; a list topology, which reads no strip index format.
|
|
1982
|
+
;
|
|
1983
|
+
; `:strip-index-format` is the conditional key `(variant …)` exists for, and
|
|
1984
|
+
; SJON's manifest spec uses this exact rule as its worked example. It could
|
|
1985
|
+
; not be written until SJON 1.5: WebGPU reads stripIndexFormat for TWO
|
|
1986
|
+
; topologies (triangle-strip and line-strip) and a key belonged to one
|
|
1987
|
+
; variant (`variant_key_collision`). `(variant :when [a b])` is that fix,
|
|
1988
|
+
; so the rule is the schema's now and the emitter's
|
|
1989
|
+
; `checkStripIndexFormat` is gone. Under a list topology the key does not
|
|
1990
|
+
; exist: `unknown_key`, located, at validation.
|
|
1991
|
+
:discriminant topology
|
|
1992
|
+
(key :name topology :type primitive-topology :optional true :default triangle-list
|
|
1993
|
+
:description "How vertices assemble into primitives (WebGPU default: triangle-list). Selects whether :strip-index-format exists: WebGPU reads a strip index format only for triangle-strip and line-strip.")
|
|
1994
|
+
(key :name cull-mode :type cull-mode :optional true
|
|
1995
|
+
:description "Which faces are discarded (WebGPU default: none).")
|
|
1996
|
+
(key :name front-face :type front-face :optional true
|
|
1997
|
+
:description "Winding that counts as front-facing (WebGPU default: ccw).")
|
|
1998
|
+
(key :name unclipped-depth :type boolean :optional true
|
|
1999
|
+
:description "Disable depth clipping (clamp fragments to [0,1] instead of discarding them); needs the depth-clip-control device feature (WebGPU default: false).")
|
|
2000
|
+
(variant :when [triangle-strip line-strip]
|
|
2001
|
+
(key :name strip-index-format :type index-format :optional true
|
|
2002
|
+
:description "Index byte-width (uint16/uint32) for indexed strip draws. WebGPU reads it only under a strip topology, which is why it is declared here and is an unknown key anywhere else; it becomes REQUIRED once a (draw-indexed …) runs this pipeline (that half crosses pipeline and pass, so it stays the emitter's).")))
|
|
2003
|
+
; The emitter emits only authored keys (mirroring the legacy
|
|
2004
|
+
; property-by-property JSON build), but "optional + default-free" is NOT the
|
|
2005
|
+
; rule this form follows any more: `:format` is required, and
|
|
2006
|
+
; `:depth-write-enabled` / `:depth-compare` become required from the format's
|
|
2007
|
+
; aspects, which only the emitter can see.
|
|
2008
|
+
(form :name depth-stencil
|
|
2009
|
+
:description "Depth/stencil pipeline state. Positional (stencil-front …)/(stencil-back …) carry per-face stencil state."
|
|
2010
|
+
:positional depth-stencil-section
|
|
2011
|
+
; REQUIRED, matching GPUDepthStencilState.format. Every other key here is
|
|
2012
|
+
; genuinely optional; this one only looked optional because the form was
|
|
2013
|
+
; built "optional + default-free by construction" without checking the IDL.
|
|
2014
|
+
(key :name format :type texture-format
|
|
2015
|
+
:description "Format of the depth/stencil attachment this pipeline renders to; a depth or stencil format, never a colour one.")
|
|
2016
|
+
(key :name depth-write-enabled :type boolean :optional true
|
|
2017
|
+
:description "Whether fragments write their depth value. Required once :format has a depth aspect (the IDL gives it no default); optional only because a stencil-only pipeline omits it.")
|
|
2018
|
+
(key :name depth-compare :type compare-function :optional true
|
|
2019
|
+
:description "Comparison the depth test applies (fragment depth vs stored depth). Required once the pipeline writes depth, or a stencil face states a :depth-fail-op other than keep.")
|
|
2020
|
+
(key :name depth-bias :type depth-bias-int :optional true
|
|
2021
|
+
:description "Constant bias added to fragment depth — shadow maps / depth pre-pass (triangles only).")
|
|
2022
|
+
(key :name depth-bias-slope-scale :type depth-bias :optional true
|
|
2023
|
+
:description "Bias that scales with the triangle's depth slope (triangles only).")
|
|
2024
|
+
(key :name depth-bias-clamp :type depth-bias :optional true
|
|
2025
|
+
:description "Maximum magnitude of the total depth bias (0 = unclamped).")
|
|
2026
|
+
(key :name stencil-read-mask :type mask32 :optional true
|
|
2027
|
+
:description "Bitmask ANDed with stencil values for tests (spec default 0xFFFFFFFF).")
|
|
2028
|
+
(key :name stencil-write-mask :type mask32 :optional true
|
|
2029
|
+
:description "Bitmask ANDed with stencil writes (spec default 0xFFFFFFFF)."))
|
|
2030
|
+
; Same key set for front/back; the head selects which face the emitter writes.
|
|
2031
|
+
(form :name stencil-front
|
|
2032
|
+
:description "Stencil state for front-facing primitives (spec defaults: compare always, ops keep)."
|
|
2033
|
+
(key :name compare :type compare-function :optional true
|
|
2034
|
+
:description "Test: stencil reference (masked) vs stored stencil value.")
|
|
2035
|
+
(key :name fail-op :type stencil-operation :optional true
|
|
2036
|
+
:description "Applied when the stencil test fails.")
|
|
2037
|
+
(key :name depth-fail-op :type stencil-operation :optional true
|
|
2038
|
+
:description "Applied when the stencil test passes but the depth test fails.")
|
|
2039
|
+
(key :name pass-op :type stencil-operation :optional true
|
|
2040
|
+
:description "Applied when both stencil and depth tests pass."))
|
|
2041
|
+
(form :name stencil-back
|
|
2042
|
+
:description "Stencil state for back-facing primitives (spec defaults: compare always, ops keep)."
|
|
2043
|
+
(key :name compare :type compare-function :optional true
|
|
2044
|
+
:description "Test: stencil reference (masked) vs stored stencil value.")
|
|
2045
|
+
(key :name fail-op :type stencil-operation :optional true
|
|
2046
|
+
:description "Applied when the stencil test fails.")
|
|
2047
|
+
(key :name depth-fail-op :type stencil-operation :optional true
|
|
2048
|
+
:description "Applied when the stencil test passes but the depth test fails.")
|
|
2049
|
+
(key :name pass-op :type stencil-operation :optional true
|
|
2050
|
+
:description "Applied when both stencil and depth tests pass."))
|
|
2051
|
+
(form :name multisample
|
|
2052
|
+
:description "Multisample pipeline state (MSAA)."
|
|
2053
|
+
(key :name count :type u32 :optional true
|
|
2054
|
+
:description "Samples per pixel: 1 or 4; must match the attachment textures' sample-count. Absent defers to WebGPU's 1 — a (multisample …) carrying only :mask or :alpha-to-coverage-enabled is legal.")
|
|
2055
|
+
(key :name mask :type mask32 :optional true
|
|
2056
|
+
:description "Sample coverage bitmask (spec default 0xFFFFFFFF).")
|
|
2057
|
+
(key :name alpha-to-coverage-enabled :type boolean :optional true
|
|
2058
|
+
:description "Fragment alpha generates the coverage mask. Requires :count above 1, a (fragment …) stage, and a first (color-target …) whose format has an alpha channel to derive the mask from."))
|
|
2059
|
+
(form :name vertex-buffer
|
|
2060
|
+
:description "Layout of one vertex buffer slot: stride + step mode + (attribute …) children."
|
|
2061
|
+
:positional attribute-item
|
|
2062
|
+
(key :name array-stride :type byte-count-4-aligned
|
|
2063
|
+
:description "Bytes between consecutive elements; multiple of 4 (spec baseline limit 2048).")
|
|
2064
|
+
(key :name step-mode :type step-mode :optional true
|
|
2065
|
+
:description "Advance per vertex or per instance (WebGPU default: vertex)."))
|
|
2066
|
+
(form :name attribute
|
|
2067
|
+
:description "One vertex attribute within a vertex-buffer layout."
|
|
2068
|
+
(key :name shader-location :type binding-index
|
|
2069
|
+
:description "@location(N) in the vertex shader (spec baseline < 16).")
|
|
2070
|
+
(key :name offset :type byte-count
|
|
2071
|
+
:description "Byte offset of the attribute within one element.")
|
|
2072
|
+
(key :name format :type vertex-format
|
|
2073
|
+
:description "Wire format of the attribute data."))
|
|
2074
|
+
(form :name color-target
|
|
2075
|
+
:description "One color target: format plus optional (blend …) state and write mask."
|
|
2076
|
+
:positional color-target-section
|
|
2077
|
+
(key :name format :type color-target-format
|
|
2078
|
+
:description "Format of the attachment this color-target renders to.")
|
|
2079
|
+
(key :name write-mask :type write-mask :optional true
|
|
2080
|
+
:description "Channel write mask: bitmask R=1 G=2 B=4 A=8, or all (15; the WebGPU default)."))
|
|
2081
|
+
(form :name blend
|
|
2082
|
+
:description "Blend state of a color target: (color …) and (alpha …) components. Only on a blendable target format — never a uint or sint one."
|
|
2083
|
+
:positional blend-section)
|
|
2084
|
+
(form :name color
|
|
2085
|
+
:description "Blend component for RGB: out.rgb = operation(src.rgb * src-factor, dst.rgb * dst-factor)."
|
|
2086
|
+
(key :name src-factor :type blend-factor :optional true
|
|
2087
|
+
:description "Multiplier on the fragment's color (WebGPU default: one). Emitted only when authored.")
|
|
2088
|
+
(key :name dst-factor :type blend-factor :optional true
|
|
2089
|
+
:description "Multiplier on the attachment's color (WebGPU default: zero). Emitted only when authored.")
|
|
2090
|
+
(key :name operation :type blend-operation :optional true
|
|
2091
|
+
:description "How the factored terms combine (WebGPU default: add). Emitted only when authored."))
|
|
2092
|
+
(form :name alpha
|
|
2093
|
+
:description "Blend component for alpha: out.a = operation(src.a * src-factor, dst.a * dst-factor)."
|
|
2094
|
+
(key :name src-factor :type blend-factor :optional true
|
|
2095
|
+
:description "Multiplier on the fragment's alpha (WebGPU default: one). Emitted only when authored.")
|
|
2096
|
+
(key :name dst-factor :type blend-factor :optional true
|
|
2097
|
+
:description "Multiplier on the attachment's alpha (WebGPU default: zero). Emitted only when authored.")
|
|
2098
|
+
(key :name operation :type blend-operation :optional true
|
|
2099
|
+
:description "How the factored terms combine (WebGPU default: add). Emitted only when authored."))
|
|
2100
|
+
|
|
2101
|
+
; ---- render / compute pass ----
|
|
2102
|
+
(form :name render-pass
|
|
2103
|
+
:description "GPU render pass: (color-attachment …)/(depth-stencil-attachment …) targets, a pipeline, bound resources, and its commands — the four draws (draw / draw-indexed / draw-indirect / draw-indexed-indirect), (occlusion-query …) brackets and one (timestamp-writes …). At least one attachment, of either kind — a pass writes somewhere."
|
|
2104
|
+
:positional render-pass-section
|
|
2105
|
+
(key :name name :type symbol)
|
|
2106
|
+
(key :name occlusion-query-set :type query-set-ref :optional true
|
|
2107
|
+
:description "The (query-set :type occlusion) that (occlusion-query …) brackets in this pass write into. Required once the pass holds a bracket; optional only because a pass may hold none.")
|
|
2108
|
+
(key :name pipeline :type render-pipeline-ref :optional true
|
|
2109
|
+
:description "The render pipeline this pass draws with. Omit for a pass that only replays :execute-bundles (the bundle records it).")
|
|
2110
|
+
(key :name vertex-buffers :type buffer-ref-list :optional true
|
|
2111
|
+
:description "Buffers bound to vertex slots 0..N in order.")
|
|
2112
|
+
(key :name vertex-buffers-pool-offsets :type offset-list :optional true
|
|
2113
|
+
:description "Per-slot ping-pong offsets into each buffer's pool.")
|
|
2114
|
+
(key :name index-buffer :type buffer-ref :optional true
|
|
2115
|
+
:description "Index buffer for (draw-indexed …); index format propagates from the buffer's :index-of source.")
|
|
2116
|
+
(key :name bind-groups :type bind-group-ref-list :optional true
|
|
2117
|
+
:description "Bind groups set at @group 0..N in order.")
|
|
2118
|
+
(key :name bind-groups-pool-offsets :type offset-list :optional true
|
|
2119
|
+
:description "Per-group ping-pong offsets into each group's pool.")
|
|
2120
|
+
(key :name stencil-reference :type u32 :optional true
|
|
2121
|
+
:description "Reference value used by stencil compare and the replace operation.")
|
|
2122
|
+
(key :name blend-constant :type blend-constant-color :optional true
|
|
2123
|
+
:description "[r g b a] blend constant (setBlendConstant); the value the `constant`/`one-minus-constant` blend factors multiply by. Defaults to [0 0 0 0] when unset.")
|
|
2124
|
+
(key :name viewport :type viewport-rect :optional true
|
|
2125
|
+
:description "[x y w h] or [x y w h minDepth maxDepth]; depths default to 0 and 1.")
|
|
2126
|
+
(key :name scissor-rect :type pixel-rect :optional true
|
|
2127
|
+
:description "[x y w h] in integer pixels; fragments outside are discarded.")
|
|
2128
|
+
(key :name execute-bundles :type render-bundle-ref-list :optional true
|
|
2129
|
+
:description "Replay pre-recorded (render-bundle …) forms instead of an inline pipeline/draw. Each bundle's declared color formats, depth/stencil format and sample count must equal this pass's, which WebGPU derives from its attachments' textures."))
|
|
2130
|
+
|
|
2131
|
+
; NOT `:discriminant load-op`, though `:clear-value` is exactly the
|
|
2132
|
+
; conditional key `(variant …)` is for (WebGPU IGNORES a clearValue
|
|
2133
|
+
; beside `load`, so a document that states one is stating something inert).
|
|
2134
|
+
; SJON's variant rule is positional — the discriminant kvpair must be written
|
|
2135
|
+
; BEFORE any variant-only key, in both walkers — and the corpus spells
|
|
2136
|
+
; `:clear-value [0 0 0 1] :load-op clear` in all 234 of its colour
|
|
2137
|
+
; attachments. Adopting the variant means a key-ORDER rule inside a form,
|
|
2138
|
+
; which is not something WebGPU has and not something a 1:1 mapping should
|
|
2139
|
+
; invent; the check is the emitter's instead, with the same span.
|
|
2140
|
+
(form :name color-attachment
|
|
2141
|
+
:description "One color target of a render pass."
|
|
2142
|
+
(key :name view :type attachment-view
|
|
2143
|
+
:description "Texture written by this pass: the canvas (context-current-texture) or a (texture …).")
|
|
2144
|
+
(key :name resolve-target :type attachment-view :optional true
|
|
2145
|
+
:description "Receives the resolved single-sample output when :view is multisampled.")
|
|
2146
|
+
(key :name clear-value :type clear-color :optional true
|
|
2147
|
+
:description "RGBA the attachment is cleared to when load-op is clear (WebGPU default: transparent black). Stating one beside `:load-op load` is an error — WebGPU would ignore it.")
|
|
2148
|
+
; REQUIRED, matching GPURenderPassColorAttachment.loadOp/storeOp. WebGPU has
|
|
2149
|
+
; no default for either: a pass that does not say whether it clears or loads
|
|
2150
|
+
; is a pass whose contents depend on what happened to be in the texture, and
|
|
2151
|
+
; the spec makes the author decide. PNGine defaulted them to clear/store,
|
|
2152
|
+
; which is right often enough that the one time it is wrong reads as a
|
|
2153
|
+
; rendering bug.
|
|
2154
|
+
(key :name load-op :type load-op
|
|
2155
|
+
:description "clear to :clear-value, or load the existing contents.")
|
|
2156
|
+
(key :name store-op :type store-op
|
|
2157
|
+
:description "store the pass result, or discard it."))
|
|
2158
|
+
|
|
2159
|
+
; Non-default load/store ops emit a preceding set_pass_depth_stencil_ops
|
|
2160
|
+
; (matches the legacy path).
|
|
2161
|
+
; `depthStencilAttachment` is the IDL's word, and the form has carried
|
|
2162
|
+
; stencil keys since it was written — `depth-attachment` named half of it.
|
|
2163
|
+
; `:depth-load-op` / `:depth-store-op` no longer carry PNGine defaults
|
|
2164
|
+
; (clear/store) — that half stands. Making them
|
|
2165
|
+
; unconditionally REQUIRED, as the first cut did, was wrong in the other
|
|
2166
|
+
; direction: WebGPU requires the depth pair only when the VIEW's format has a
|
|
2167
|
+
; depth aspect, and FORBIDS it otherwise, so a `stencil8` attachment became
|
|
2168
|
+
; unwritable. The requirement is conditional on a format the schema cannot
|
|
2169
|
+
; reach, so it is the emitter's, in both directions and for both aspects.
|
|
2170
|
+
;
|
|
2171
|
+
; `:depth-clear-value` is the emitter's, for the same positional reason the colour
|
|
2172
|
+
; attachment records: GPURenderPassDepthStencilAttachment gives
|
|
2173
|
+
; depthClearValue no default at all, so a `clear` without one baked a PNGine
|
|
2174
|
+
; 1.0 — the single number in a depth pass that decides whether anything is
|
|
2175
|
+
; visible. Required-when-clearing needs a `(variant :when clear …)`, which
|
|
2176
|
+
; needs `:depth-load-op` written before `:depth-clear-value` in every
|
|
2177
|
+
; document. The emitter says it instead, with a span on the attachment.
|
|
2178
|
+
(form :name depth-stencil-attachment
|
|
2179
|
+
:description "Depth/stencil target of a render pass."
|
|
2180
|
+
(key :name view :type texture-ref
|
|
2181
|
+
:description "The depth/stencil (texture …) this pass tests/writes against.")
|
|
2182
|
+
(key :name depth-clear-value :type unorm :optional true
|
|
2183
|
+
:description "Depth cleared to when depth-load-op is clear, in [0,1]. Required when it clears — WebGPU has no default for it — and rejected beside `:depth-load-op load`.")
|
|
2184
|
+
(key :name depth-load-op :type load-op :optional true
|
|
2185
|
+
:description "clear depth to :depth-clear-value, or load the existing depth. Required when the view's format has a depth aspect, and rejected when it has none.")
|
|
2186
|
+
(key :name depth-store-op :type store-op :optional true
|
|
2187
|
+
:description "store the resulting depth, or discard it. Required when the view's format has a depth aspect, and rejected when it has none.")
|
|
2188
|
+
(key :name stencil-clear-value :type u32 :optional true
|
|
2189
|
+
:description "Stencil cleared to when stencil-load-op is clear.")
|
|
2190
|
+
(key :name stencil-load-op :type load-op :optional true
|
|
2191
|
+
:description "clear stencil to :stencil-clear-value, or load the existing stencil. Required when the view's format has a stencil aspect, and rejected when it has none.")
|
|
2192
|
+
(key :name stencil-store-op :type store-op :optional true
|
|
2193
|
+
:description "store the resulting stencil, or discard it. Required when the view's format has a stencil aspect, and rejected when it has none."))
|
|
2194
|
+
|
|
2195
|
+
(form :name draw
|
|
2196
|
+
:description "Non-indexed draw call."
|
|
2197
|
+
(key :name vertex-count :type count
|
|
2198
|
+
:description "Vertices to draw.")
|
|
2199
|
+
(key :name instance-count :type count :default 1
|
|
2200
|
+
:description "Instances to draw.")
|
|
2201
|
+
(key :name first-vertex :type count :default 0
|
|
2202
|
+
:description "Offset into the vertex buffers, in vertices.")
|
|
2203
|
+
(key :name first-instance :type count :default 0
|
|
2204
|
+
:description "First instance index."))
|
|
2205
|
+
|
|
2206
|
+
(form :name draw-indexed
|
|
2207
|
+
:description "Indexed draw call (requires the pass's :index-buffer)."
|
|
2208
|
+
(key :name index-count :type count
|
|
2209
|
+
:description "Indices to draw.")
|
|
2210
|
+
(key :name instance-count :type count :default 1
|
|
2211
|
+
:description "Instances to draw.")
|
|
2212
|
+
(key :name first-index :type count :default 0
|
|
2213
|
+
:description "Offset into the index buffer, in indices.")
|
|
2214
|
+
(key :name base-vertex :type count :default 0
|
|
2215
|
+
:description "Added to each index before vertex lookup. Signed in WebGPU; pngine carries a u32 and rejects a negative value.")
|
|
2216
|
+
(key :name first-instance :type count :default 0
|
|
2217
|
+
:description "First instance index."))
|
|
2218
|
+
|
|
2219
|
+
(form :name draw-indirect
|
|
2220
|
+
:description "Non-indexed indirect draw: the GPUDrawIndirectArgs (4×u32: vertex-count, instance-count, first-vertex, first-instance) are read from :buffer at :offset, typically written by a compute pass. No index buffer needed."
|
|
2221
|
+
(key :name buffer :type buffer-ref
|
|
2222
|
+
:description "Buffer holding the indirect args (needs indirect usage).")
|
|
2223
|
+
(key :name offset :type byte-count-4-aligned :default 0
|
|
2224
|
+
:description "Byte offset of the args within :buffer (a multiple of 4, as WebGPU requires of indirectOffset)."))
|
|
2225
|
+
|
|
2226
|
+
(form :name draw-indexed-indirect
|
|
2227
|
+
:description "Indexed indirect draw: the GPUDrawIndexedIndirectArgs (5×u32) are read from :buffer at :offset, typically written by a compute pass. Requires the pass's :index-buffer."
|
|
2228
|
+
(key :name buffer :type buffer-ref
|
|
2229
|
+
:description "Buffer holding the indirect args (needs indirect usage).")
|
|
2230
|
+
(key :name offset :type byte-count-4-aligned :default 0
|
|
2231
|
+
:description "Byte offset of the args within :buffer (a multiple of 4, as WebGPU requires of indirectOffset)."))
|
|
2232
|
+
|
|
2233
|
+
; Emitted as a pre-pass set_pass_timestamp_writes (before begin_render_pass).
|
|
2234
|
+
; GPURenderPassTimestampWrites, keys spelled as the IDL spells them. The
|
|
2235
|
+
; two indices are baked (`:default 0` / `:default 1`) where the IDL
|
|
2236
|
+
; leaves them optional with NO default — "write only the end" is not
|
|
2237
|
+
; expressible because the opcode carries two u32s and no absent marker. A
|
|
2238
|
+
; PNGine opinion, ledgered in the conformance harness; the absent-index
|
|
2239
|
+
; capability and the compute-pass timestamp-writes the IDL also has are not
|
|
2240
|
+
; expressible here yet.
|
|
2241
|
+
(form :name timestamp-writes
|
|
2242
|
+
:description "Record GPU timestamps at pass start/end into a (query-set :type timestamp)."
|
|
2243
|
+
(key :name query-set :type query-set-ref
|
|
2244
|
+
:description "The timestamp query set written into.")
|
|
2245
|
+
(key :name beginning-of-pass-write-index :type u32 :default 0
|
|
2246
|
+
:description "Query index written at pass start (PNGine bakes 0; the IDL leaves it absent = not written).")
|
|
2247
|
+
(key :name end-of-pass-write-index :type u32 :default 1
|
|
2248
|
+
:description "Query index written at pass end (PNGine bakes 1; the IDL leaves it absent = not written)."))
|
|
2249
|
+
|
|
2250
|
+
(form :name occlusion-query
|
|
2251
|
+
:description "Bracket one or more draws in an occlusion query: the GPU counts samples passing depth/stencil into the pass's :occlusion-query-set at :query-index."
|
|
2252
|
+
:positional occlusion-draw-item
|
|
2253
|
+
(key :name query-index :type u32 :default 0
|
|
2254
|
+
:description "Index within the pass's occlusion query set."))
|
|
2255
|
+
|
|
2256
|
+
; A dispatch is a COMMAND, and commands are forms — the same shape the
|
|
2257
|
+
; render pass has used for `(draw …)` all along. It was three keys with a
|
|
2258
|
+
; precedence rule between them (`:dispatch-indirect` beat `:dispatch` beat
|
|
2259
|
+
; `:dispatch-workgroups`), which is what a writer had to know to read a pass
|
|
2260
|
+
; that stated two. Several dispatches per pass are legal WebGPU and now
|
|
2261
|
+
; expressible; a pass with none is not a pass, which is the head-set's
|
|
2262
|
+
; `:min-children 1` — a pngine opinion, not an IDL rule.
|
|
2263
|
+
(form :name compute-pass
|
|
2264
|
+
:description "GPU compute pass: a compute pipeline + bind groups + one or more (dispatch …) commands."
|
|
2265
|
+
:positional compute-pass-command
|
|
2266
|
+
(key :name name :type symbol)
|
|
2267
|
+
(key :name pipeline :type compute-pipeline-ref
|
|
2268
|
+
:description "The compute pipeline this pass dispatches.")
|
|
2269
|
+
(key :name bind-groups :type bind-group-ref-list :optional true
|
|
2270
|
+
:description "Bind groups set at @group 0..N in order.")
|
|
2271
|
+
(key :name bind-groups-pool-offsets :type offset-list :optional true
|
|
2272
|
+
:description "Per-group ping-pong offsets into each group's pool."))
|
|
2273
|
+
|
|
2274
|
+
(form :name dispatch
|
|
2275
|
+
:description "Compute dispatch command (GPUComputePassEncoder.dispatchWorkgroups)."
|
|
2276
|
+
(key :name workgroups :type dispatch-size
|
|
2277
|
+
:description "Workgroup counts as [x], [x y] or [x y z]; the missing dimensions default to 1. Each element is a literal, an expression like (ceil (/ NUM 64)), or a bare (define …) name."))
|
|
2278
|
+
|
|
2279
|
+
(form :name dispatch-indirect
|
|
2280
|
+
:description "Indirect compute dispatch: the workgroup counts (3×u32) are read from :buffer at :offset, typically written by an earlier compute pass."
|
|
2281
|
+
(key :name buffer :type buffer-ref
|
|
2282
|
+
:description "Buffer holding the dispatch args (needs indirect usage).")
|
|
2283
|
+
(key :name offset :type byte-count-4-aligned :default 0
|
|
2284
|
+
:description "Byte offset of the args within :buffer (a multiple of 4, as WebGPU requires of indirectOffset)."))
|
|
2285
|
+
|
|
2286
|
+
; The recorded draw is a `(draw …)` / `(draw-indexed …)` CHILD — the same two
|
|
2287
|
+
; forms a render pass issues, with the same keys. It was `:draw N`
|
|
2288
|
+
; beside `:instance-count M`, a third spelling of a draw that could not say
|
|
2289
|
+
; `:first-vertex`, and `:draw-indexed N` which could say nothing else at all.
|
|
2290
|
+
(form :name render-bundle
|
|
2291
|
+
:description "Pre-recorded reusable draw sequence (pipeline + buffers + bind groups + one (draw …)), replayed via a render-pass's :execute-bundles."
|
|
2292
|
+
:positional render-bundle-command
|
|
2293
|
+
(key :name name :type symbol)
|
|
2294
|
+
(key :name pipeline :type render-pipeline-ref
|
|
2295
|
+
:description "Pipeline recorded into the bundle (the executing pass omits its own). Required: a bundle's descriptor is its own layout, and a draw with no pipeline is invalid WebGPU.")
|
|
2296
|
+
; REQUIRED, matching GPURenderPassLayout.colorFormats. A bundle is validated
|
|
2297
|
+
; against the layout it declares, so an unstated list is not a shorthand —
|
|
2298
|
+
; it is a claim the runtime has to invent, and every runtime invented the
|
|
2299
|
+
; canvas format.
|
|
2300
|
+
(key :name color-formats :type texture-format-list
|
|
2301
|
+
:description "Color attachment formats the bundle is recorded against. Each must be a color format, and the list must equal both the :pipeline's color targets and the replaying pass's color attachments.")
|
|
2302
|
+
(key :name depth-stencil-format :type texture-format :optional true
|
|
2303
|
+
:description "Depth/stencil format the bundle is recorded against. Must be a depth or stencil format, and must be present exactly when the :pipeline declares a (depth-stencil …) and the replaying pass has a (depth-stencil-attachment …).")
|
|
2304
|
+
(key :name sample-count :type u32 :optional true
|
|
2305
|
+
:description "Sample count the bundle is recorded against (default 1). Must equal the :pipeline's (multisample :count …) and the sample count of the replaying pass's attachment textures.")
|
|
2306
|
+
(key :name vertex-buffers :type buffer-ref-list :optional true
|
|
2307
|
+
:description "Buffers bound to vertex slots 0..N in order.")
|
|
2308
|
+
(key :name bind-groups :type bind-group-ref-list :optional true
|
|
2309
|
+
:description "Bind groups set at @group 0..N in order.")
|
|
2310
|
+
(key :name index-buffer :type buffer-ref :optional true
|
|
2311
|
+
:description "Index buffer when the bundle draws indexed."))
|
|
2312
|
+
|
|
2313
|
+
; A named sequence of frame steps, expanded WHERE IT IS NAMED. This is what a
|
|
2314
|
+
; `(draw-graph …)` or `(pass-graph …)` with a `:name` emits instead of a
|
|
2315
|
+
; frame: a graph is several passes, so without a name for the set there is no
|
|
2316
|
+
; way for one frame to run two graphs, and the containers each had to own the
|
|
2317
|
+
; document's only frame and refuse the other. Nothing reaches the wire — the
|
|
2318
|
+
; emitter inlines a group's steps into the frame that names it, so a frame
|
|
2319
|
+
; over groups emits exactly the ops the same frame written out by hand does.
|
|
2320
|
+
(form :name step-group
|
|
2321
|
+
:description "A named sequence of frame steps, inlined wherever a (frame …) or another group names it. Emitted by a named (draw-graph …) / (pass-graph …); writable by hand to name a sequence once and run it in several frames."
|
|
2322
|
+
(key :name name :type symbol)
|
|
2323
|
+
(key :name perform :type frame-step-list
|
|
2324
|
+
:description "The steps this group stands for, in order."))
|
|
2325
|
+
(form :name frame
|
|
2326
|
+
:description "Frame program: what runs each frame, in order."
|
|
2327
|
+
(key :name name :type symbol)
|
|
2328
|
+
(key :name init :type compute-pass-ref-list :optional true
|
|
2329
|
+
:description "One-shot (init …) steps run on the first frame only (each lowers to a compute-pass of the same name).")
|
|
2330
|
+
(key :name before :type queue-ref-list :optional true
|
|
2331
|
+
:description "(queue …) ops run before each frame's passes.")
|
|
2332
|
+
(key :name perform :type frame-step-list
|
|
2333
|
+
:description "Passes and queues run every frame, in order."))
|
|
2334
|
+
|
|
2335
|
+
; ---- init sugar: lowered to compute-pipeline + bind-group + compute-pass ----
|
|
2336
|
+
(form :name init
|
|
2337
|
+
:description "One-shot compute init of a storage buffer (first frame only)."
|
|
2338
|
+
; `entry` here is the bind-group's SLOT-LOCAL entry, and it resolves through
|
|
2339
|
+
; the dummy global `(entry …)` form declared beside bind-group — see the
|
|
2340
|
+
; comment there. It used to resolve through the render-pipeline stage's
|
|
2341
|
+
; `(entry …)`, by accident.
|
|
2342
|
+
:lowering (lowering :hook pngine/init-v1
|
|
2343
|
+
:produces [compute-pipeline compute bind-group entry compute-pass dispatch])
|
|
2344
|
+
(key :name name :type symbol)
|
|
2345
|
+
(key :name buffer :type buffer-ref
|
|
2346
|
+
:description "The storage buffer the init compute writes (bound at @binding 0).")
|
|
2347
|
+
(key :name module :type module-ref
|
|
2348
|
+
:description "The (shader-module …) holding the @compute init entry.")
|
|
2349
|
+
; Same shape as the `(dispatch :workgroups …)` this lowers to. Sugar is
|
|
2350
|
+
; spelled like what it expands into, so a change binds both or neither.
|
|
2351
|
+
(key :name workgroups :type dispatch-size
|
|
2352
|
+
:description "Workgroup counts as [x], [x y] or [x y z]. Read at lowering time through the lowering env: literals, bounded expressions over (define …) constants, e.g. [(ceil (/ NUM 64))], or a bare (define …) name."))
|
|
2353
|
+
|
|
2354
|
+
; =====================================================================
|
|
2355
|
+
; `(pass …)` sugar — container-lowered by pngine/pass-v1 (Phase 2f)
|
|
2356
|
+
; =====================================================================
|
|
2357
|
+
; The author writes (pass-graph (pass …) …). The hook sees every pass through
|
|
2358
|
+
; the whole-document view, sequences cross-pass texture ids, and emits canonical
|
|
2359
|
+
; PNGine forms: a (shader-module …) with the injected WGSL prelude, the uniform /
|
|
2360
|
+
; output resources, the (render-pipeline …) (canonical (vertex …)(fragment …)
|
|
2361
|
+
; stages), a (bind-group …), the (render-pass …) and an auto (frame …). The
|
|
2362
|
+
; (pass …) children are plain data —
|
|
2363
|
+
; NO :lowering — consumed by the container, so they never reach the emitter.
|
|
2364
|
+
(value-kind :name pass-item :underlying form :heads (head-set :names [pass]))
|
|
2365
|
+
|
|
2366
|
+
; A `(pass …)` carries `(constant …)` children exactly as a hand-authored
|
|
2367
|
+
; stage does. It needs its own section because a pass has no stage form to
|
|
2368
|
+
; hang them on — the hook builds the `(vertex …)`/`(fragment …)`/`(compute …)`
|
|
2369
|
+
; itself — so the author writes them on the pass and the hook decides which of
|
|
2370
|
+
; the modules it builds from their text each one reaches. That forwarding rule
|
|
2371
|
+
; is stated on the `(pass …)` form below; `constant` is in `:produces`
|
|
2372
|
+
; because of it.
|
|
2373
|
+
(value-kind :name pass-section :underlying form :heads (head-set :names [constant]))
|
|
2374
|
+
|
|
2375
|
+
; The names `(pass-graph … :expose […])` takes. NOT a cross-ref: the
|
|
2376
|
+
; `(pass …)` children are consumed by the hook, so their names never reach
|
|
2377
|
+
; the validator's index, and the hook checks each entry against the passes it
|
|
2378
|
+
; lowered (CONTRIBUTING pitfall 112). `pass-name` is therefore one of the
|
|
2379
|
+
; F8 loose-symbol exceptions (Compiler.zig), the same way `wgsl-name` is: it
|
|
2380
|
+
; names something the schema cannot resolve, and its consumer checks it.
|
|
2381
|
+
; `:max-len 32` is `bytecode.DEFAULT_MAX_PASSES`, the executor's pass table:
|
|
2382
|
+
; a graph cannot emit more passes than the runtime can hold, so the list
|
|
2383
|
+
; cannot honestly be longer either.
|
|
2384
|
+
(value-kind :name pass-name
|
|
2385
|
+
:description "The :name of one (pass …) child of the same (pass-graph …), checked by the hook against the passes it lowered."
|
|
2386
|
+
:underlying symbol)
|
|
2387
|
+
(value-kind :name pass-name-list
|
|
2388
|
+
:description "Names of (pass …) children of the same (pass-graph …), in any order."
|
|
2389
|
+
:underlying vector :vector (vector-shape :element pass-name :max-len 32))
|
|
2390
|
+
|
|
2391
|
+
(form :name pass
|
|
2392
|
+
:description "One `(pass …)`: a fullscreen fragment (or compute) shader-art stage.
|
|
2393
|
+
The hook detects features from the WGSL (pngine/pointer/feedback).
|
|
2394
|
+
Positional (constant …) children specialise the `override`s of
|
|
2395
|
+
the modules built from this pass's text."
|
|
2396
|
+
; The `(constant …)` children. A pass's modules are built BY the hook, so
|
|
2397
|
+
; the author has no stage form to write them on; they sit on the pass and
|
|
2398
|
+
; are forwarded onto every stage of every pipeline built from the author's
|
|
2399
|
+
; text — never onto pngine's own blit shader, exactly like `:imports`.
|
|
2400
|
+
;
|
|
2401
|
+
; A pass builds at most two such modules: the main one (the whole `:code`,
|
|
2402
|
+
; prelude and all) and, when the code declares `@fragment fn post(…)`, the
|
|
2403
|
+
; post one — which is a prelude, the fullscreen vertex shader and the post
|
|
2404
|
+
; function, nothing else. A function body cannot hold a module-scope
|
|
2405
|
+
; `override`, so an override the POST module declares can only have come
|
|
2406
|
+
; from `:imports`, and both modules import the same list. That is the whole
|
|
2407
|
+
; forwarding rule: a constant naming an override the `:code` itself declares
|
|
2408
|
+
; reaches the main module only — the post module has no such declaration and
|
|
2409
|
+
; specialising it there would refuse — and every other constant reaches
|
|
2410
|
+
; both. A pass with no `:imports` at all naming an override its own code
|
|
2411
|
+
; does not declare is refused by the hook, which can still name the pass;
|
|
2412
|
+
; once fragments are in play only the emitter knows, and it names the module.
|
|
2413
|
+
:positional pass-section
|
|
2414
|
+
(key :name name :type symbol)
|
|
2415
|
+
(key :name code :type string
|
|
2416
|
+
:description "WGSL fragment (or compute) source; the hook injects the binding prelude (pngine uniforms, pointer, sampler, dep/feedback textures, D0… data buffers). Required — the hook always refused its absence.")
|
|
2417
|
+
(key :name feedback :type boolean :optional true
|
|
2418
|
+
:description "Ping-pong texture pair for feedback; the previous frame is readable as prev_<name>.")
|
|
2419
|
+
; The intermediate's texel format, which is ONE value in WebGPU terms: the
|
|
2420
|
+
; texture this pass renders into and the (color-target :format …) of the pipeline
|
|
2421
|
+
; that renders it. Refused on a pass that draws straight to the canvas
|
|
2422
|
+
; (there is no intermediate, and the canvas format is the context's), on a
|
|
2423
|
+
; depth/stencil format (a pass writes a COLOR attachment), and on a compute
|
|
2424
|
+
; pass (its `screen` is a storage texture whose WGSL format is a narrower
|
|
2425
|
+
; set, and pngine's blit samples it as texture_2d<f32>).
|
|
2426
|
+
(key :name format :type texture-format :optional true
|
|
2427
|
+
:description "Texel format of the texture this pass renders into, and of its pipeline's color target (default rgba8unorm). A later pass reading it gets a texture_2d<T> whose T follows this format's sample class.")
|
|
2428
|
+
; The one-shot seed: compute WGSL that writes the texture this pass renders
|
|
2429
|
+
; into, ONCE per loaded payload, before the first frame's steps. It is what
|
|
2430
|
+
; gives a `:feedback true` chain a starting state — an unseeded pool is
|
|
2431
|
+
; zeroes, and a pass that reads what it wrote last frame reads nothing
|
|
2432
|
+
; forever. It lowers to what `(init …)` lowers to: a module whose prelude
|
|
2433
|
+
; binds that texture as `screen`, a compute pipeline and bind group, and a
|
|
2434
|
+
; compute pass named into the emitted frame's `:init` list.
|
|
2435
|
+
;
|
|
2436
|
+
; Four refusals, each naming what it could not do. The seed may not name
|
|
2437
|
+
; `pngine` (`:init` steps run ahead of the `(queue …)` step that fills the
|
|
2438
|
+
; uniform buffer, so every field would read 0 — `textureDimensions(screen)`
|
|
2439
|
+
; is the extent a seed wants). It may not sit on a pass that draws straight
|
|
2440
|
+
; to the canvas (there is no intermediate to seed). It may not sit in a
|
|
2441
|
+
; NAMED `(pass-graph …)`, which emits a `(step-group …)`, and only a
|
|
2442
|
+
; `(frame …)` has an `:init` list. And the pass's `:format` must be one of
|
|
2443
|
+
; WebGPU's core storage formats, because seeding adds `storage-binding` to
|
|
2444
|
+
; that texture's usage — the one place this key reaches a GPU descriptor.
|
|
2445
|
+
(key :name init :type string :optional true
|
|
2446
|
+
:description "One-shot WGSL compute source, run once per loaded payload before the first frame, writing this pass's own target as `screen`.")
|
|
2447
|
+
(key :name file :type data-file-list :optional true
|
|
2448
|
+
:description "WASM file paths (relative to the document) → D0, D1, … storage buffers; the hook injects var<storage, read> D{i}: array<f32>. The same :file every other file-on-disk key spells.")
|
|
2449
|
+
; Textures this pass samples that no pass in the graph produced — a depth
|
|
2450
|
+
; buffer or G-buffer a hand-authored (render-pass …) wrote, which is what
|
|
2451
|
+
; makes a fullscreen post-processing stage expressible as sugar at all. The
|
|
2452
|
+
; prelude declares one binding per entry, by the TEXTURE's name, typed from
|
|
2453
|
+
; its :format (texture_depth_2d for a depth format), after the prior-pass
|
|
2454
|
+
; dependency bindings; the bind group binds the same set. An entry the pass's
|
|
2455
|
+
; WGSL never names is refused, not dropped: the pipeline's :layout auto holds
|
|
2456
|
+
; only what its entry points reach, so a dropped-but-bound entry is the bind
|
|
2457
|
+
; group WebGPU refuses (CONTRIBUTING pitfall 37).
|
|
2458
|
+
; The pass's intermediate at a fraction of the canvas, which is what a
|
|
2459
|
+
; half-resolution ambient-occlusion or a quarter-resolution bloom stage is.
|
|
2460
|
+
; It lowers to `:scale` on the `(texture …)` the pass renders into, spelled
|
|
2461
|
+
; the same way, and the prelude gains `const PASS_SCALE` so the shader can
|
|
2462
|
+
; find its own extent — `pngine.width`/`height` stay the CANVAS.
|
|
2463
|
+
(key :name scale :type canvas-scale :optional true
|
|
2464
|
+
:description "Render this pass's intermediate at a fraction of the canvas in each dimension. The prelude declares `const PASS_SCALE: f32` when this is set; pngine.width/height keep meaning the canvas.")
|
|
2465
|
+
(key :name reads :type texture-ref-list :optional true
|
|
2466
|
+
:description "Declared (texture …) forms this pass samples, bound after its prior-pass dependencies. Each must carry texture-binding usage, be a single-layer 2d texture, be unmultisampled, and be named by this pass's WGSL.")
|
|
2467
|
+
; Forwarded onto the three modules the hook builds from the author's text,
|
|
2468
|
+
; never onto pngine's own blit shader. A fragment imported here may NOT
|
|
2469
|
+
; declare a @group/@binding variable: the prelude numbers group 0 itself and
|
|
2470
|
+
; no bind group exists for any other group. Feature detection still reads
|
|
2471
|
+
; the pass BODY only, so a fragment mentioning `pngine.time` does not make
|
|
2472
|
+
; the prelude declare the uniform.
|
|
2473
|
+
(key :name imports :type wgsl-ref-list :optional true
|
|
2474
|
+
:description "Fragments assembled ahead of this pass's code. They may declare functions, structs and constants, but no resource bindings — the prelude owns group 0."))
|
|
2475
|
+
|
|
2476
|
+
(form :name pass-graph
|
|
2477
|
+
:description "Container of (pass …) children lowered as a unit so resource ids
|
|
2478
|
+
(esp. cross-pass textures) sequence coherently across all passes."
|
|
2479
|
+
:open true
|
|
2480
|
+
:positional pass-item
|
|
2481
|
+
; Named, the graph is a `(step-group …)` and the document writes its own
|
|
2482
|
+
; `(frame …)` naming it — which is how a pass graph and a draw graph run in
|
|
2483
|
+
; one frame. Unnamed, it emits the frame itself, as it always has, and is
|
|
2484
|
+
; then the document's only one.
|
|
2485
|
+
(key :name name :type symbol :optional true
|
|
2486
|
+
:description "Makes this graph a (step-group …) of that name instead of the document's (frame …). A document with two graphs names both.")
|
|
2487
|
+
; The unnamed graph emits the document's frame, so a hand-authored step has
|
|
2488
|
+
; no way into it; a document that declares its own (frame …) beside an
|
|
2489
|
+
; unnamed graph, or a (draw-graph …) beside this one, is refused rather
|
|
2490
|
+
; than silently compiled to two frames of which the runtime runs the first.
|
|
2491
|
+
; This key is the way in: the steps land at the head of the emitted frame's
|
|
2492
|
+
; :perform, ahead of every pass the graph builds, which is what lets a
|
|
2493
|
+
; (pass … :reads …) read a texture a hand-authored pass wrote this frame.
|
|
2494
|
+
(key :name before :type frame-step-list :optional true
|
|
2495
|
+
:description "Passes and queues run each frame BEFORE the graph's own steps, in this order — they become the head of the emitted (frame …)'s :perform.")
|
|
2496
|
+
; The canvas destination for a pass that is not the graph's last. The
|
|
2497
|
+
; hook emits the same machinery a compute main's auto-blit uses (the blit
|
|
2498
|
+
; shader, a canvas pipeline, a bind group over the pass's intermediate and
|
|
2499
|
+
; the shared sampler, and a render pass to the canvas), named
|
|
2500
|
+
; `<pass>__blit`, and appends it to NO step list: it exists as a frame
|
|
2501
|
+
; step and runs only when a frame names it. Soloing `warp` is then the
|
|
2502
|
+
; frame performing `[warp__uq warp warp__blit]` (the queue is the pass's
|
|
2503
|
+
; uniform write, present when the pass names `pngine`), and restoring the
|
|
2504
|
+
; frame to the group runs the whole graph again.
|
|
2505
|
+
;
|
|
2506
|
+
; Three refusals, each naming what it could not do. A name no `(pass …)` in
|
|
2507
|
+
; this graph carries has no intermediate to blit. A pass that renders
|
|
2508
|
+
; straight to the canvas has no intermediate either, and a frame performing
|
|
2509
|
+
; it already puts it on the canvas. A pass whose `:format` is not a
|
|
2510
|
+
; filterable float cannot be sampled by pngine's own blit shader, which
|
|
2511
|
+
; declares `texture_2d<f32>` and binds the shared linear sampler.
|
|
2512
|
+
;
|
|
2513
|
+
; Additive by construction: no key, no forms, and every existing document
|
|
2514
|
+
; compiles to the same bytes (the `:init` empty-vector precedent below).
|
|
2515
|
+
(key :name expose :type pass-name-list :optional true
|
|
2516
|
+
:description "The graph's passes whose intermediate a frame may put on the canvas through a generated `<pass>__blit` render pass. Absent, nothing is emitted.")
|
|
2517
|
+
:lowering (lowering :hook pngine/pass-v1
|
|
2518
|
+
:produces [shader-module buffer texture sampler bind-group entry
|
|
2519
|
+
render-pipeline vertex fragment color-target constant
|
|
2520
|
+
render-pass color-attachment draw frame step-group
|
|
2521
|
+
compute-pipeline compute compute-pass dispatch queue write-buffer]))
|
|
2522
|
+
|
|
2523
|
+
; =====================================================================
|
|
2524
|
+
; `(draw-graph …)` sugar — container-lowered by pngine/draw-v1
|
|
2525
|
+
; =====================================================================
|
|
2526
|
+
; One conceptual draw into many concrete draws: the author writes a table of
|
|
2527
|
+
; stages (what to draw INTO, and the pipeline state a stage shares) and
|
|
2528
|
+
; geometries (what to draw, and which stages it appears in), and the hook
|
|
2529
|
+
; emits the cross product — one pipeline, one bind group per stage group, and
|
|
2530
|
+
; one render pass per (stage, geometry). `webgpu_shadow_mapping_fragments`
|
|
2531
|
+
; was four fifths pipeline / pass / bind-group forms saying the same thing
|
|
2532
|
+
; four times; this is that document's other half of the critique.
|
|
2533
|
+
;
|
|
2534
|
+
; The carrier is a pass per draw, not a render bundle per draw: `:color-formats`
|
|
2535
|
+
; cannot be empty on this wire (docs/abi.md §6.5, cf_count 0 is the frozen
|
|
2536
|
+
; "guess the canvas" sentinel), so a depth-only stage has no bundle, and the
|
|
2537
|
+
; native backend stubs bundles outright, which would leave the whole feature
|
|
2538
|
+
; without a `test-render` gate. The load/store rewrite that carrier needs —
|
|
2539
|
+
; the stage's ops on the first pass, `load` on the rest, the stage's store-op
|
|
2540
|
+
; on the last — is written once here instead of by every author.
|
|
2541
|
+
; As of 2026-10-06 the kind NAME moved off `stage-section`, the one
|
|
2542
|
+
; value-kind name pacer's carried copy also declares and references bare,
|
|
2543
|
+
; so that pacer's reference has a single claimant in every aggregate that
|
|
2544
|
+
; loads both vocabularies. A bare name two loaded plugins declare is still
|
|
2545
|
+
; ambiguous, and the declarant still gets no priority. The rule is the
|
|
2546
|
+
; charter's fourth ruling and SJON's plugin-model ownership paragraph.
|
|
2547
|
+
(form :name stage
|
|
2548
|
+
:description "One stage of a (draw-graph …): the attachments a pass writes, plus the pipeline state every geometry drawn in it shares. Becomes one (render-pass …) per geometry."
|
|
2549
|
+
:positional pngine/draw-stage-section
|
|
2550
|
+
(key :name name :type symbol)
|
|
2551
|
+
; Slot-local `(color-target …)`, and the narrowing is the missing `:format`: a
|
|
2552
|
+
; stage's color-targets pair positionally with its `(color-attachment …)`
|
|
2553
|
+
; children, and the format is read off the attachment, so stating it here
|
|
2554
|
+
; would be the one thing said twice that D3 exists to prevent. Everything
|
|
2555
|
+
; else a colour target carries — the blend state and the write mask — has
|
|
2556
|
+
; nowhere else to live, since a stage owns the attachments a color-target
|
|
2557
|
+
; describes. Optional as a group: declare none and every color-target is the
|
|
2558
|
+
; derived format alone, exactly as before this key existed.
|
|
2559
|
+
(form :name color-target
|
|
2560
|
+
:description "Blend state and write mask for one of this stage's colour targets, paired with the (color-attachment …) at the same position. The format is derived from that attachment, so it is not stated here."
|
|
2561
|
+
:positional color-target-section
|
|
2562
|
+
(key :name write-mask :type write-mask :optional true
|
|
2563
|
+
:description "Channel write mask: bitmask R=1 G=2 B=4 A=8, or all (15; the WebGPU default).")))
|
|
2564
|
+
(form :name geometry
|
|
2565
|
+
:description "One thing a (draw-graph …) draws: its buffers, its vertex layout, one draw command, and an (in …) per stage it appears in."
|
|
2566
|
+
:positional geometry-section
|
|
2567
|
+
(key :name name :type symbol)
|
|
2568
|
+
(key :name vertex-buffers :type buffer-ref-list :optional true
|
|
2569
|
+
:description "Buffers bound to vertex slots 0..N in order, on every pass this geometry generates.")
|
|
2570
|
+
(key :name index-buffer :type buffer-ref :optional true
|
|
2571
|
+
:description "Index buffer for a (draw-indexed …); index format propagates from the buffer's :index-of source."))
|
|
2572
|
+
(form :name in
|
|
2573
|
+
:description "This geometry, drawn in that stage: the entry points, and any state that overrides the stage's."
|
|
2574
|
+
:positional in-section
|
|
2575
|
+
; A real cross-ref, and it does the checking: a `(stage :name …)` inside
|
|
2576
|
+
; this container registers as a target, so an unknown or duplicated stage
|
|
2577
|
+
; name is `not_cross_ref` / `duplicate_cross_ref_target` before the hook
|
|
2578
|
+
; runs. The hook keeps its own refusal as a backstop for a registry-less
|
|
2579
|
+
; caller, and because it can name the stages that DO exist.
|
|
2580
|
+
(key :name stage :type stage-ref
|
|
2581
|
+
:description "Name of the (stage …) of this graph this geometry is drawn in.")
|
|
2582
|
+
; Slot-local `(vertex …)` / `(fragment …)`: the same two keys the global
|
|
2583
|
+
; stages carry, with a positional section that admits `(constant …)` only.
|
|
2584
|
+
; See `in-stage-section` for why they cannot be the global forms.
|
|
2585
|
+
(form :name vertex
|
|
2586
|
+
:description "Vertex stage of this (stage, geometry) pipeline: the module + entry point, and (constant …) overrides. The geometry's (vertex-buffer …) children become this stage's buffers."
|
|
2587
|
+
:positional in-stage-section
|
|
2588
|
+
(key :name module :type module-ref
|
|
2589
|
+
:description "The (shader-module …) holding the @vertex entry.")
|
|
2590
|
+
(key :name entry :type entry-point :optional true
|
|
2591
|
+
:description "Entry-point function name (defaults to the module's sole @vertex fn)."))
|
|
2592
|
+
(form :name fragment
|
|
2593
|
+
:description "Fragment stage of this (stage, geometry) pipeline: the module + entry point, and (constant …) overrides. Omit it for a depth-only draw. The stage's color attachments derive the (color-target …) list."
|
|
2594
|
+
:positional in-stage-section
|
|
2595
|
+
(key :name module :type module-ref
|
|
2596
|
+
:description "The (shader-module …) holding the @fragment entry.")
|
|
2597
|
+
(key :name entry :type entry-point :optional true
|
|
2598
|
+
:description "Entry-point function name (defaults to the module's sole @fragment fn).")))
|
|
2599
|
+
|
|
2600
|
+
(form :name draw-graph
|
|
2601
|
+
:description "Container of (stage …) and (geometry …) children lowered as a unit into the
|
|
2602
|
+
cross product: one (render-pipeline …), one (bind-group …) per stage group and
|
|
2603
|
+
one (render-pass …) for each (stage, geometry) pair, in stage-major order."
|
|
2604
|
+
:positional draw-graph-section
|
|
2605
|
+
; See `(pass-graph :name …)`: named, this graph becomes a `(step-group …)`
|
|
2606
|
+
; and the document owns its frame; unnamed, it emits the frame itself.
|
|
2607
|
+
(key :name name :type symbol :optional true
|
|
2608
|
+
:description "Makes this graph a (step-group …) of that name instead of the document's (frame …). A document with two graphs names both.")
|
|
2609
|
+
; The graph emits the document's (frame …) — a stage is several passes, so
|
|
2610
|
+
; a hand-authored frame could not name one in a single step, and a stage
|
|
2611
|
+
; name cannot BE a frame step (cross-refs resolve over the lowered forest,
|
|
2612
|
+
; where a consumed container's children do not appear). These two keys are
|
|
2613
|
+
; the way in and the way out; a document that declares its own (frame …),
|
|
2614
|
+
; or a (pass-graph …) beside this one, is refused rather than silently
|
|
2615
|
+
; compiled to two frames of which the runtime runs the first.
|
|
2616
|
+
(key :name before :type frame-step-list :optional true
|
|
2617
|
+
:description "Passes and queues run each frame BEFORE the graph's own steps — the head of the emitted (frame …)'s :perform.")
|
|
2618
|
+
(key :name after :type frame-step-list :optional true
|
|
2619
|
+
:description "Passes and queues run each frame AFTER the graph's own steps — the tail of the emitted (frame …)'s :perform.")
|
|
2620
|
+
:lowering (lowering :hook pngine/draw-v1
|
|
2621
|
+
:produces [render-pipeline vertex fragment color-target blend color alpha
|
|
2622
|
+
constant vertex-buffer attribute primitive depth-stencil
|
|
2623
|
+
bind-group entry
|
|
2624
|
+
render-pass color-attachment depth-stencil-attachment
|
|
2625
|
+
draw draw-indexed draw-indirect draw-indexed-indirect
|
|
2626
|
+
frame step-group])))
|