1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
/// The `navigator` property key carrying the `GPU` object.
pub const BACKEND_WEBGPU_NAVIGATOR_KEY: &str = "gpu";
/// The method name reading the preferred canvas format.
pub const BACKEND_WEBGPU_PREFERRED_FORMAT: &str = "getPreferredCanvasFormat";
/// The lowercase `bgra8unorm` swap-chain format.
pub const BACKEND_WEBGPU_FORMAT_BGRA8_UNORM: &str = "bgra8unorm";
/// The property carrying a `GPUError`'s message.
pub const BACKEND_WEBGPU_ERROR_MESSAGE: &str = "message";
/// The `GPUCompilationMessageType` value that makes a message fatal.
pub const BACKEND_WEBGPU_MESSAGE_ERROR: &str = "error";
/// The debug label attached to the ray-trace shader module.
pub const BACKEND_WEBGPU_SHADER_LABEL: &str = "euv-raytrace";
/// The `GPUErrorFilter` value wrapping each resource allocation.
pub const BACKEND_WEBGPU_SCOPE_VALIDATION: &str = "validation";
/// The `GPUBufferUsage.STORAGE` flag both packed buffers carry.
pub const BACKEND_WEBGPU_USAGE_STORAGE: u32 = 128;
/// The `GPUBufferUsage.COPY_DST` flag, so `writeBuffer` may refill a
/// packed buffer in place.
pub const BACKEND_WEBGPU_USAGE_COPY_DST: u32 = 8;
/// The `GPUShaderStage.FRAGMENT` flag both binding entries declare,
/// because only the fragment stage reads them.
pub const BACKEND_WEBGPU_VISIBILITY_FRAGMENT: u32 = 2;
/// The WebGPU bind-group binding index of the packed scene buffer.
pub const BACKEND_WEBGPU_BINDING_SCENE: u32 = 0;
/// The WebGPU bind-group binding index of the packed frame buffer.
pub const BACKEND_WEBGPU_BINDING_FRAME: u32 = 1;
/// The `@group` index the shader's two bindings live in.
pub const BACKEND_WEBGPU_BIND_GROUP_INDEX: u32 = 0;
/// The number of vertices the WebGPU fullscreen triangle issues.
pub const BACKEND_WEBGPU_VERTEX_COUNT: u32 = 3;
/// The instance count a fullscreen draw issues.
pub const BACKEND_WEBGPU_INSTANCE_COUNT: u32 = 1;
/// The first vertex the fullscreen triangle starts at.
pub const BACKEND_WEBGPU_FIRST_VERTEX: u32 = 0;
/// The first instance the fullscreen triangle starts at.
pub const BACKEND_WEBGPU_FIRST_INSTANCE: u32 = 0;
/// The size in bytes of one `f32` slot in a packed storage buffer.
pub const BACKEND_WEBGPU_F32_SIZE: usize = 4;
/// The byte size each packed storage buffer starts at before the
/// first real block decides its final capacity.
///
/// The initial allocation exists so a bind group can reference both
/// buffers at all — a zero-sized buffer is not a valid binding — while
/// staying far below every adapter's storage limit. Pre-reserving the
/// whole 512 MiB packed budget would exceed the storage-binding limit
/// on the common adapters and fail the very first allocation.
pub const BACKEND_WEBGPU_INITIAL_BUFFER_BYTES: u32 = 4096;
/// The `GPUTextureUsage.RENDER_ATTACHMENT` flag the swap chain needs.
pub const BACKEND_WEBGPU_TEXTURE_RENDER_ATTACHMENT: u32 = 16;
/// The `GPUCanvasAlphaMode.opaque` value the context is configured with.
pub const BACKEND_WEBGPU_ALPHA_OPAQUE: &str = "opaque";
/// The `GPUBufferBindingType.read-only-storage` value.
pub const BACKEND_WEBGPU_BUFFER_READ_ONLY_STORAGE: &str = "read-only-storage";
/// The descriptor property naming the device.
pub const BACKEND_WEBGPU_PROPERTY_DEVICE: &str = "device";
/// The descriptor property naming the swap-chain format.
pub const BACKEND_WEBGPU_PROPERTY_FORMAT: &str = "format";
/// The descriptor property naming the alpha mode.
pub const BACKEND_WEBGPU_PROPERTY_ALPHA_MODE: &str = "alphaMode";
/// The descriptor property naming the texture usage.
pub const BACKEND_WEBGPU_PROPERTY_USAGE: &str = "usage";
/// The descriptor property naming a bind-group binding index.
pub const BACKEND_WEBGPU_PROPERTY_BINDING: &str = "binding";
/// The descriptor property naming a binding's shader stage visibility.
pub const BACKEND_WEBGPU_PROPERTY_VISIBILITY: &str = "visibility";
/// The descriptor property naming a binding layout's buffer layout.
pub const BACKEND_WEBGPU_PROPERTY_BUFFER: &str = "buffer";
/// The descriptor property naming a binding layout's type.
pub const BACKEND_WEBGPU_PROPERTY_TYPE: &str = "type";
/// The descriptor property naming a bind group's entries.
pub const BACKEND_WEBGPU_PROPERTY_ENTRIES: &str = "entries";
/// The descriptor property naming a bind group's layout.
pub const BACKEND_WEBGPU_PROPERTY_LAYOUT: &str = "layout";
/// The descriptor property naming a bind-group entry's resource.
pub const BACKEND_WEBGPU_PROPERTY_RESOURCE: &str = "resource";
/// The descriptor property naming a pipeline layout's bind-group layouts.
pub const BACKEND_WEBGPU_PROPERTY_BIND_GROUP_LAYOUTS: &str = "bindGroupLayouts";
/// The descriptor property naming a pipeline's vertex stage.
pub const BACKEND_WEBGPU_PROPERTY_VERTEX: &str = "vertex";
/// The descriptor property naming a pipeline's fragment stage.
pub const BACKEND_WEBGPU_PROPERTY_FRAGMENT: &str = "fragment";
/// The descriptor property naming a stage's shader module.
pub const BACKEND_WEBGPU_PROPERTY_MODULE: &str = "module";
/// The descriptor property naming a stage's colour targets.
pub const BACKEND_WEBGPU_PROPERTY_TARGETS: &str = "targets";
/// The descriptor property naming a colour target's format.
pub const BACKEND_WEBGPU_PROPERTY_FORMAT_TARGET: &str = "format";
/// The descriptor property naming a pipeline's primitive state.
pub const BACKEND_WEBGPU_PROPERTY_PRIMITIVE: &str = "primitive";
/// The descriptor property naming a primitive topology.
pub const BACKEND_WEBGPU_PROPERTY_TOPOLOGY: &str = "topology";
/// The primitive topology value a triangle list names.
pub const BACKEND_WEBGPU_TOPOLOGY_TRIANGLE_LIST: &str = "triangle-list";
/// The descriptor property naming a stage's shader entry point.
pub const BACKEND_WEBGPU_PROPERTY_ENTRY_POINT: &str = "entryPoint";
/// The descriptor property naming a render pass's colour attachments.
pub const BACKEND_WEBGPU_PROPERTY_COLOR_ATTACHMENTS: &str = "colorAttachments";
/// The descriptor property naming a colour attachment's view.
pub const BACKEND_WEBGPU_PROPERTY_VIEW: &str = "view";
/// The descriptor property naming a colour attachment's clear colour.
pub const BACKEND_WEBGPU_PROPERTY_CLEAR_VALUE: &str = "clearValue";
/// The descriptor property naming an attachment's load operation.
pub const BACKEND_WEBGPU_PROPERTY_LOAD_OP: &str = "loadOp";
/// The descriptor property naming an attachment's store operation.
pub const BACKEND_WEBGPU_PROPERTY_STORE_OP: &str = "storeOp";
/// The attachment load operation value.
pub const BACKEND_WEBGPU_LOAD_CLEAR: &str = "clear";
/// The attachment store operation value.
pub const BACKEND_WEBGPU_STORE_STORE: &str = "store";
/// The descriptor property naming a shader module's code.
pub const BACKEND_WEBGPU_PROPERTY_CODE: &str = "code";
/// The descriptor property naming a shader module's label.
pub const BACKEND_WEBGPU_PROPERTY_LABEL: &str = "label";
/// The descriptor property naming a buffer's size in bytes.
pub const BACKEND_WEBGPU_PROPERTY_SIZE: &str = "size";
/// The descriptor property naming a buffer's usage flags.
pub const BACKEND_WEBGPU_PROPERTY_USAGE_FLAGS: &str = "usage";
/// The property a compilation info carries its messages under.
pub const BACKEND_WEBGPU_PROPERTY_MESSAGES: &str = "messages";
/// The property a compilation message carries its kind under.
///
/// Distinct from [`BACKEND_WEBGPU_PROPERTY_TYPE`], which names a
/// binding layout's dictionary type; both happen to be the string
/// `type`.
pub const BACKEND_WEBGPU_PROPERTY_MESSAGE_TYPE: &str = "type";
/// The property a compilation message carries its text under.
pub const BACKEND_WEBGPU_PROPERTY_MESSAGE_TEXT: &str = "message";
/// The property a compilation message carries its line under.
pub const BACKEND_WEBGPU_PROPERTY_LINE_NUM: &str = "lineNum";
/// The property carrying a device's submit queue.
///
/// `GPUDevice.queue` is an attribute, not a method: looking it up and
/// calling the result throws `queue is not callable` before a single
/// buffer exists.
pub const BACKEND_WEBGPU_PROPERTY_QUEUE: &str = "queue";
/// The property carrying a device's limits.
///
/// Like [`BACKEND_WEBGPU_PROPERTY_QUEUE`], `GPUDevice.limits` is an
/// attribute holding a `GPUSupportedLimits` dictionary.
pub const BACKEND_WEBGPU_PROPERTY_LIMITS: &str = "limits";
/// The property carrying a device's loss promise.
///
/// `GPUDevice.lost` is always present, so its existence proves
/// nothing; only the promise's resolution says the device died.
pub const BACKEND_WEBGPU_PROPERTY_LOST: &str = "lost";
/// The `GPUDeviceLostInfo.reason` value of a deliberate destroy.
pub const BACKEND_WEBGPU_LOST_REASON: &str = "reason";
/// The method chaining a `device.lost` promise onto the loss handler.
pub const BACKEND_WEBGPU_METHOD_THEN: &str = "then";
/// The event name a device reports uncaptured errors under.
pub const BACKEND_WEBGPU_EVENT_UNCAPTURED: &str = "uncapturederror";
/// The `GPUUncapturedErrorEvent.error` property.
pub const BACKEND_WEBGPU_PROPERTY_ERROR: &str = "error";
/// The method registering an event listener on a device.
pub const BACKEND_WEBGPU_METHOD_ADD_LISTENER: &str = "addEventListener";
/// The method unregistering an event listener from a device.
///
/// The `uncapturederror` listener owns a Rust closure, so it has to be
/// unregistered before that closure is dropped: a device that keeps
/// the listener would invoke an invalidated callback the next time any
/// other validation error fires.
pub const BACKEND_WEBGPU_METHOD_REMOVE_LISTENER: &str = "removeEventListener";
/// The limit naming the largest addressable storage binding, in bytes.
pub const BACKEND_WEBGPU_LIMIT_STORAGE_BINDING: &str = "maxStorageBufferBindingSize";
/// The limit naming the largest allocatable buffer, in bytes.
pub const BACKEND_WEBGPU_LIMIT_BUFFER_SIZE: &str = "maxBufferSize";
/// The limit naming the largest texture edge, in pixels.
///
/// This one counts pixels, not bytes: it bounds `width` and `height`
/// separately, and is the only limit a surface size has to respect.
pub const BACKEND_WEBGPU_LIMIT_TEXTURE_2D: &str = "maxTextureDimension2D";
/// The `vs_main` entry point the vertex stage names.
///
/// The WGSL module the pipeline compiles declares two entry points,
/// `vs_main` and `fs_main`, and no `main`: naming one constant for both
/// stages asks the vertex stage for a fragment entry point and the
/// browser rejects the whole pipeline.
pub const BACKEND_WEBGPU_ENTRY_VERTEX: &str = "vs_main";
/// The `fs_main` entry point the fragment stage names.
pub const BACKEND_WEBGPU_ENTRY_FRAGMENT: &str = "fs_main";
/// The method binding a pipeline to a render pass.
pub const BACKEND_WEBGPU_METHOD_SET_PIPELINE: &str = "setPipeline";
/// The method binding a bind group to a render pass.
pub const BACKEND_WEBGPU_METHOD_SET_BIND_GROUP: &str = "setBindGroup";
/// The method issuing a draw inside a render pass.
pub const BACKEND_WEBGPU_METHOD_DRAW: &str = "draw";
/// The method closing a render pass.
pub const BACKEND_WEBGPU_METHOD_END: &str = "end";
/// The method configuring a canvas context.
pub const BACKEND_WEBGPU_METHOD_CONFIGURE: &str = "configure";
/// The method releasing a canvas context's swap chain.
pub const BACKEND_WEBGPU_METHOD_UNCONFIGURE: &str = "unconfigure";
/// The method reading a context's swap-chain texture.
pub const BACKEND_WEBGPU_METHOD_CURRENT_TEXTURE: &str = "getCurrentTexture";
/// The method deriving a bindable view from a texture.
pub const BACKEND_WEBGPU_METHOD_CREATE_VIEW: &str = "createView";
/// The method requesting an adapter.
pub const BACKEND_WEBGPU_METHOD_REQUEST_ADAPTER: &str = "requestAdapter";
/// The method requesting a device.
pub const BACKEND_WEBGPU_METHOD_REQUEST_DEVICE: &str = "requestDevice";
/// The method opening a validation error scope.
pub const BACKEND_WEBGPU_METHOD_PUSH_SCOPE: &str = "pushErrorScope";
/// The method closing a validation error scope.
pub const BACKEND_WEBGPU_METHOD_POP_SCOPE: &str = "popErrorScope";
/// The method creating a buffer.
pub const BACKEND_WEBGPU_METHOD_CREATE_BUFFER: &str = "createBuffer";
/// The method creating a bind-group layout.
pub const BACKEND_WEBGPU_METHOD_CREATE_LAYOUT: &str = "createBindGroupLayout";
/// The method creating a bind group.
pub const BACKEND_WEBGPU_METHOD_CREATE_BIND_GROUP: &str = "createBindGroup";
/// The method creating a pipeline layout.
pub const BACKEND_WEBGPU_METHOD_CREATE_PIPELINE_LAYOUT: &str = "createPipelineLayout";
/// The method creating a render pipeline asynchronously.
pub const BACKEND_WEBGPU_METHOD_CREATE_PIPELINE: &str = "createRenderPipelineAsync";
/// The method creating a shader module.
pub const BACKEND_WEBGPU_METHOD_CREATE_MODULE: &str = "createShaderModule";
/// The method creating a command encoder.
pub const BACKEND_WEBGPU_METHOD_CREATE_ENCODER: &str = "createCommandEncoder";
/// The method reading a shader module's compilation info.
pub const BACKEND_WEBGPU_METHOD_COMPILATION_INFO: &str = "getCompilationInfo";
/// The method opening a render pass on an encoder.
pub const BACKEND_WEBGPU_METHOD_BEGIN_PASS: &str = "beginRenderPass";
/// The method finishing a command encoder.
pub const BACKEND_WEBGPU_METHOD_FINISH: &str = "finish";
/// The method submitting a command buffer.
pub const BACKEND_WEBGPU_METHOD_SUBMIT: &str = "submit";
/// The method writing a storage buffer.
pub const BACKEND_WEBGPU_METHOD_WRITE_BUFFER: &str = "writeBuffer";
/// The method destroying a buffer.
pub const BACKEND_WEBGPU_METHOD_DESTROY: &str = "destroy";
/// The error reported when the shader module compiled with errors.
pub const BACKEND_WEBGPU_ERROR_SHADER: &str = "the WGSL shader module is invalid";
/// The error reported when the render pipeline failed validation.
pub const BACKEND_WEBGPU_ERROR_PIPELINE: &str = "the WebGPU render pipeline is invalid";
/// The error reported when the swap chain produced no usable texture.
pub const BACKEND_WEBGPU_ERROR_TEXTURE: &str = "the WebGPU swap chain produced no texture";
/// The error reported when a texture yielded no bindable view.
pub const BACKEND_WEBGPU_ERROR_VIEW: &str = "the WebGPU texture produced no view";
/// The diagnostic used when the failure record is momentarily borrowed.
pub const WEBGPU_FAILURE_BUSY: &str =
"the WebGPU failure record is being read by another frame";
/// The diagnostic used when a popped scope reported no message at all.
pub const WEBGPU_SCOPE_SILENT: &str =
"the WebGPU device rejected the operation without a validation message";