@matjash/pixi-native-win32-x64 0.1.2

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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/THIRD_PARTY_NOTICES.md +83 -0
  3. package/index.cjs +25 -0
  4. package/index.d.ts +11 -0
  5. package/native/audio/binding-path.js +16 -0
  6. package/native/audio/dist/win32-x64/native_audio.node +0 -0
  7. package/native/audio/package.json +7 -0
  8. package/native/audio/src/index.d.ts +63 -0
  9. package/native/audio/src/index.js +5 -0
  10. package/native/audio/src/lib.rs +1520 -0
  11. package/native/gpu/dist/win32-x64/d3dcompiler_47.dll +0 -0
  12. package/native/gpu/dist/win32-x64/pixi_native_gpu.node +0 -0
  13. package/native/gpu/package.json +24 -0
  14. package/native/gpu/src/binding-path.js +16 -0
  15. package/native/gpu/src/index.d.ts +2847 -0
  16. package/native/gpu/src/index.js +48 -0
  17. package/native/video/dist/win32-x64/FFMPEG_BUILD_INFO.txt +46 -0
  18. package/native/video/dist/win32-x64/FFMPEG_LICENSE.txt +502 -0
  19. package/native/video/dist/win32-x64/FFMPEG_SHA256SUMS +4 -0
  20. package/native/video/dist/win32-x64/ffmpeg.exe +0 -0
  21. package/native/video/dist/win32-x64/ffprobe.exe +0 -0
  22. package/native/video/dist/win32-x64/native_video.node +0 -0
  23. package/native/video/package.json +7 -0
  24. package/native/video/src/binding-path.js +26 -0
  25. package/native/video/src/index.d.ts +36 -0
  26. package/native/video/src/index.js +61 -0
  27. package/native/video/src/lib.rs +994 -0
  28. package/native/window/binding-path.js +11 -0
  29. package/native/window/dist/win32-x64/native_window.node +0 -0
  30. package/native/window/package.json +7 -0
  31. package/native/window/src/index.d.ts +17 -0
  32. package/native/window/src/index.js +32 -0
  33. package/native/window/src/lib.rs +308 -0
  34. package/package.json +41 -0
  35. package/third_party/ffmpeg-source-8.0-140fd653ae.tar.gz +0 -0
  36. package/third_party/ffmpeg-source-8.0-140fd653ae.tar.gz.sha256 +1 -0
@@ -0,0 +1,2847 @@
1
+ type GPUBindingResource =
2
+ | GPUSampler
3
+ | GPUTextureView
4
+ | GPUBufferBinding
5
+ | GPUExternalTexture;
6
+ type GPUBufferDynamicOffset = number;
7
+ type GPUBufferUsageFlags = number;
8
+ type GPUColor = Array<number> | GPUColorDict;
9
+ type GPUColorWriteFlags = number;
10
+ type GPUDepthBias = number;
11
+ type GPUExtent3D = Array<GPUIntegerCoordinate> | GPUExtent3DDict;
12
+ type GPUFlagsConstant = number;
13
+ type GPUImageCopyExternalImageSource =
14
+ | ImageBitmap
15
+ | ImageData
16
+ | HTMLImageElement
17
+ | HTMLVideoElement
18
+ | VideoFrame
19
+ | HTMLCanvasElement
20
+ | OffscreenCanvas;
21
+ type GPUIndex32 = number;
22
+ type GPUIntegerCoordinate = number;
23
+ type GPUIntegerCoordinateOut = number;
24
+ type GPUMapModeFlags = number;
25
+ type GPUOrigin2D = Array<GPUIntegerCoordinate> | GPUOrigin2DDict;
26
+ type GPUOrigin3D = Array<GPUIntegerCoordinate> | GPUOrigin3DDict;
27
+ type GPUPipelineConstantValue = number;
28
+ type GPUSampleMask = number;
29
+ type GPUShaderStageFlags = number;
30
+ type GPUSignedOffset32 = number;
31
+ type GPUSize32 = number;
32
+ type GPUSize32Out = number;
33
+ type GPUSize64 = number;
34
+ type GPUSize64Out = number;
35
+ type GPUStencilValue = number;
36
+ type GPUTextureUsageFlags = number;
37
+ type GPUAddressMode = "clamp-to-edge" | "repeat" | "mirror-repeat";
38
+ type GPUAutoLayoutMode = "auto";
39
+ type GPUBlendFactor =
40
+ | "zero"
41
+ | "one"
42
+ | "src"
43
+ | "one-minus-src"
44
+ | "src-alpha"
45
+ | "one-minus-src-alpha"
46
+ | "dst"
47
+ | "one-minus-dst"
48
+ | "dst-alpha"
49
+ | "one-minus-dst-alpha"
50
+ | "src-alpha-saturated"
51
+ | "constant"
52
+ | "one-minus-constant";
53
+ type GPUBlendOperation =
54
+ | "add"
55
+ | "subtract"
56
+ | "reverse-subtract"
57
+ | "min"
58
+ | "max";
59
+ type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage";
60
+ type GPUBufferMapState = "unmapped" | "pending" | "mapped";
61
+ type GPUCanvasAlphaMode = "opaque" | "premultiplied";
62
+ type GPUCompareFunction =
63
+ | "never"
64
+ | "less"
65
+ | "equal"
66
+ | "less-equal"
67
+ | "greater"
68
+ | "not-equal"
69
+ | "greater-equal"
70
+ | "always";
71
+ type GPUCompilationMessageType = "error" | "warning" | "info";
72
+ type GPUCullMode = "none" | "front" | "back";
73
+ type GPUDeviceLostReason = "unknown" | "destroyed";
74
+ type GPUErrorFilter = "validation" | "out-of-memory" | "internal";
75
+ type GPUFeatureName =
76
+ | "depth-clip-control"
77
+ | "depth32float-stencil8"
78
+ | "texture-compression-bc"
79
+ | "texture-compression-etc2"
80
+ | "texture-compression-astc"
81
+ | "timestamp-query"
82
+ | "indirect-first-instance"
83
+ | "shader-f16"
84
+ | "rg11b10ufloat-renderable"
85
+ | "bgra8unorm-storage"
86
+ | "float32-filterable";
87
+ type GPUFilterMode = "nearest" | "linear";
88
+ type GPUFrontFace = "ccw" | "cw";
89
+ type GPUIndexFormat = "uint16" | "uint32";
90
+ type GPULoadOp = "load" | "clear";
91
+ type GPUMipmapFilterMode = "nearest" | "linear";
92
+ type GPUPipelineErrorReason = "validation" | "internal";
93
+ type GPUPowerPreference = "low-power" | "high-performance";
94
+ type GPUPrimitiveTopology =
95
+ | "point-list"
96
+ | "line-list"
97
+ | "line-strip"
98
+ | "triangle-list"
99
+ | "triangle-strip";
100
+ type GPUQueryType = "occlusion" | "timestamp";
101
+ type GPUSamplerBindingType = "filtering" | "non-filtering" | "comparison";
102
+ type GPUStencilOperation =
103
+ | "keep"
104
+ | "zero"
105
+ | "replace"
106
+ | "invert"
107
+ | "increment-clamp"
108
+ | "decrement-clamp"
109
+ | "increment-wrap"
110
+ | "decrement-wrap";
111
+ type GPUStorageTextureAccess = "write-only" | "read-only" | "read-write";
112
+ type GPUStoreOp = "store" | "discard";
113
+ type GPUTextureAspect = "all" | "stencil-only" | "depth-only";
114
+ type GPUTextureDimension = "1d" | "2d" | "3d";
115
+ type GPUTextureFormat =
116
+ | "r8unorm"
117
+ | "r8snorm"
118
+ | "r8uint"
119
+ | "r8sint"
120
+ | "r16uint"
121
+ | "r16sint"
122
+ | "r16float"
123
+ | "rg8unorm"
124
+ | "rg8snorm"
125
+ | "rg8uint"
126
+ | "rg8sint"
127
+ | "r32uint"
128
+ | "r32sint"
129
+ | "r32float"
130
+ | "rg16uint"
131
+ | "rg16sint"
132
+ | "rg16float"
133
+ | "rgba8unorm"
134
+ | "rgba8unorm-srgb"
135
+ | "rgba8snorm"
136
+ | "rgba8uint"
137
+ | "rgba8sint"
138
+ | "bgra8unorm"
139
+ | "bgra8unorm-srgb"
140
+ | "rgb9e5ufloat"
141
+ | "rgb10a2uint"
142
+ | "rgb10a2unorm"
143
+ | "rg11b10ufloat"
144
+ | "rg32uint"
145
+ | "rg32sint"
146
+ | "rg32float"
147
+ | "rgba16uint"
148
+ | "rgba16sint"
149
+ | "rgba16float"
150
+ | "rgba32uint"
151
+ | "rgba32sint"
152
+ | "rgba32float"
153
+ | "stencil8"
154
+ | "depth16unorm"
155
+ | "depth24plus"
156
+ | "depth24plus-stencil8"
157
+ | "depth32float"
158
+ | "depth32float-stencil8"
159
+ | "bc1-rgba-unorm"
160
+ | "bc1-rgba-unorm-srgb"
161
+ | "bc2-rgba-unorm"
162
+ | "bc2-rgba-unorm-srgb"
163
+ | "bc3-rgba-unorm"
164
+ | "bc3-rgba-unorm-srgb"
165
+ | "bc4-r-unorm"
166
+ | "bc4-r-snorm"
167
+ | "bc5-rg-unorm"
168
+ | "bc5-rg-snorm"
169
+ | "bc6h-rgb-ufloat"
170
+ | "bc6h-rgb-float"
171
+ | "bc7-rgba-unorm"
172
+ | "bc7-rgba-unorm-srgb"
173
+ | "etc2-rgb8unorm"
174
+ | "etc2-rgb8unorm-srgb"
175
+ | "etc2-rgb8a1unorm"
176
+ | "etc2-rgb8a1unorm-srgb"
177
+ | "etc2-rgba8unorm"
178
+ | "etc2-rgba8unorm-srgb"
179
+ | "eac-r11unorm"
180
+ | "eac-r11snorm"
181
+ | "eac-rg11unorm"
182
+ | "eac-rg11snorm"
183
+ | "astc-4x4-unorm"
184
+ | "astc-4x4-unorm-srgb"
185
+ | "astc-5x4-unorm"
186
+ | "astc-5x4-unorm-srgb"
187
+ | "astc-5x5-unorm"
188
+ | "astc-5x5-unorm-srgb"
189
+ | "astc-6x5-unorm"
190
+ | "astc-6x5-unorm-srgb"
191
+ | "astc-6x6-unorm"
192
+ | "astc-6x6-unorm-srgb"
193
+ | "astc-8x5-unorm"
194
+ | "astc-8x5-unorm-srgb"
195
+ | "astc-8x6-unorm"
196
+ | "astc-8x6-unorm-srgb"
197
+ | "astc-8x8-unorm"
198
+ | "astc-8x8-unorm-srgb"
199
+ | "astc-10x5-unorm"
200
+ | "astc-10x5-unorm-srgb"
201
+ | "astc-10x6-unorm"
202
+ | "astc-10x6-unorm-srgb"
203
+ | "astc-10x8-unorm"
204
+ | "astc-10x8-unorm-srgb"
205
+ | "astc-10x10-unorm"
206
+ | "astc-10x10-unorm-srgb"
207
+ | "astc-12x10-unorm"
208
+ | "astc-12x10-unorm-srgb"
209
+ | "astc-12x12-unorm"
210
+ | "astc-12x12-unorm-srgb";
211
+ type GPUTextureSampleType =
212
+ | "float"
213
+ | "unfilterable-float"
214
+ | "depth"
215
+ | "sint"
216
+ | "uint";
217
+ type GPUTextureViewDimension =
218
+ | "1d"
219
+ | "2d"
220
+ | "2d-array"
221
+ | "cube"
222
+ | "cube-array"
223
+ | "3d";
224
+ type GPUVertexFormat =
225
+ | "uint8x2"
226
+ | "uint8x4"
227
+ | "sint8x2"
228
+ | "sint8x4"
229
+ | "unorm8x2"
230
+ | "unorm8x4"
231
+ | "snorm8x2"
232
+ | "snorm8x4"
233
+ | "uint16x2"
234
+ | "uint16x4"
235
+ | "sint16x2"
236
+ | "sint16x4"
237
+ | "unorm16x2"
238
+ | "unorm16x4"
239
+ | "snorm16x2"
240
+ | "snorm16x4"
241
+ | "float16x2"
242
+ | "float16x4"
243
+ | "float32"
244
+ | "float32x2"
245
+ | "float32x3"
246
+ | "float32x4"
247
+ | "uint32"
248
+ | "uint32x2"
249
+ | "uint32x3"
250
+ | "uint32x4"
251
+ | "sint32"
252
+ | "sint32x2"
253
+ | "sint32x3"
254
+ | "sint32x4"
255
+ | "unorm10-10-10-2";
256
+ type GPUVertexStepMode = "vertex" | "instance";
257
+
258
+ interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase {
259
+ /**
260
+ * The {@link GPUBindGroupLayout} the entries of this bind group will conform to.
261
+ */
262
+ layout: GPUBindGroupLayout;
263
+ /**
264
+ * A list of entries describing the resources to expose to the shader for each binding
265
+ * described by the {@link GPUBindGroupDescriptor#layout}.
266
+ */
267
+ entries: Array<GPUBindGroupEntry>;
268
+ }
269
+
270
+ interface GPUBindGroupEntry {
271
+ /**
272
+ * A unique identifier for a resource binding within the {@link GPUBindGroup}, corresponding to a
273
+ * {@link GPUBindGroupLayoutEntry#binding|GPUBindGroupLayoutEntry.binding} and a @binding
274
+ * attribute in the {@link GPUShaderModule}.
275
+ */
276
+ binding: GPUIndex32;
277
+ /**
278
+ * The resource to bind, which may be a {@link GPUSampler}, {@link GPUTextureView},
279
+ * {@link GPUExternalTexture}, or {@link GPUBufferBinding}.
280
+ */
281
+ resource: GPUBindingResource;
282
+ }
283
+
284
+ interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
285
+ entries: Array<GPUBindGroupLayoutEntry>;
286
+ }
287
+
288
+ interface GPUBindGroupLayoutEntry {
289
+ /**
290
+ * A unique identifier for a resource binding within the {@link GPUBindGroupLayout}, corresponding
291
+ * to a {@link GPUBindGroupEntry#binding|GPUBindGroupEntry.binding} and a @binding
292
+ * attribute in the {@link GPUShaderModule}.
293
+ */
294
+ binding: GPUIndex32;
295
+ /**
296
+ * A bitset of the members of {@link GPUShaderStage}.
297
+ * Each set bit indicates that a {@link GPUBindGroupLayoutEntry}'s resource
298
+ * will be accessible from the associated shader stage.
299
+ */
300
+ visibility: GPUShaderStageFlags;
301
+ /**
302
+ * When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
303
+ * is {@link GPUBufferBinding}.
304
+ */
305
+ buffer?: GPUBufferBindingLayout;
306
+ /**
307
+ * When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
308
+ * is {@link GPUSampler}.
309
+ */
310
+ sampler?: GPUSamplerBindingLayout;
311
+ /**
312
+ * When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
313
+ * is {@link GPUTextureView}.
314
+ */
315
+ texture?: GPUTextureBindingLayout;
316
+ /**
317
+ * When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
318
+ * is {@link GPUTextureView}.
319
+ */
320
+ storageTexture?: GPUStorageTextureBindingLayout;
321
+ /**
322
+ * When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
323
+ * is {@link GPUExternalTexture}.
324
+ */
325
+ externalTexture?: GPUExternalTextureBindingLayout;
326
+ }
327
+
328
+ interface GPUBlendComponent {
329
+ /**
330
+ * Defines the {@link GPUBlendOperation} used to calculate the values written to the target
331
+ * attachment components.
332
+ */
333
+ operation?: GPUBlendOperation;
334
+ /**
335
+ * Defines the {@link GPUBlendFactor} operation to be performed on values from the fragment shader.
336
+ */
337
+ srcFactor?: GPUBlendFactor;
338
+ /**
339
+ * Defines the {@link GPUBlendFactor} operation to be performed on values from the target attachment.
340
+ */
341
+ dstFactor?: GPUBlendFactor;
342
+ }
343
+
344
+ interface GPUBlendState {
345
+ /**
346
+ * Defines the blending behavior of the corresponding render target for color channels.
347
+ */
348
+ color: GPUBlendComponent;
349
+ /**
350
+ * Defines the blending behavior of the corresponding render target for the alpha channel.
351
+ */
352
+ alpha: GPUBlendComponent;
353
+ }
354
+
355
+ interface GPUBufferBinding {
356
+ /**
357
+ * The {@link GPUBuffer} to bind.
358
+ */
359
+ buffer: GPUBuffer;
360
+ /**
361
+ * The offset, in bytes, from the beginning of {@link GPUBufferBinding#buffer} to the
362
+ * beginning of the range exposed to the shader by the buffer binding.
363
+ */
364
+ offset?: GPUSize64;
365
+ /**
366
+ * The size, in bytes, of the buffer binding.
367
+ * If not map/exist|provided, specifies the range starting at
368
+ * {@link GPUBufferBinding#offset} and ending at the end of {@link GPUBufferBinding#buffer}.
369
+ */
370
+ size?: GPUSize64;
371
+ }
372
+
373
+ interface GPUBufferBindingLayout {
374
+ /**
375
+ * Indicates the type required for buffers bound to this bindings.
376
+ */
377
+ type?: GPUBufferBindingType;
378
+ /**
379
+ * Indicates whether this binding requires a dynamic offset.
380
+ */
381
+ hasDynamicOffset?: boolean;
382
+ /**
383
+ * Indicates the minimum {@link GPUBufferBinding#size} of a buffer binding used with this bind point.
384
+ * Bindings are always validated against this size in {@link GPUDevice#createBindGroup}.
385
+ * If this *is not* `0`, pipeline creation additionally [$validating shader binding|validates$]
386
+ * that this value &ge; the minimum buffer binding size of the variable.
387
+ * If this *is* `0`, it is ignored by pipeline creation, and instead draw/dispatch commands
388
+ * [$Validate encoder bind groups|validate$] that each binding in the {@link GPUBindGroup}
389
+ * satisfies the minimum buffer binding size of the variable.
390
+ * Note:
391
+ * Similar execution-time validation is theoretically possible for other
392
+ * binding-related fields specified for early validation, like
393
+ * {@link GPUTextureBindingLayout#sampleType} and {@link GPUStorageTextureBindingLayout#format},
394
+ * which currently can only be validated in pipeline creation.
395
+ * However, such execution-time validation could be costly or unnecessarily complex, so it is
396
+ * available only for {@link GPUBufferBindingLayout#minBindingSize} which is expected to have the
397
+ * most ergonomic impact.
398
+ */
399
+ minBindingSize?: GPUSize64;
400
+ }
401
+
402
+ interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
403
+ /**
404
+ * The size of the buffer in bytes.
405
+ */
406
+ size: GPUSize64;
407
+ /**
408
+ * The allowed usages for the buffer.
409
+ */
410
+ usage: GPUBufferUsageFlags;
411
+ /**
412
+ * If `true` creates the buffer in an already mapped state, allowing
413
+ * {@link GPUBuffer#getMappedRange} to be called immediately. It is valid to set
414
+ * {@link GPUBufferDescriptor#mappedAtCreation} to `true` even if {@link GPUBufferDescriptor#usage}
415
+ * does not contain {@link GPUBufferUsage#MAP_READ} or {@link GPUBufferUsage#MAP_WRITE}. This can be
416
+ * used to set the buffer's initial data.
417
+ * Guarantees that even if the buffer creation eventually fails, it will still appear as if the
418
+ * mapped range can be written/read to until it is unmapped.
419
+ */
420
+ mappedAtCreation?: boolean;
421
+ }
422
+
423
+ interface GPUCanvasConfiguration {
424
+ /**
425
+ * The {@link GPUDevice} that textures returned by {@link GPUCanvasContext#getCurrentTexture} will be
426
+ * compatible with.
427
+ */
428
+ device: GPUDevice;
429
+ /**
430
+ * The format that textures returned by {@link GPUCanvasContext#getCurrentTexture} will have.
431
+ * Must be one of the Supported context formats.
432
+ */
433
+ format: GPUTextureFormat;
434
+ /**
435
+ * The usage that textures returned by {@link GPUCanvasContext#getCurrentTexture} will have.
436
+ * {@link GPUTextureUsage#RENDER_ATTACHMENT} is the default, but is not automatically included
437
+ * if the usage is explicitly set. Be sure to include {@link GPUTextureUsage#RENDER_ATTACHMENT}
438
+ * when setting a custom usage if you wish to use textures returned by
439
+ * {@link GPUCanvasContext#getCurrentTexture} as color targets for a render pass.
440
+ */
441
+ usage?: GPUTextureUsageFlags;
442
+ /**
443
+ * The formats that views created from textures returned by
444
+ * {@link GPUCanvasContext#getCurrentTexture} may use.
445
+ */
446
+ viewFormats?: Array<GPUTextureFormat>;
447
+ /**
448
+ * The color space that values written into textures returned by
449
+ * {@link GPUCanvasContext#getCurrentTexture} should be displayed with.
450
+ */
451
+ colorSpace?: PredefinedColorSpace;
452
+ /**
453
+ * Determines the effect that alpha values will have on the content of textures returned by
454
+ * {@link GPUCanvasContext#getCurrentTexture} when read, displayed, or used as an image source.
455
+ */
456
+ alphaMode?: GPUCanvasAlphaMode;
457
+ }
458
+
459
+ interface GPUColorDict {
460
+ /**
461
+ * The red channel value.
462
+ */
463
+ r: number;
464
+ /**
465
+ * The green channel value.
466
+ */
467
+ g: number;
468
+ /**
469
+ * The blue channel value.
470
+ */
471
+ b: number;
472
+ /**
473
+ * The alpha channel value.
474
+ */
475
+ a: number;
476
+ }
477
+
478
+ interface GPUColorTargetState {
479
+ /**
480
+ * The {@link GPUTextureFormat} of this color target. The pipeline will only be compatible with
481
+ * {@link GPURenderPassEncoder}s which use a {@link GPUTextureView} of this format in the
482
+ * corresponding color attachment.
483
+ */
484
+ format: GPUTextureFormat;
485
+ /**
486
+ * The blending behavior for this color target. If left undefined, disables blending for this
487
+ * color target.
488
+ */
489
+ blend?: GPUBlendState;
490
+ /**
491
+ * Bitmask controlling which channels are are written to when drawing to this color target.
492
+ */
493
+ writeMask?: GPUColorWriteFlags;
494
+ }
495
+
496
+ type GPUCommandBufferDescriptor = GPUObjectDescriptorBase;
497
+ type GPUCommandEncoderDescriptor = GPUObjectDescriptorBase;
498
+
499
+ interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
500
+ /**
501
+ * Defines which timestamp values will be written for this pass, and where to write them to.
502
+ */
503
+ timestampWrites?: GPUComputePassTimestampWrites;
504
+ }
505
+
506
+ interface GPUComputePassTimestampWrites {
507
+ /**
508
+ * The {@link GPUQuerySet}, of type {@link GPUQueryType#"timestamp"}, that the query results will be
509
+ * written to.
510
+ */
511
+ querySet: GPUQuerySet;
512
+ /**
513
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
514
+ * which the timestamp at the beginning of the compute pass will be written.
515
+ */
516
+ beginningOfPassWriteIndex?: GPUSize32;
517
+ /**
518
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
519
+ * which the timestamp at the end of the compute pass will be written.
520
+ */
521
+ endOfPassWriteIndex?: GPUSize32;
522
+ }
523
+
524
+ interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
525
+ /**
526
+ * Describes the compute shader entry point of the pipeline.
527
+ */
528
+ compute: GPUProgrammableStage;
529
+ }
530
+
531
+ interface GPUDepthStencilState {
532
+ /**
533
+ * The {@link GPUTextureViewDescriptor#format} of {@link GPURenderPassDescriptor#depthStencilAttachment}
534
+ * this {@link GPURenderPipeline} will be compatible with.
535
+ */
536
+ format: GPUTextureFormat;
537
+ /**
538
+ * Indicates if this {@link GPURenderPipeline} can modify
539
+ * {@link GPURenderPassDescriptor#depthStencilAttachment} depth values.
540
+ */
541
+ depthWriteEnabled?: boolean;
542
+ /**
543
+ * The comparison operation used to test fragment depths against
544
+ * {@link GPURenderPassDescriptor#depthStencilAttachment} depth values.
545
+ */
546
+ depthCompare?: GPUCompareFunction;
547
+ /**
548
+ * Defines how stencil comparisons and operations are performed for front-facing primitives.
549
+ */
550
+ stencilFront?: GPUStencilFaceState;
551
+ /**
552
+ * Defines how stencil comparisons and operations are performed for back-facing primitives.
553
+ */
554
+ stencilBack?: GPUStencilFaceState;
555
+ /**
556
+ * Bitmask controlling which {@link GPURenderPassDescriptor#depthStencilAttachment} stencil value
557
+ * bits are read when performing stencil comparison tests.
558
+ */
559
+ stencilReadMask?: GPUStencilValue;
560
+ /**
561
+ * Bitmask controlling which {@link GPURenderPassDescriptor#depthStencilAttachment} stencil value
562
+ * bits are written to when performing stencil operations.
563
+ */
564
+ stencilWriteMask?: GPUStencilValue;
565
+ /**
566
+ * Constant depth bias added to each fragment. See [$biased fragment depth$] for details.
567
+ */
568
+ depthBias?: GPUDepthBias;
569
+ /**
570
+ * Depth bias that scales with the fragment’s slope. See [$biased fragment depth$] for details.
571
+ */
572
+ depthBiasSlopeScale?: number;
573
+ /**
574
+ * The maximum depth bias of a fragment. See [$biased fragment depth$] for details.
575
+ */
576
+ depthBiasClamp?: number;
577
+ }
578
+
579
+ interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
580
+ /**
581
+ * Specifies the features that are required by the device request.
582
+ * The request will fail if the adapter cannot provide these features.
583
+ * Exactly the specified set of features, and no more or less, will be allowed in validation
584
+ * of API calls on the resulting device.
585
+ */
586
+ requiredFeatures?: Array<GPUFeatureName>;
587
+ /**
588
+ * Specifies the limits that are required by the device request.
589
+ * The request will fail if the adapter cannot provide these limits.
590
+ * Each key must be the name of a member of supported limits.
591
+ * Exactly the specified limits, and no limit/better or worse,
592
+ * will be allowed in validation of API calls on the resulting device.
593
+ * <!-- If we ever need limit types other than GPUSize32/GPUSize64, we can change the value
594
+ * type to `double` or `any` in the future and write out the type conversion explicitly (by
595
+ * reference to WebIDL spec). Or change the entire type to `any` and add back a `dictionary
596
+ * GPULimits` and define the conversion of the whole object by reference to WebIDL. -->
597
+ */
598
+ requiredLimits?: Record<string, GPUSize64>;
599
+ /**
600
+ * The descriptor for the default {@link GPUQueue}.
601
+ */
602
+ defaultQueue?: GPUQueueDescriptor;
603
+ }
604
+
605
+ interface GPUExtent3DDict {
606
+ /**
607
+ * The width of the extent.
608
+ */
609
+ width: GPUIntegerCoordinate;
610
+ /**
611
+ * The height of the extent.
612
+ */
613
+ height?: GPUIntegerCoordinate;
614
+ /**
615
+ * The depth of the extent or the number of array layers it contains.
616
+ * If used with a {@link GPUTexture} with a {@link GPUTextureDimension} of {@link GPUTextureDimension#"3d"}
617
+ * defines the depth of the texture. If used with a {@link GPUTexture} with a {@link GPUTextureDimension}
618
+ * of {@link GPUTextureDimension#"2d"} defines the number of array layers in the texture.
619
+ */
620
+ depthOrArrayLayers?: GPUIntegerCoordinate;
621
+ }
622
+
623
+ interface GPUExternalTextureBindingLayout {}
624
+
625
+ interface GPUExternalTextureDescriptor extends GPUObjectDescriptorBase {
626
+ source: HTMLVideoElement | VideoFrame;
627
+ colorSpace?: PredefinedColorSpace;
628
+ }
629
+
630
+ interface GPUFragmentState extends GPUProgrammableStage {
631
+ /**
632
+ * A list of {@link GPUColorTargetState} defining the formats and behaviors of the color targets
633
+ * this pipeline writes to.
634
+ */
635
+ targets: Array<GPUColorTargetState | null>;
636
+ }
637
+
638
+ interface GPUImageCopyBuffer extends GPUImageDataLayout {
639
+ /**
640
+ * A buffer which either contains image data to be copied or will store the image data being
641
+ * copied, depending on the method it is being passed to.
642
+ */
643
+ buffer: GPUBuffer;
644
+ }
645
+
646
+ interface GPUImageCopyExternalImage {
647
+ /**
648
+ * The source of the image copy. The copy source data is captured at the moment that
649
+ * {@link GPUQueue#copyExternalImageToTexture} is issued. Source size is defined by source
650
+ * type, given by this table:
651
+ *
652
+ * <table class=data>
653
+ * <thead>
654
+ * <tr>
655
+ * <th>Source type
656
+ * <th>Width
657
+ * <th>Height
658
+ * </thead>
659
+ * <tbody>
660
+ * <tr>
661
+ * <td>{@link ImageBitmap}
662
+ * <td>{@link ImageBitmap#width|ImageBitmap.width}
663
+ * <td>{@link ImageBitmap#height|ImageBitmap.height}
664
+ * <tr>
665
+ * <td>{@link HTMLVideoElement}
666
+ * <td>video/intrinsic width|intrinsic width of the frame
667
+ * <td>video/intrinsic height|intrinsic height of the frame
668
+ * <tr>
669
+ * <td>{@link VideoFrame}
670
+ * <td>{@link VideoFrame#codedWidth|VideoFrame.codedWidth}
671
+ * <td>{@link VideoFrame#codedHeight|VideoFrame.codedHeight}
672
+ * <tr>
673
+ * <td>{@link HTMLCanvasElement}
674
+ * <td>{@link HTMLCanvasElement#width|HTMLCanvasElement.width}
675
+ * <td>{@link HTMLCanvasElement#height|HTMLCanvasElement.height}
676
+ * <tr>
677
+ * <td>{@link OffscreenCanvas}
678
+ * <td>{@link OffscreenCanvas#width|OffscreenCanvas.width}
679
+ * <td>{@link OffscreenCanvas#height|OffscreenCanvas.height}
680
+ * </tbody>
681
+ * </table>
682
+ */
683
+ source: GPUImageCopyExternalImageSource;
684
+ /**
685
+ * Defines the origin of the copy - the minimum (top-left) corner of the source sub-region to copy from.
686
+ * Together with `copySize`, defines the full copy sub-region.
687
+ */
688
+ origin?: GPUOrigin2D;
689
+ /**
690
+ * Describes whether the source image is vertically flipped, or not.
691
+ * If this option is set to `true`, the copy is flipped vertically: the bottom row of the source
692
+ * region is copied into the first row of the destination region, and so on.
693
+ * The {@link GPUImageCopyExternalImage#origin} option is still relative to the top-left corner
694
+ * of the source image, increasing downward.
695
+ */
696
+ flipY?: boolean;
697
+ }
698
+
699
+ interface GPUImageCopyTexture {
700
+ /**
701
+ * Texture to copy to/from.
702
+ */
703
+ texture: GPUTexture;
704
+ /**
705
+ * Mip-map level of the {@link GPUImageCopyTexture#texture} to copy to/from.
706
+ */
707
+ mipLevel?: GPUIntegerCoordinate;
708
+ /**
709
+ * Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from.
710
+ * Together with `copySize`, defines the full copy sub-region.
711
+ */
712
+ origin?: GPUOrigin3D;
713
+ /**
714
+ * Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from.
715
+ */
716
+ aspect?: GPUTextureAspect;
717
+ }
718
+
719
+ interface GPUImageCopyTextureTagged extends GPUImageCopyTexture {
720
+ /**
721
+ * Describes the color space and encoding used to encode data into the destination texture.
722
+ * This [[#color-space-conversions|may result]] in values outside of the range [0, 1]
723
+ * being written to the target texture, if its format can represent them.
724
+ * Otherwise, the results are clamped to the target texture format's range.
725
+ * Note:
726
+ * If {@link GPUImageCopyTextureTagged#colorSpace} matches the source image,
727
+ * conversion may not be necessary. See [[#color-space-conversion-elision]].
728
+ */
729
+ colorSpace?: PredefinedColorSpace;
730
+ /**
731
+ * Describes whether the data written into the texture should have its RGB channels
732
+ * premultiplied by the alpha channel, or not.
733
+ * If this option is set to `true` and the {@link GPUImageCopyExternalImage#source} is also
734
+ * premultiplied, the source RGB values must be preserved even if they exceed their
735
+ * corresponding alpha values.
736
+ * Note:
737
+ * If {@link GPUImageCopyTextureTagged#premultipliedAlpha} matches the source image,
738
+ * conversion may not be necessary. See [[#color-space-conversion-elision]].
739
+ */
740
+ premultipliedAlpha?: boolean;
741
+ }
742
+
743
+ interface GPUImageDataLayout {
744
+ /**
745
+ * The offset, in bytes, from the beginning of the image data source (such as a
746
+ * {@link GPUImageCopyBuffer#buffer|GPUImageCopyBuffer.buffer}) to the start of the image data
747
+ * within that source.
748
+ */
749
+ offset?: GPUSize64;
750
+ /**
751
+ * The stride, in bytes, between the beginning of each block row and the subsequent block row.
752
+ * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).
753
+ */
754
+ bytesPerRow?: GPUSize32;
755
+ /**
756
+ * Number of block rows per single image of the texture.
757
+ * {@link GPUImageDataLayout#rowsPerImage} &times;
758
+ * {@link GPUImageDataLayout#bytesPerRow} is the stride, in bytes, between the beginning of each image of data and the subsequent image.
759
+ * Required if there are multiple images (i.e. the copy depth is more than one).
760
+ */
761
+ rowsPerImage?: GPUSize32;
762
+ }
763
+
764
+ interface GPUMultisampleState {
765
+ /**
766
+ * Number of samples per pixel. This {@link GPURenderPipeline} will be compatible only
767
+ * with attachment textures ({@link GPURenderPassDescriptor#colorAttachments}
768
+ * and {@link GPURenderPassDescriptor#depthStencilAttachment})
769
+ * with matching {@link GPUTextureDescriptor#sampleCount}s.
770
+ */
771
+ count?: GPUSize32;
772
+ /**
773
+ * Mask determining which samples are written to.
774
+ */
775
+ mask?: GPUSampleMask;
776
+ /**
777
+ * When `true` indicates that a fragment's alpha channel should be used to generate a sample
778
+ * coverage mask.
779
+ */
780
+ alphaToCoverageEnabled?: boolean;
781
+ }
782
+
783
+ interface GPUObjectDescriptorBase {
784
+ /**
785
+ * The initial value of {@link GPUObjectBase#label|GPUObjectBase.label}.
786
+ */
787
+ label?: string;
788
+ }
789
+
790
+ interface GPUOrigin2DDict {
791
+ x?: GPUIntegerCoordinate;
792
+ y?: GPUIntegerCoordinate;
793
+ }
794
+
795
+ interface GPUOrigin3DDict {
796
+ x?: GPUIntegerCoordinate;
797
+ y?: GPUIntegerCoordinate;
798
+ z?: GPUIntegerCoordinate;
799
+ }
800
+
801
+ interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
802
+ /**
803
+ * The {@link GPUPipelineLayout} for this pipeline, or {@link GPUAutoLayoutMode#"auto"} to generate
804
+ * the pipeline layout automatically.
805
+ * Note: If {@link GPUAutoLayoutMode#"auto"} is used the pipeline cannot share {@link GPUBindGroup}s
806
+ * with any other pipelines.
807
+ */
808
+ layout: GPUPipelineLayout | GPUAutoLayoutMode;
809
+ }
810
+
811
+ interface GPUPipelineErrorInit {
812
+ reason: GPUPipelineErrorReason;
813
+ }
814
+
815
+ interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase {
816
+ /**
817
+ * A list of {@link GPUBindGroupLayout}s the pipeline will use. Each element corresponds to a
818
+ * @group attribute in the {@link GPUShaderModule}, with the `N`th element corresponding with
819
+ * `@group(N)`.
820
+ */
821
+ bindGroupLayouts: Array<GPUBindGroupLayout>;
822
+ }
823
+
824
+ interface GPUPrimitiveState {
825
+ /**
826
+ * The type of primitive to be constructed from the vertex inputs.
827
+ */
828
+ topology?: GPUPrimitiveTopology;
829
+ /**
830
+ * For pipelines with strip topologies
831
+ * ({@link GPUPrimitiveTopology#"line-strip"} or {@link GPUPrimitiveTopology#"triangle-strip"}),
832
+ * this determines the index buffer format and primitive restart value
833
+ * ({@link GPUIndexFormat#"uint16"}/`0xFFFF` or {@link GPUIndexFormat#"uint32"}/`0xFFFFFFFF`).
834
+ * It is not allowed on pipelines with non-strip topologies.
835
+ * Note: Some implementations require knowledge of the primitive restart value to compile
836
+ * pipeline state objects.
837
+ * To use a strip-topology pipeline with an indexed draw call
838
+ * ({@link GPURenderCommandsMixin#drawIndexed()} or {@link GPURenderCommandsMixin#drawIndexedIndirect}),
839
+ * this must be set, and it must match the index buffer format used with the draw call
840
+ * (set in {@link GPURenderCommandsMixin#setIndexBuffer}).
841
+ * See [[#primitive-assembly]] for additional details.
842
+ */
843
+ stripIndexFormat?: GPUIndexFormat;
844
+ /**
845
+ * Defines which polygons are considered front-facing.
846
+ */
847
+ frontFace?: GPUFrontFace;
848
+ /**
849
+ * Defines which polygon orientation will be culled, if any.
850
+ */
851
+ cullMode?: GPUCullMode;
852
+ /**
853
+ * If true, indicates that depth clipping is disabled.
854
+ * Requires the {@link GPUFeatureName#"depth-clip-control"} feature to be enabled.
855
+ */
856
+ unclippedDepth?: boolean;
857
+ }
858
+
859
+ interface GPUProgrammableStage {
860
+ /**
861
+ * The {@link GPUShaderModule} containing the code that this programmable stage will execute.
862
+ */
863
+ module: GPUShaderModule;
864
+ /**
865
+ * The name of the function in {@link GPUProgrammableStage#module} that this stage will use to
866
+ * perform its work.
867
+ */
868
+ entryPoint?: string;
869
+ /**
870
+ * Specifies the values of pipeline-overridable constants in the shader module
871
+ * {@link GPUProgrammableStage#module}.
872
+ * Each such pipeline-overridable constant is uniquely identified by a single
873
+ * pipeline-overridable constant identifier string (representing the numeric ID of the
874
+ * constant, if one is specified, and otherwise the constant's identifier name).
875
+ * WGSL names (identifiers) in source maps follow the rules defined in WGSL identifier comparison.
876
+ * The key of each key-value pair must equal the identifier string of one such constant.
877
+ * When the pipeline is executed, that constant will have the specified value.
878
+ * Values are specified as <dfn typedef for="">GPUPipelineConstantValue</dfn>, which is a {@link double}.
879
+ * They are converted [$to WGSL type$] of the pipeline-overridable constant (`bool`/`i32`/`u32`/`f32`/`f16`).
880
+ * If conversion fails, a validation error is generated.
881
+ * <div class=example>
882
+ * Pipeline-overridable constants defined in WGSL:
883
+ * <pre highlight=wgsl>
884
+ * @id(0) override has_point_light: bool = true; // Algorithmic control.
885
+ * @id(1200) override specular_param: f32 = 2.3; // Numeric control.
886
+ * @id(1300) override gain: f32; // Must be overridden.
887
+ * override width: f32 = 0.0; // Specifed at the API level
888
+ * // using the name "width".
889
+ * override depth: f32; // Specifed at the API level
890
+ * // using the name "depth".
891
+ * // Must be overridden.
892
+ * override height = 2 * depth; // The default value
893
+ * // (if not set at the API level),
894
+ * // depends on another
895
+ * // overridable constant.
896
+ * </pre>
897
+ * Corresponding JavaScript code, providing only the overrides which are required
898
+ * (have no defaults):
899
+ * <pre highlight=js>
900
+ * {
901
+ * // ...
902
+ * constants: {
903
+ * 1300: 2.0, // "gain"
904
+ * depth: -1, // "depth"
905
+ * }
906
+ * }
907
+ * </pre>
908
+ * Corresponding JavaScript code, overriding all constants:
909
+ * <pre highlight=js>
910
+ * {
911
+ * // ...
912
+ * constants: {
913
+ * 0: false, // "has_point_light"
914
+ * 1200: 3.0, // "specular_param"
915
+ * 1300: 2.0, // "gain"
916
+ * width: 20, // "width"
917
+ * depth: -1, // "depth"
918
+ * height: 15, // "height"
919
+ * }
920
+ * }
921
+ * </pre>
922
+ * </div>
923
+ */
924
+ constants?: Record<string, GPUPipelineConstantValue>;
925
+ }
926
+
927
+ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
928
+ /**
929
+ * The type of queries managed by {@link GPUQuerySet}.
930
+ */
931
+ type: GPUQueryType;
932
+ /**
933
+ * The number of queries managed by {@link GPUQuerySet}.
934
+ */
935
+ count: GPUSize32;
936
+ }
937
+
938
+ type GPUQueueDescriptor = GPUObjectDescriptorBase;
939
+ type GPURenderBundleDescriptor = GPUObjectDescriptorBase;
940
+
941
+ interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout {
942
+ /**
943
+ * If `true`, indicates that the render bundle does not modify the depth component of the
944
+ * {@link GPURenderPassDepthStencilAttachment} of any render pass the render bundle is executed
945
+ * in.
946
+ */
947
+ depthReadOnly?: boolean;
948
+ /**
949
+ * If `true`, indicates that the render bundle does not modify the stencil component of the
950
+ * {@link GPURenderPassDepthStencilAttachment} of any render pass the render bundle is executed
951
+ * in.
952
+ */
953
+ stencilReadOnly?: boolean;
954
+ }
955
+
956
+ interface GPURenderPassColorAttachment {
957
+ /**
958
+ * A {@link GPUTextureView} describing the texture subresource that will be output to for this
959
+ * color attachment.
960
+ */
961
+ view: GPUTextureView;
962
+ /**
963
+ * Indicates the depth slice index of {@link GPUTextureViewDimension#"3d"} {@link GPURenderPassColorAttachment#view}
964
+ * that will be output to for this color attachment.
965
+ */
966
+ depthSlice?: GPUIntegerCoordinate;
967
+ /**
968
+ * A {@link GPUTextureView} describing the texture subresource that will receive the resolved
969
+ * output for this color attachment if {@link GPURenderPassColorAttachment#view} is
970
+ * multisampled.
971
+ */
972
+ resolveTarget?: GPUTextureView;
973
+ /**
974
+ * Indicates the value to clear {@link GPURenderPassColorAttachment#view} to prior to executing the
975
+ * render pass. If not map/exist|provided, defaults to `{r: 0, g: 0, b: 0, a: 0}`. Ignored
976
+ * if {@link GPURenderPassColorAttachment#loadOp} is not {@link GPULoadOp#"clear"}.
977
+ * The components of {@link GPURenderPassColorAttachment#clearValue} are all double values.
978
+ * They are converted [$to a texel value of texture format$] matching the render attachment.
979
+ * If conversion fails, a validation error is generated.
980
+ */
981
+ clearValue?: GPUColor;
982
+ /**
983
+ * Indicates the load operation to perform on {@link GPURenderPassColorAttachment#view} prior to
984
+ * executing the render pass.
985
+ * Note: It is recommended to prefer clearing; see {@link GPULoadOp#"clear"} for details.
986
+ */
987
+ loadOp: GPULoadOp;
988
+ /**
989
+ * The store operation to perform on {@link GPURenderPassColorAttachment#view}
990
+ * after executing the render pass.
991
+ */
992
+ storeOp: GPUStoreOp;
993
+ }
994
+
995
+ interface GPURenderPassDepthStencilAttachment {
996
+ /**
997
+ * A {@link GPUTextureView} describing the texture subresource that will be output to
998
+ * and read from for this depth/stencil attachment.
999
+ */
1000
+ view: GPUTextureView;
1001
+ /**
1002
+ * Indicates the value to clear {@link GPURenderPassDepthStencilAttachment#view}'s depth component
1003
+ * to prior to executing the render pass. Ignored if {@link GPURenderPassDepthStencilAttachment#depthLoadOp}
1004
+ * is not {@link GPULoadOp#"clear"}. Must be between 0.0 and 1.0, inclusive.
1005
+ * <!-- POSTV1(unrestricted-depth): unless unrestricted depth is enabled -->
1006
+ */
1007
+ depthClearValue?: number;
1008
+ /**
1009
+ * Indicates the load operation to perform on {@link GPURenderPassDepthStencilAttachment#view}'s
1010
+ * depth component prior to executing the render pass.
1011
+ * Note: It is recommended to prefer clearing; see {@link GPULoadOp#"clear"} for details.
1012
+ */
1013
+ depthLoadOp?: GPULoadOp;
1014
+ /**
1015
+ * The store operation to perform on {@link GPURenderPassDepthStencilAttachment#view}'s
1016
+ * depth component after executing the render pass.
1017
+ */
1018
+ depthStoreOp?: GPUStoreOp;
1019
+ /**
1020
+ * Indicates that the depth component of {@link GPURenderPassDepthStencilAttachment#view}
1021
+ * is read only.
1022
+ */
1023
+ depthReadOnly?: boolean;
1024
+ /**
1025
+ * Indicates the value to clear {@link GPURenderPassDepthStencilAttachment#view}'s stencil component
1026
+ * to prior to executing the render pass. Ignored if {@link GPURenderPassDepthStencilAttachment#stencilLoadOp}
1027
+ * is not {@link GPULoadOp#"clear"}.
1028
+ * The value will be converted to the type of the stencil aspect of `view` by taking the same
1029
+ * number of LSBs as the number of bits in the stencil aspect of one texel block of `view`.
1030
+ */
1031
+ stencilClearValue?: GPUStencilValue;
1032
+ /**
1033
+ * Indicates the load operation to perform on {@link GPURenderPassDepthStencilAttachment#view}'s
1034
+ * stencil component prior to executing the render pass.
1035
+ * Note: It is recommended to prefer clearing; see {@link GPULoadOp#"clear"} for details.
1036
+ */
1037
+ stencilLoadOp?: GPULoadOp;
1038
+ /**
1039
+ * The store operation to perform on {@link GPURenderPassDepthStencilAttachment#view}'s
1040
+ * stencil component after executing the render pass.
1041
+ */
1042
+ stencilStoreOp?: GPUStoreOp;
1043
+ /**
1044
+ * Indicates that the stencil component of {@link GPURenderPassDepthStencilAttachment#view}
1045
+ * is read only.
1046
+ */
1047
+ stencilReadOnly?: boolean;
1048
+ }
1049
+
1050
+ interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
1051
+ /**
1052
+ * The set of {@link GPURenderPassColorAttachment} values in this sequence defines which
1053
+ * color attachments will be output to when executing this render pass.
1054
+ * Due to compatible usage list|usage compatibility, no color attachment
1055
+ * may alias another attachment or any resource used inside the render pass.
1056
+ */
1057
+ colorAttachments: Array<GPURenderPassColorAttachment | null>;
1058
+ /**
1059
+ * The {@link GPURenderPassDepthStencilAttachment} value that defines the depth/stencil
1060
+ * attachment that will be output to and tested against when executing this render pass.
1061
+ * Due to compatible usage list|usage compatibility, no writable depth/stencil attachment
1062
+ * may alias another attachment or any resource used inside the render pass.
1063
+ */
1064
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
1065
+ /**
1066
+ * The {@link GPUQuerySet} value defines where the occlusion query results will be stored for this pass.
1067
+ */
1068
+ occlusionQuerySet?: GPUQuerySet;
1069
+ /**
1070
+ * Defines which timestamp values will be written for this pass, and where to write them to.
1071
+ */
1072
+ timestampWrites?: GPURenderPassTimestampWrites;
1073
+ /**
1074
+ * The maximum number of draw calls that will be done in the render pass. Used by some
1075
+ * implementations to size work injected before the render pass. Keeping the default value
1076
+ * is a good default, unless it is known that more draw calls will be done.
1077
+ */
1078
+ maxDrawCount?: GPUSize64;
1079
+ }
1080
+
1081
+ interface GPURenderPassLayout extends GPUObjectDescriptorBase {
1082
+ /**
1083
+ * A list of the {@link GPUTextureFormat}s of the color attachments for this pass or bundle.
1084
+ */
1085
+ colorFormats: Array<GPUTextureFormat | null>;
1086
+ /**
1087
+ * The {@link GPUTextureFormat} of the depth/stencil attachment for this pass or bundle.
1088
+ */
1089
+ depthStencilFormat?: GPUTextureFormat;
1090
+ /**
1091
+ * Number of samples per pixel in the attachments for this pass or bundle.
1092
+ */
1093
+ sampleCount?: GPUSize32;
1094
+ }
1095
+
1096
+ interface GPURenderPassTimestampWrites {
1097
+ /**
1098
+ * The {@link GPUQuerySet}, of type {@link GPUQueryType#"timestamp"}, that the query results will be
1099
+ * written to.
1100
+ */
1101
+ querySet: GPUQuerySet;
1102
+ /**
1103
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
1104
+ * which the timestamp at the beginning of the render pass will be written.
1105
+ */
1106
+ beginningOfPassWriteIndex?: GPUSize32;
1107
+ /**
1108
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
1109
+ * which the timestamp at the end of the render pass will be written.
1110
+ */
1111
+ endOfPassWriteIndex?: GPUSize32;
1112
+ }
1113
+
1114
+ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
1115
+ /**
1116
+ * Describes the vertex shader entry point of the pipeline and its input buffer layouts.
1117
+ */
1118
+ vertex: GPUVertexState;
1119
+ /**
1120
+ * Describes the primitive-related properties of the pipeline.
1121
+ */
1122
+ primitive?: GPUPrimitiveState;
1123
+ /**
1124
+ * Describes the optional depth-stencil properties, including the testing, operations, and bias.
1125
+ */
1126
+ depthStencil?: GPUDepthStencilState;
1127
+ /**
1128
+ * Describes the multi-sampling properties of the pipeline.
1129
+ */
1130
+ multisample?: GPUMultisampleState;
1131
+ /**
1132
+ * Describes the fragment shader entry point of the pipeline and its output colors. If
1133
+ * not map/exist|provided, the [[#no-color-output]] mode is enabled.
1134
+ */
1135
+ fragment?: GPUFragmentState;
1136
+ }
1137
+
1138
+ interface GPURequestAdapterOptions {
1139
+ powerPreference?: GPUPowerPreference;
1140
+ forceFallbackAdapter?: boolean;
1141
+ }
1142
+
1143
+ interface GPUSamplerBindingLayout {
1144
+ /**
1145
+ * Indicates the required type of a sampler bound to this bindings.
1146
+ */
1147
+ type?: GPUSamplerBindingType;
1148
+ }
1149
+
1150
+ interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
1151
+ /**
1152
+ */
1153
+ addressModeU?: GPUAddressMode;
1154
+ /**
1155
+ */
1156
+ addressModeV?: GPUAddressMode;
1157
+ /**
1158
+ * Specifies the {{GPUAddressMode|address modes}} for the texture width, height, and depth
1159
+ * coordinates, respectively.
1160
+ */
1161
+ addressModeW?: GPUAddressMode;
1162
+ /**
1163
+ * Specifies the sampling behavior when the sample footprint is smaller than or equal to one
1164
+ * texel.
1165
+ */
1166
+ magFilter?: GPUFilterMode;
1167
+ /**
1168
+ * Specifies the sampling behavior when the sample footprint is larger than one texel.
1169
+ */
1170
+ minFilter?: GPUFilterMode;
1171
+ /**
1172
+ * Specifies behavior for sampling between mipmap levels.
1173
+ */
1174
+ mipmapFilter?: GPUMipmapFilterMode;
1175
+ /**
1176
+ */
1177
+ lodMinClamp?: number;
1178
+ /**
1179
+ * Specifies the minimum and maximum levels of detail, respectively, used internally when
1180
+ * sampling a texture.
1181
+ */
1182
+ lodMaxClamp?: number;
1183
+ /**
1184
+ * When provided the sampler will be a comparison sampler with the specified
1185
+ * {@link GPUCompareFunction}.
1186
+ * Note: Comparison samplers may use filtering, but the sampling results will be
1187
+ * implementation-dependent and may differ from the normal filtering rules.
1188
+ */
1189
+ compare?: GPUCompareFunction;
1190
+ /**
1191
+ * Specifies the maximum anisotropy value clamp used by the sampler.
1192
+ * Note: Most implementations support {@link GPUSamplerDescriptor#maxAnisotropy} values in range
1193
+ * between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor#maxAnisotropy} will
1194
+ * be clamped to the maximum value that the platform supports.
1195
+ */
1196
+ maxAnisotropy?: number;
1197
+ }
1198
+
1199
+ interface GPUShaderModuleCompilationHint {
1200
+ entryPoint: string;
1201
+ /**
1202
+ * A {@link GPUPipelineLayout} that the {@link GPUShaderModule} may be used with in a future
1203
+ * {@link GPUDevice#createComputePipeline()} or {@link GPUDevice#createRenderPipeline} call.
1204
+ * If set to {@link GPUAutoLayoutMode#"auto"} the layout will be the [$default pipeline layout$]
1205
+ * for the entry point associated with this hint will be used.
1206
+ */
1207
+ layout?: GPUPipelineLayout | GPUAutoLayoutMode;
1208
+ }
1209
+
1210
+ interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase {
1211
+ /**
1212
+ * The <a href="https://gpuweb.github.io/gpuweb/wgsl/">WGSL</a> source code for the shader
1213
+ * module.
1214
+ */
1215
+ code: string;
1216
+ /**
1217
+ * If defined MAY be interpreted as a source-map-v3 format.
1218
+ * Source maps are optional, but serve as a standardized way to support dev-tool
1219
+ * integration such as source-language debugging [[SourceMap]].
1220
+ * WGSL names (identifiers) in source maps follow the rules defined in WGSL identifier
1221
+ * comparison.
1222
+ */
1223
+ sourceMap?: any;
1224
+ /**
1225
+ * A list of {@link GPUShaderModuleCompilationHint}s.
1226
+ * Any hint provided by an application **should** contain information about one entry point of
1227
+ * a pipeline that will eventually be created from the entry point.
1228
+ * Implementations **should** use any information present in the {@link GPUShaderModuleCompilationHint}
1229
+ * to perform as much compilation as is possible within {@link GPUDevice#createShaderModule}.
1230
+ * Aside from type-checking, these hints are not validated in any way.
1231
+ * <div class=note heading>
1232
+ * Supplying information in {@link GPUShaderModuleDescriptor#compilationHints} does not have any
1233
+ * observable effect, other than performance. It may be detrimental to performance to
1234
+ * provide hints for pipelines that never end up being created.
1235
+ * Because a single shader module can hold
1236
+ * multiple entry points, and multiple pipelines can be created from a single shader
1237
+ * module, it can be more performant for an implementation to do as much compilation as
1238
+ * possible once in {@link GPUDevice#createShaderModule} rather than multiple times in
1239
+ * the multiple calls to {@link GPUDevice#createComputePipeline} or
1240
+ * {@link GPUDevice#createRenderPipeline}.
1241
+ * </div>
1242
+ * Note:
1243
+ * Hints are not validated in an observable way, but user agents **may** surface identifiable
1244
+ * errors (like unknown entry point names or incompatible pipeline layouts) to developers,
1245
+ * for example in the browser developer console.
1246
+ */
1247
+ compilationHints?: Array<GPUShaderModuleCompilationHint>;
1248
+ }
1249
+
1250
+ interface GPUStencilFaceState {
1251
+ /**
1252
+ * The {@link GPUCompareFunction} used when testing fragments against
1253
+ * {@link GPURenderPassDescriptor#depthStencilAttachment} stencil values.
1254
+ */
1255
+ compare?: GPUCompareFunction;
1256
+ /**
1257
+ * The {@link GPUStencilOperation} performed if the fragment stencil comparison test described by
1258
+ * {@link GPUStencilFaceState#compare} fails.
1259
+ */
1260
+ failOp?: GPUStencilOperation;
1261
+ /**
1262
+ * The {@link GPUStencilOperation} performed if the fragment depth comparison described by
1263
+ * {@link GPUDepthStencilState#depthCompare} fails.
1264
+ */
1265
+ depthFailOp?: GPUStencilOperation;
1266
+ /**
1267
+ * The {@link GPUStencilOperation} performed if the fragment stencil comparison test described by
1268
+ * {@link GPUStencilFaceState#compare} passes.
1269
+ */
1270
+ passOp?: GPUStencilOperation;
1271
+ }
1272
+
1273
+ interface GPUStorageTextureBindingLayout {
1274
+ /**
1275
+ * The access mode for this binding, indicating readability and writability.
1276
+ */
1277
+ access?: GPUStorageTextureAccess;
1278
+ /**
1279
+ * The required {@link GPUTextureViewDescriptor#format} of texture views bound to this binding.
1280
+ */
1281
+ format: GPUTextureFormat;
1282
+ /**
1283
+ * Indicates the required {@link GPUTextureViewDescriptor#dimension} for texture views bound to
1284
+ * this binding.
1285
+ */
1286
+ viewDimension?: GPUTextureViewDimension;
1287
+ }
1288
+
1289
+ interface GPUTextureBindingLayout {
1290
+ /**
1291
+ * Indicates the type required for texture views bound to this binding.
1292
+ */
1293
+ sampleType?: GPUTextureSampleType;
1294
+ /**
1295
+ * Indicates the required {@link GPUTextureViewDescriptor#dimension} for texture views bound to
1296
+ * this binding.
1297
+ */
1298
+ viewDimension?: GPUTextureViewDimension;
1299
+ /**
1300
+ * Indicates whether or not texture views bound to this binding must be multisampled.
1301
+ */
1302
+ multisampled?: boolean;
1303
+ }
1304
+
1305
+ interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
1306
+ /**
1307
+ * The width, height, and depth or layer count of the texture.
1308
+ */
1309
+ size: GPUExtent3D;
1310
+ /**
1311
+ * The number of mip levels the texture will contain.
1312
+ */
1313
+ mipLevelCount?: GPUIntegerCoordinate;
1314
+ /**
1315
+ * The sample count of the texture. A {@link GPUTextureDescriptor#sampleCount} &gt; `1` indicates
1316
+ * a multisampled texture.
1317
+ */
1318
+ sampleCount?: GPUSize32;
1319
+ /**
1320
+ * Whether the texture is one-dimensional, an array of two-dimensional layers, or three-dimensional.
1321
+ */
1322
+ dimension?: GPUTextureDimension;
1323
+ /**
1324
+ * The format of the texture.
1325
+ */
1326
+ format: GPUTextureFormat;
1327
+ /**
1328
+ * The allowed usages for the texture.
1329
+ */
1330
+ usage: GPUTextureUsageFlags;
1331
+ /**
1332
+ * Specifies what view {@link GPUTextureViewDescriptor#format} values will be allowed when calling
1333
+ * {@link GPUTexture#createView} on this texture (in addition to the texture's actual
1334
+ * {@link GPUTextureDescriptor#format}).
1335
+ * <div class=note heading>
1336
+ * Adding a format to this list may have a significant performance impact, so it is best
1337
+ * to avoid adding formats unnecessarily.
1338
+ * The actual performance impact is highly dependent on the target system; developers must
1339
+ * test various systems to find out the impact on their particular application.
1340
+ * For example, on some systems any texture with a {@link GPUTextureDescriptor#format} or
1341
+ * {@link GPUTextureDescriptor#viewFormats} entry including
1342
+ * {@link GPUTextureFormat#"rgba8unorm-srgb"} will perform less optimally than a
1343
+ * {@link GPUTextureFormat#"rgba8unorm"} texture which does not.
1344
+ * Similar caveats exist for other formats and pairs of formats on other systems.
1345
+ * </div>
1346
+ * Formats in this list must be texture view format compatible with the texture format.
1347
+ * <div algorithm>
1348
+ * Two {@link GPUTextureFormat}s `format` and `viewFormat` are <dfn dfn for="">texture view format compatible</dfn> if:
1349
+ * - `format` equals `viewFormat`, or
1350
+ * - `format` and `viewFormat` differ only in whether they are `srgb` formats (have the `-srgb` suffix).
1351
+ * </div>
1352
+ */
1353
+ viewFormats?: Array<GPUTextureFormat>;
1354
+ }
1355
+
1356
+ interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
1357
+ /**
1358
+ * The format of the texture view. Must be either the {@link GPUTextureDescriptor#format} of the
1359
+ * texture or one of the {@link GPUTextureDescriptor#viewFormats} specified during its creation.
1360
+ */
1361
+ format?: GPUTextureFormat;
1362
+ /**
1363
+ * The dimension to view the texture as.
1364
+ */
1365
+ dimension?: GPUTextureViewDimension;
1366
+ /**
1367
+ * Which {@link GPUTextureAspect|aspect(s)} of the texture are accessible to the texture view.
1368
+ */
1369
+ aspect?: GPUTextureAspect;
1370
+ /**
1371
+ * The first (most detailed) mipmap level accessible to the texture view.
1372
+ */
1373
+ baseMipLevel?: GPUIntegerCoordinate;
1374
+ /**
1375
+ * How many mipmap levels, starting with {@link GPUTextureViewDescriptor#baseMipLevel}, are accessible to
1376
+ * the texture view.
1377
+ */
1378
+ mipLevelCount?: GPUIntegerCoordinate;
1379
+ /**
1380
+ * The index of the first array layer accessible to the texture view.
1381
+ */
1382
+ baseArrayLayer?: GPUIntegerCoordinate;
1383
+ /**
1384
+ * How many array layers, starting with {@link GPUTextureViewDescriptor#baseArrayLayer}, are accessible
1385
+ * to the texture view.
1386
+ */
1387
+ arrayLayerCount?: GPUIntegerCoordinate;
1388
+ }
1389
+
1390
+ interface GPUUncapturedErrorEventInit extends EventInit {
1391
+ error: GPUError;
1392
+ }
1393
+
1394
+ interface GPUVertexAttribute {
1395
+ /**
1396
+ * The {@link GPUVertexFormat} of the attribute.
1397
+ */
1398
+ format: GPUVertexFormat;
1399
+ /**
1400
+ * The offset, in bytes, from the beginning of the element to the data for the attribute.
1401
+ */
1402
+ offset: GPUSize64;
1403
+ /**
1404
+ * The numeric location associated with this attribute, which will correspond with a
1405
+ * <a href="https://gpuweb.github.io/gpuweb/wgsl/#input-output-locations">"@location" attribute</a>
1406
+ * declared in the {@link GPURenderPipelineDescriptor#vertex}.{@link GPUProgrammableStage#module|module}.
1407
+ */
1408
+ shaderLocation: GPUIndex32;
1409
+ }
1410
+
1411
+ interface GPUVertexBufferLayout {
1412
+ /**
1413
+ * The stride, in bytes, between elements of this array.
1414
+ */
1415
+ arrayStride: GPUSize64;
1416
+ /**
1417
+ * Whether each element of this array represents per-vertex data or per-instance data
1418
+ */
1419
+ stepMode?: GPUVertexStepMode;
1420
+ /**
1421
+ * An array defining the layout of the vertex attributes within each element.
1422
+ */
1423
+ attributes: Array<GPUVertexAttribute>;
1424
+ }
1425
+
1426
+ interface GPUVertexState extends GPUProgrammableStage {
1427
+ /**
1428
+ * A list of {@link GPUVertexBufferLayout}s, each defining the layout of vertex attribute data in a
1429
+ * vertex buffer used by this pipeline.
1430
+ */
1431
+ buffers?: Array<GPUVertexBufferLayout | null>;
1432
+ }
1433
+
1434
+ interface GPUBindingCommandsMixin {
1435
+ /**
1436
+ * Sets the current {@link GPUBindGroup} for the given index.
1437
+ */
1438
+ setBindGroup(
1439
+ index: GPUIndex32,
1440
+ bindGroup: GPUBindGroup | null,
1441
+ dynamicOffsets?: Array<GPUBufferDynamicOffset>,
1442
+ ): undefined;
1443
+ setBindGroup(
1444
+ index: GPUIndex32,
1445
+ bindGroup: GPUBindGroup | null,
1446
+ dynamicOffsetsData: Uint32Array,
1447
+ dynamicOffsetsDataStart: GPUSize64,
1448
+ dynamicOffsetsDataLength: GPUSize32,
1449
+ ): undefined;
1450
+ }
1451
+
1452
+ interface GPUCommandsMixin {}
1453
+
1454
+ interface GPUDebugCommandsMixin {
1455
+ /**
1456
+ * Begins a labeled debug group containing subsequent commands.
1457
+ * @param groupLabel - The label for the command group.
1458
+ */
1459
+ pushDebugGroup(groupLabel: string): undefined;
1460
+ /**
1461
+ * Ends the labeled debug group most recently started by {@link GPUDebugCommandsMixin#pushDebugGroup}.
1462
+ */
1463
+ popDebugGroup(): undefined;
1464
+ /**
1465
+ * Marks a point in a stream of commands with a label.
1466
+ * @param markerLabel - The label to insert.
1467
+ */
1468
+ insertDebugMarker(markerLabel: string): undefined;
1469
+ }
1470
+
1471
+ interface GPUObjectBase {
1472
+ label: string;
1473
+ }
1474
+
1475
+ interface GPUPipelineBase {
1476
+ /**
1477
+ * Gets a {@link GPUBindGroupLayout} that is compatible with the {@link GPUPipelineBase}'s
1478
+ * {@link GPUBindGroupLayout} at `index`.
1479
+ * @param index - Index into the pipeline layout's {@link GPUPipelineLayout#[[bindGroupLayouts]]}
1480
+ * sequence.
1481
+ */
1482
+ getBindGroupLayout(index: number): GPUBindGroupLayout;
1483
+ }
1484
+
1485
+ interface GPURenderCommandsMixin {
1486
+ /**
1487
+ * Sets the current {@link GPURenderPipeline}.
1488
+ * @param pipeline - The render pipeline to use for subsequent drawing commands.
1489
+ */
1490
+ setPipeline(pipeline: GPURenderPipeline): undefined;
1491
+ /**
1492
+ * Sets the current index buffer.
1493
+ * @param buffer - Buffer containing index data to use for subsequent drawing commands.
1494
+ * @param indexFormat - Format of the index data contained in `buffer`.
1495
+ * @param offset - Offset in bytes into `buffer` where the index data begins. Defaults to `0`.
1496
+ * @param size - Size in bytes of the index data in `buffer`.
1497
+ * Defaults to the size of the buffer minus the offset.
1498
+ */
1499
+ setIndexBuffer(
1500
+ buffer: GPUBuffer,
1501
+ indexFormat: GPUIndexFormat,
1502
+ offset?: GPUSize64,
1503
+ size?: GPUSize64,
1504
+ ): undefined;
1505
+ /**
1506
+ * Sets the current vertex buffer for the given slot.
1507
+ * @param slot - The vertex buffer slot to set the vertex buffer for.
1508
+ * @param buffer - Buffer containing vertex data to use for subsequent drawing commands.
1509
+ * @param offset - Offset in bytes into `buffer` where the vertex data begins. Defaults to `0`.
1510
+ * @param size - Size in bytes of the vertex data in `buffer`.
1511
+ * Defaults to the size of the buffer minus the offset.
1512
+ */
1513
+ setVertexBuffer(
1514
+ slot: GPUIndex32,
1515
+ buffer: GPUBuffer | null,
1516
+ offset?: GPUSize64,
1517
+ size?: GPUSize64,
1518
+ ): undefined;
1519
+ /**
1520
+ * Draws primitives.
1521
+ * See [[#rendering-operations]] for the detailed specification.
1522
+ * @param vertexCount - The number of vertices to draw.
1523
+ * @param instanceCount - The number of instances to draw.
1524
+ * @param firstVertex - Offset into the vertex buffers, in vertices, to begin drawing from.
1525
+ * @param firstInstance - First instance to draw.
1526
+ */
1527
+ draw(
1528
+ vertexCount: GPUSize32,
1529
+ instanceCount?: GPUSize32,
1530
+ firstVertex?: GPUSize32,
1531
+ firstInstance?: GPUSize32,
1532
+ ): undefined;
1533
+ drawIndexed(
1534
+ indexCount: GPUSize32,
1535
+ instanceCount?: GPUSize32,
1536
+ firstIndex?: GPUSize32,
1537
+ baseVertex?: GPUSignedOffset32,
1538
+ firstInstance?: GPUSize32,
1539
+ ): undefined;
1540
+ drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): undefined;
1541
+ drawIndexedIndirect(
1542
+ indirectBuffer: GPUBuffer,
1543
+ indirectOffset: GPUSize64,
1544
+ ): undefined;
1545
+ }
1546
+
1547
+ interface NavigatorGPU {
1548
+ /**
1549
+ * A global singleton providing top-level entry points like {@link GPU#requestAdapter}.
1550
+ */
1551
+ readonly gpu: GPU;
1552
+ }
1553
+
1554
+ interface GPU {
1555
+ /**
1556
+ * Nominal type branding.
1557
+ * https://github.com/microsoft/TypeScript/pull/33038
1558
+ * @internal
1559
+ */
1560
+ readonly __brand: "GPU";
1561
+ /**
1562
+ * Requests an adapter from the user agent.
1563
+ * The user agent chooses whether to return an adapter, and, if so,
1564
+ * chooses according to the provided options.
1565
+ * @param options - Criteria used to select the adapter.
1566
+ */
1567
+ requestAdapter(
1568
+ options?: GPURequestAdapterOptions,
1569
+ ): Promise<GPUAdapter | null>;
1570
+ /**
1571
+ * Returns an optimal {@link GPUTextureFormat} for displaying 8-bit depth, standard dynamic range
1572
+ * content on this system. Must only return {@link GPUTextureFormat#"rgba8unorm"} or
1573
+ * {@link GPUTextureFormat#"bgra8unorm"}.
1574
+ * The returned value can be passed as the {@link GPUCanvasConfiguration#format} to
1575
+ * {@link GPUCanvasContext#configure} calls on a {@link GPUCanvasContext} to ensure the associated
1576
+ * canvas is able to display its contents efficiently.
1577
+ * Note: Canvases which are not displayed to the screen may or may not benefit from using this
1578
+ * format.
1579
+ */
1580
+ getPreferredCanvasFormat(): GPUTextureFormat;
1581
+ readonly wgslLanguageFeatures: WGSLLanguageFeatures;
1582
+ }
1583
+
1584
+ declare var GPU: {
1585
+ prototype: GPU;
1586
+ };
1587
+
1588
+ interface GPUAdapter {
1589
+ /**
1590
+ * Nominal type branding.
1591
+ * https://github.com/microsoft/TypeScript/pull/33038
1592
+ * @internal
1593
+ */
1594
+ readonly __brand: "GPUAdapter";
1595
+ /**
1596
+ * The set of values in `this`.{@link GPUAdapter#[[adapter]]}.{@link adapter#[[features]]}.
1597
+ */
1598
+ readonly features: GPUSupportedFeatures;
1599
+ /**
1600
+ * The limits in `this`.{@link GPUAdapter#[[adapter]]}.{@link adapter#[[limits]]}.
1601
+ */
1602
+ readonly limits: GPUSupportedLimits;
1603
+ /**
1604
+ * Returns the value of {@link GPUAdapter#[[adapter]]}.{@link adapter#[[fallback]]}.
1605
+ */
1606
+ readonly isFallbackAdapter: boolean;
1607
+ /**
1608
+ * Requests a device from the adapter.
1609
+ * This is a one-time action: if a device is returned successfully,
1610
+ * the adapter becomes invalid.
1611
+ * @param descriptor - Description of the {@link GPUDevice} to request.
1612
+ */
1613
+ requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
1614
+ /**
1615
+ * Requests the {@link GPUAdapterInfo} for this {@link GPUAdapter}.
1616
+ * Note: Adapter info values are returned with a Promise to give user agents an
1617
+ * opportunity to perform potentially long-running checks in the future.
1618
+ */
1619
+ requestAdapterInfo(): Promise<GPUAdapterInfo>;
1620
+ }
1621
+
1622
+ declare var GPUAdapter: {
1623
+ prototype: GPUAdapter;
1624
+ };
1625
+
1626
+ interface GPUAdapterInfo {
1627
+ /**
1628
+ * Nominal type branding.
1629
+ * https://github.com/microsoft/TypeScript/pull/33038
1630
+ * @internal
1631
+ */
1632
+ readonly __brand: "GPUAdapterInfo";
1633
+ /**
1634
+ * The name of the vendor of the adapter, if available. Empty string otherwise.
1635
+ */
1636
+ readonly vendor: string;
1637
+ /**
1638
+ * The name of the family or class of GPUs the adapter belongs to, if available. Empty
1639
+ * string otherwise.
1640
+ */
1641
+ readonly architecture: string;
1642
+ /**
1643
+ * A vendor-specific identifier for the adapter, if available. Empty string otherwise.
1644
+ * Note: This is a value that represents the type of adapter. For example, it may be a
1645
+ * [PCI device ID](https://pcisig.com/). It does not uniquely identify a given piece of
1646
+ * hardware like a serial number.
1647
+ */
1648
+ readonly device: string;
1649
+ /**
1650
+ * A human readable string describing the adapter as reported by the driver, if available.
1651
+ * Empty string otherwise.
1652
+ * Note: Because no formatting is applied to {@link GPUAdapterInfo#description} attempting to parse
1653
+ * this value is not recommended. Applications which change their behavior based on the
1654
+ * {@link GPUAdapterInfo}, such as applying workarounds for known driver issues, should rely on the
1655
+ * other fields when possible.
1656
+ */
1657
+ readonly description: string;
1658
+ }
1659
+
1660
+ declare var GPUAdapterInfo: {
1661
+ prototype: GPUAdapterInfo;
1662
+ };
1663
+
1664
+ interface GPUBindGroup extends GPUObjectBase {
1665
+ /**
1666
+ * Nominal type branding.
1667
+ * https://github.com/microsoft/TypeScript/pull/33038
1668
+ * @internal
1669
+ */
1670
+ readonly __brand: "GPUBindGroup";
1671
+ }
1672
+
1673
+ declare var GPUBindGroup: {
1674
+ prototype: GPUBindGroup;
1675
+ };
1676
+
1677
+ interface GPUBindGroupLayout extends GPUObjectBase {
1678
+ /**
1679
+ * Nominal type branding.
1680
+ * https://github.com/microsoft/TypeScript/pull/33038
1681
+ * @internal
1682
+ */
1683
+ readonly __brand: "GPUBindGroupLayout";
1684
+ }
1685
+
1686
+ declare var GPUBindGroupLayout: {
1687
+ prototype: GPUBindGroupLayout;
1688
+ };
1689
+
1690
+ interface GPUBuffer extends GPUObjectBase {
1691
+ /**
1692
+ * Nominal type branding.
1693
+ * https://github.com/microsoft/TypeScript/pull/33038
1694
+ * @internal
1695
+ */
1696
+ readonly __brand: "GPUBuffer";
1697
+ readonly size: GPUSize64Out;
1698
+ readonly usage: GPUFlagsConstant;
1699
+ readonly mapState: GPUBufferMapState;
1700
+ /**
1701
+ * Maps the given range of the {@link GPUBuffer} and resolves the returned {@link Promise} when the
1702
+ * {@link GPUBuffer}'s content is ready to be accessed with {@link GPUBuffer#getMappedRange}.
1703
+ * The resolution of the returned {@link Promise} **only** indicates that the buffer has been mapped.
1704
+ * It does not guarantee the completion of any other operations visible to the content timeline,
1705
+ * and in particular does not imply that any other {@link Promise} returned from
1706
+ * {@link GPUQueue#onSubmittedWorkDone()} or {@link GPUBuffer#mapAsync} on other {@link GPUBuffer}s
1707
+ * have resolved.
1708
+ * The resolution of the {@link Promise} returned from {@link GPUQueue#onSubmittedWorkDone}
1709
+ * **does** imply the completion of
1710
+ * {@link GPUBuffer#mapAsync} calls made prior to that call,
1711
+ * on {@link GPUBuffer}s last used exclusively on that queue.
1712
+ * @param mode - Whether the buffer should be mapped for reading or writing.
1713
+ * @param offset - Offset in bytes into the buffer to the start of the range to map.
1714
+ * @param size - Size in bytes of the range to map.
1715
+ */
1716
+ mapAsync(
1717
+ mode: GPUMapModeFlags,
1718
+ offset?: GPUSize64,
1719
+ size?: GPUSize64,
1720
+ ): Promise<undefined>;
1721
+ /**
1722
+ * Returns an {@link ArrayBuffer} with the contents of the {@link GPUBuffer} in the given mapped range.
1723
+ * @param offset - Offset in bytes into the buffer to return buffer contents from.
1724
+ * @param size - Size in bytes of the {@link ArrayBuffer} to return.
1725
+ */
1726
+ getMappedRange(offset?: GPUSize64, size?: GPUSize64): ArrayBuffer;
1727
+ /**
1728
+ * Unmaps the mapped range of the {@link GPUBuffer} and makes it's contents available for use by the
1729
+ * GPU again.
1730
+ */
1731
+ unmap(): undefined;
1732
+ /**
1733
+ * Destroys the {@link GPUBuffer}.
1734
+ * Note: It is valid to destroy a buffer multiple times.
1735
+ * Note: Since no further operations can be enqueued using this buffer, implementations can
1736
+ * free resource allocations, including mapped memory that was just unmapped.
1737
+ */
1738
+ destroy(): undefined;
1739
+ }
1740
+
1741
+ declare var GPUBuffer: {
1742
+ prototype: GPUBuffer;
1743
+ };
1744
+
1745
+ interface GPUCanvasContext {
1746
+ /**
1747
+ * Nominal type branding.
1748
+ * https://github.com/microsoft/TypeScript/pull/33038
1749
+ * @internal
1750
+ */
1751
+ readonly __brand: "GPUCanvasContext";
1752
+ /**
1753
+ * The canvas this context was created from.
1754
+ */
1755
+ readonly canvas: HTMLCanvasElement | OffscreenCanvas;
1756
+ /**
1757
+ * Configures the context for this canvas.
1758
+ * This clears the drawing buffer to transparent black (in [$Replace the drawing buffer$]).
1759
+ * @param configuration - Desired configuration for the context.
1760
+ */
1761
+ configure(configuration: GPUCanvasConfiguration): undefined;
1762
+ /**
1763
+ * Removes the context configuration. Destroys any textures produced while configured.
1764
+ */
1765
+ unconfigure(): undefined;
1766
+ /**
1767
+ * Get the {@link GPUTexture} that will be composited to the document by the {@link GPUCanvasContext}
1768
+ * next.
1769
+ * Note: The same {@link GPUTexture} object will be returned by every
1770
+ * call to {@link GPUCanvasContext#getCurrentTexture} until "[$Expire the current texture$]"
1771
+ * runs, even if that {@link GPUTexture} is destroyed, failed validation, or failed to allocate.
1772
+ */
1773
+ getCurrentTexture(): GPUTexture;
1774
+ }
1775
+
1776
+ declare var GPUCanvasContext: {
1777
+ prototype: GPUCanvasContext;
1778
+ };
1779
+
1780
+ interface GPUCommandBuffer extends GPUObjectBase {
1781
+ /**
1782
+ * Nominal type branding.
1783
+ * https://github.com/microsoft/TypeScript/pull/33038
1784
+ * @internal
1785
+ */
1786
+ readonly __brand: "GPUCommandBuffer";
1787
+ }
1788
+
1789
+ declare var GPUCommandBuffer: {
1790
+ prototype: GPUCommandBuffer;
1791
+ };
1792
+
1793
+ interface GPUCommandEncoder
1794
+ extends GPUObjectBase,
1795
+ GPUCommandsMixin,
1796
+ GPUDebugCommandsMixin {
1797
+ /**
1798
+ * Nominal type branding.
1799
+ * https://github.com/microsoft/TypeScript/pull/33038
1800
+ * @internal
1801
+ */
1802
+ readonly __brand: "GPUCommandEncoder";
1803
+ /**
1804
+ * Begins encoding a render pass described by `descriptor`.
1805
+ * @param descriptor - Description of the {@link GPURenderPassEncoder} to create.
1806
+ */
1807
+ beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
1808
+ /**
1809
+ * Begins encoding a compute pass described by `descriptor`.
1810
+ * descriptor:
1811
+ */
1812
+ beginComputePass(
1813
+ descriptor?: GPUComputePassDescriptor,
1814
+ ): GPUComputePassEncoder;
1815
+ /**
1816
+ * Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of a
1817
+ * {@link GPUBuffer} to a sub-region of another {@link GPUBuffer}.
1818
+ * @param source - The {@link GPUBuffer} to copy from.
1819
+ * @param sourceOffset - Offset in bytes into `source` to begin copying from.
1820
+ * @param destination - The {@link GPUBuffer} to copy to.
1821
+ * @param destinationOffset - Offset in bytes into `destination` to place the copied data.
1822
+ * @param size - Bytes to copy.
1823
+ */
1824
+ copyBufferToBuffer(
1825
+ source: GPUBuffer,
1826
+ sourceOffset: GPUSize64,
1827
+ destination: GPUBuffer,
1828
+ destinationOffset: GPUSize64,
1829
+ size: GPUSize64,
1830
+ ): undefined;
1831
+ /**
1832
+ * Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of a
1833
+ * {@link GPUBuffer} to a sub-region of one or multiple continuous texture subresources.
1834
+ * @param source - Combined with `copySize`, defines the region of the source buffer.
1835
+ * @param destination - Combined with `copySize`, defines the region of the destination texture subresource.
1836
+ * `copySize`:
1837
+ */
1838
+ copyBufferToTexture(
1839
+ source: GPUImageCopyBuffer,
1840
+ destination: GPUImageCopyTexture,
1841
+ copySize: GPUExtent3D,
1842
+ ): undefined;
1843
+ /**
1844
+ * Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of one or
1845
+ * multiple continuous texture subresources to a sub-region of a {@link GPUBuffer}.
1846
+ * @param source - Combined with `copySize`, defines the region of the source texture subresources.
1847
+ * @param destination - Combined with `copySize`, defines the region of the destination buffer.
1848
+ * `copySize`:
1849
+ */
1850
+ copyTextureToBuffer(
1851
+ source: GPUImageCopyTexture,
1852
+ destination: GPUImageCopyBuffer,
1853
+ copySize: GPUExtent3D,
1854
+ ): undefined;
1855
+ /**
1856
+ * Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of one
1857
+ * or multiple contiguous texture subresources to another sub-region of one or
1858
+ * multiple continuous texture subresources.
1859
+ * @param source - Combined with `copySize`, defines the region of the source texture subresources.
1860
+ * @param destination - Combined with `copySize`, defines the region of the destination texture subresources.
1861
+ * `copySize`:
1862
+ */
1863
+ copyTextureToTexture(
1864
+ source: GPUImageCopyTexture,
1865
+ destination: GPUImageCopyTexture,
1866
+ copySize: GPUExtent3D,
1867
+ ): undefined;
1868
+ /**
1869
+ * Encode a command into the {@link GPUCommandEncoder} that fills a sub-region of a
1870
+ * {@link GPUBuffer} with zeros.
1871
+ * @param buffer - The {@link GPUBuffer} to clear.
1872
+ * @param offset - Offset in bytes into `buffer` where the sub-region to clear begins.
1873
+ * @param size - Size in bytes of the sub-region to clear. Defaults to the size of the buffer minus `offset`.
1874
+ */
1875
+ clearBuffer(
1876
+ buffer: GPUBuffer,
1877
+ offset?: GPUSize64,
1878
+ size?: GPUSize64,
1879
+ ): undefined;
1880
+ /**
1881
+ * Resolves query results from a {@link GPUQuerySet} out into a range of a {@link GPUBuffer}.
1882
+ * querySet:
1883
+ * firstQuery:
1884
+ * queryCount:
1885
+ * destination:
1886
+ * destinationOffset:
1887
+ */
1888
+ resolveQuerySet(
1889
+ querySet: GPUQuerySet,
1890
+ firstQuery: GPUSize32,
1891
+ queryCount: GPUSize32,
1892
+ destination: GPUBuffer,
1893
+ destinationOffset: GPUSize64,
1894
+ ): undefined;
1895
+ /**
1896
+ * Completes recording of the commands sequence and returns a corresponding {@link GPUCommandBuffer}.
1897
+ * descriptor:
1898
+ */
1899
+ finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
1900
+ }
1901
+
1902
+ declare var GPUCommandEncoder: {
1903
+ prototype: GPUCommandEncoder;
1904
+ };
1905
+
1906
+ interface GPUCompilationInfo {
1907
+ /**
1908
+ * Nominal type branding.
1909
+ * https://github.com/microsoft/TypeScript/pull/33038
1910
+ * @internal
1911
+ */
1912
+ readonly __brand: "GPUCompilationInfo";
1913
+ readonly messages: ReadonlyArray<GPUCompilationMessage>;
1914
+ }
1915
+
1916
+ declare var GPUCompilationInfo: {
1917
+ prototype: GPUCompilationInfo;
1918
+ };
1919
+
1920
+ interface GPUCompilationMessage {
1921
+ /**
1922
+ * Nominal type branding.
1923
+ * https://github.com/microsoft/TypeScript/pull/33038
1924
+ * @internal
1925
+ */
1926
+ readonly __brand: "GPUCompilationMessage";
1927
+ /**
1928
+ * The human-readable, localizable text for this compilation message.
1929
+ * Note: The {@link GPUCompilationMessage#message} should follow the best practices for language
1930
+ * and direction information. This includes making use of any future standards which may
1931
+ * emerge regarding the reporting of string language and direction metadata.
1932
+ * <p class="note editorial"><span class=marker>Editorial note:</span>
1933
+ * At the time of this writing, no language/direction recommendation is available that provides
1934
+ * compatibility and consistency with legacy APIs, but when there is, adopt it formally.
1935
+ */
1936
+ readonly message: string;
1937
+ /**
1938
+ * The severity level of the message.
1939
+ * If the {@link GPUCompilationMessage#type} is {@link GPUCompilationMessageType#"error"}, it
1940
+ * corresponds to a shader-creation error.
1941
+ */
1942
+ readonly type: GPUCompilationMessageType;
1943
+ /**
1944
+ * The line number in the shader {@link GPUShaderModuleDescriptor#code} the
1945
+ * {@link GPUCompilationMessage#message} corresponds to. Value is one-based, such that a lineNum of
1946
+ * `1` indicates the first line of the shader {@link GPUShaderModuleDescriptor#code}. Lines are
1947
+ * delimited by line breaks.
1948
+ * If the {@link GPUCompilationMessage#message} corresponds to a substring this points to
1949
+ * the line on which the substring begins. Must be `0` if the {@link GPUCompilationMessage#message}
1950
+ * does not correspond to any specific point in the shader {@link GPUShaderModuleDescriptor#code}.
1951
+ */
1952
+ readonly lineNum: number;
1953
+ /**
1954
+ * The offset, in UTF-16 code units, from the beginning of line {@link GPUCompilationMessage#lineNum}
1955
+ * of the shader {@link GPUShaderModuleDescriptor#code} to the point or beginning of the substring
1956
+ * that the {@link GPUCompilationMessage#message} corresponds to. Value is one-based, such that a
1957
+ * {@link GPUCompilationMessage#linePos} of `1` indicates the first code unit of the line.
1958
+ * If {@link GPUCompilationMessage#message} corresponds to a substring this points to the
1959
+ * first UTF-16 code unit of the substring. Must be `0` if the {@link GPUCompilationMessage#message}
1960
+ * does not correspond to any specific point in the shader {@link GPUShaderModuleDescriptor#code}.
1961
+ */
1962
+ readonly linePos: number;
1963
+ /**
1964
+ * The offset from the beginning of the shader {@link GPUShaderModuleDescriptor#code} in UTF-16
1965
+ * code units to the point or beginning of the substring that {@link GPUCompilationMessage#message}
1966
+ * corresponds to. Must reference the same position as {@link GPUCompilationMessage#lineNum} and
1967
+ * {@link GPUCompilationMessage#linePos}. Must be `0` if the {@link GPUCompilationMessage#message}
1968
+ * does not correspond to any specific point in the shader {@link GPUShaderModuleDescriptor#code}.
1969
+ */
1970
+ readonly offset: number;
1971
+ /**
1972
+ * The number of UTF-16 code units in the substring that {@link GPUCompilationMessage#message}
1973
+ * corresponds to. If the message does not correspond with a substring then
1974
+ * {@link GPUCompilationMessage#length} must be 0.
1975
+ */
1976
+ readonly length: number;
1977
+ }
1978
+
1979
+ declare var GPUCompilationMessage: {
1980
+ prototype: GPUCompilationMessage;
1981
+ };
1982
+
1983
+ interface GPUComputePassEncoder
1984
+ extends GPUObjectBase,
1985
+ GPUCommandsMixin,
1986
+ GPUDebugCommandsMixin,
1987
+ GPUBindingCommandsMixin {
1988
+ /**
1989
+ * Nominal type branding.
1990
+ * https://github.com/microsoft/TypeScript/pull/33038
1991
+ * @internal
1992
+ */
1993
+ readonly __brand: "GPUComputePassEncoder";
1994
+ /**
1995
+ * Sets the current {@link GPUComputePipeline}.
1996
+ * @param pipeline - The compute pipeline to use for subsequent dispatch commands.
1997
+ */
1998
+ setPipeline(pipeline: GPUComputePipeline): undefined;
1999
+ /**
2000
+ * Dispatch work to be performed with the current {@link GPUComputePipeline}.
2001
+ * See [[#computing-operations]] for the detailed specification.
2002
+ * @param workgroupCountX - X dimension of the grid of workgroups to dispatch.
2003
+ * @param workgroupCountY - Y dimension of the grid of workgroups to dispatch.
2004
+ * @param workgroupCountZ - Z dimension of the grid of workgroups to dispatch.
2005
+ */
2006
+ dispatchWorkgroups(
2007
+ workgroupCountX: GPUSize32,
2008
+ workgroupCountY?: GPUSize32,
2009
+ workgroupCountZ?: GPUSize32,
2010
+ ): undefined;
2011
+ /**
2012
+ * Dispatch work to be performed with the current {@link GPUComputePipeline} using parameters read
2013
+ * from a {@link GPUBuffer}.
2014
+ * See [[#computing-operations]] for the detailed specification.
2015
+ * packed block of **three 32-bit unsigned integer values (12 bytes total)**,
2016
+ * given in the same order as the arguments for {@link GPUComputePassEncoder#dispatchWorkgroups}.
2017
+ * For example:
2018
+ * @param indirectBuffer - Buffer containing the indirect dispatch parameters.
2019
+ * @param indirectOffset - Offset in bytes into `indirectBuffer` where the dispatch data begins.
2020
+ */
2021
+ dispatchWorkgroupsIndirect(
2022
+ indirectBuffer: GPUBuffer,
2023
+ indirectOffset: GPUSize64,
2024
+ ): undefined;
2025
+ /**
2026
+ * Completes recording of the compute pass commands sequence.
2027
+ */
2028
+ end(): undefined;
2029
+ }
2030
+
2031
+ declare var GPUComputePassEncoder: {
2032
+ prototype: GPUComputePassEncoder;
2033
+ };
2034
+
2035
+ interface GPUComputePipeline extends GPUObjectBase, GPUPipelineBase {
2036
+ /**
2037
+ * Nominal type branding.
2038
+ * https://github.com/microsoft/TypeScript/pull/33038
2039
+ * @internal
2040
+ */
2041
+ readonly __brand: "GPUComputePipeline";
2042
+ }
2043
+
2044
+ declare var GPUComputePipeline: {
2045
+ prototype: GPUComputePipeline;
2046
+ };
2047
+
2048
+ interface GPUDevice extends EventTarget, GPUObjectBase {
2049
+ /**
2050
+ * Nominal type branding.
2051
+ * https://github.com/microsoft/TypeScript/pull/33038
2052
+ * @internal
2053
+ */
2054
+ readonly __brand: "GPUDevice";
2055
+ /**
2056
+ * A set containing the {@link GPUFeatureName} values of the features
2057
+ * supported by the device (i.e. the ones with which it was created).
2058
+ */
2059
+ readonly features: GPUSupportedFeatures;
2060
+ /**
2061
+ * Exposes the limits supported by the device
2062
+ * (which are exactly the ones with which it was created).
2063
+ */
2064
+ readonly limits: GPUSupportedLimits;
2065
+ /**
2066
+ * The primary {@link GPUQueue} for this device.
2067
+ */
2068
+ readonly queue: GPUQueue;
2069
+ /**
2070
+ * Destroys the device, preventing further operations on it.
2071
+ * Outstanding asynchronous operations will fail.
2072
+ * Note: It is valid to destroy a device multiple times.
2073
+ */
2074
+ destroy(): undefined;
2075
+ /**
2076
+ * Creates a {@link GPUBuffer}.
2077
+ * @param descriptor - Description of the {@link GPUBuffer} to create.
2078
+ */
2079
+ createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer;
2080
+ /**
2081
+ * Creates a {@link GPUTexture}.
2082
+ * @param descriptor - Description of the {@link GPUTexture} to create.
2083
+ */
2084
+ createTexture(descriptor: GPUTextureDescriptor): GPUTexture;
2085
+ /**
2086
+ * Creates a {@link GPUSampler}.
2087
+ * @param descriptor - Description of the {@link GPUSampler} to create.
2088
+ */
2089
+ createSampler(descriptor?: GPUSamplerDescriptor): GPUSampler;
2090
+ /**
2091
+ * Creates a {@link GPUExternalTexture} wrapping the provided image source.
2092
+ * @param descriptor - Provides the external image source object (and any creation options).
2093
+ */
2094
+ importExternalTexture(
2095
+ descriptor: GPUExternalTextureDescriptor,
2096
+ ): GPUExternalTexture;
2097
+ /**
2098
+ * Creates a {@link GPUBindGroupLayout}.
2099
+ * @param descriptor - Description of the {@link GPUBindGroupLayout} to create.
2100
+ */
2101
+ createBindGroupLayout(
2102
+ descriptor: GPUBindGroupLayoutDescriptor,
2103
+ ): GPUBindGroupLayout;
2104
+ /**
2105
+ * Creates a {@link GPUPipelineLayout}.
2106
+ * @param descriptor - Description of the {@link GPUPipelineLayout} to create.
2107
+ */
2108
+ createPipelineLayout(
2109
+ descriptor: GPUPipelineLayoutDescriptor,
2110
+ ): GPUPipelineLayout;
2111
+ /**
2112
+ * Creates a {@link GPUBindGroup}.
2113
+ * @param descriptor - Description of the {@link GPUBindGroup} to create.
2114
+ */
2115
+ createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
2116
+ /**
2117
+ * Creates a {@link GPUShaderModule}.
2118
+ * @param descriptor - Description of the {@link GPUShaderModule} to create.
2119
+ */
2120
+ createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule;
2121
+ /**
2122
+ * Creates a {@link GPUComputePipeline} using immediate pipeline creation.
2123
+ * @param descriptor - Description of the {@link GPUComputePipeline} to create.
2124
+ */
2125
+ createComputePipeline(
2126
+ descriptor: GPUComputePipelineDescriptor,
2127
+ ): GPUComputePipeline;
2128
+ /**
2129
+ * Creates a {@link GPURenderPipeline} using immediate pipeline creation.
2130
+ * @param descriptor - Description of the {@link GPURenderPipeline} to create.
2131
+ */
2132
+ createRenderPipeline(
2133
+ descriptor: GPURenderPipelineDescriptor,
2134
+ ): GPURenderPipeline;
2135
+ /**
2136
+ * Creates a {@link GPUComputePipeline} using async pipeline creation.
2137
+ * The returned {@link Promise} resolves when the created pipeline
2138
+ * is ready to be used without additional delay.
2139
+ * If pipeline creation fails, the returned {@link Promise} rejects with an {@link GPUPipelineError}.
2140
+ * Note: Use of this method is preferred whenever possible, as it prevents blocking the
2141
+ * queue timeline work on pipeline compilation.
2142
+ * @param descriptor - Description of the {@link GPUComputePipeline} to create.
2143
+ */
2144
+ createComputePipelineAsync(
2145
+ descriptor: GPUComputePipelineDescriptor,
2146
+ ): Promise<GPUComputePipeline>;
2147
+ /**
2148
+ * Creates a {@link GPURenderPipeline} using async pipeline creation.
2149
+ * The returned {@link Promise} resolves when the created pipeline
2150
+ * is ready to be used without additional delay.
2151
+ * If pipeline creation fails, the returned {@link Promise} rejects with an {@link GPUPipelineError}.
2152
+ * Note: Use of this method is preferred whenever possible, as it prevents blocking the
2153
+ * queue timeline work on pipeline compilation.
2154
+ * @param descriptor - Description of the {@link GPURenderPipeline} to create.
2155
+ */
2156
+ createRenderPipelineAsync(
2157
+ descriptor: GPURenderPipelineDescriptor,
2158
+ ): Promise<GPURenderPipeline>;
2159
+ /**
2160
+ * Creates a {@link GPUCommandEncoder}.
2161
+ * @param descriptor - Description of the {@link GPUCommandEncoder} to create.
2162
+ */
2163
+ createCommandEncoder(
2164
+ descriptor?: GPUCommandEncoderDescriptor,
2165
+ ): GPUCommandEncoder;
2166
+ /**
2167
+ * Creates a {@link GPURenderBundleEncoder}.
2168
+ * @param descriptor - Description of the {@link GPURenderBundleEncoder} to create.
2169
+ */
2170
+ createRenderBundleEncoder(
2171
+ descriptor: GPURenderBundleEncoderDescriptor,
2172
+ ): GPURenderBundleEncoder;
2173
+ /**
2174
+ * Creates a {@link GPUQuerySet}.
2175
+ * @param descriptor - Description of the {@link GPUQuerySet} to create.
2176
+ */
2177
+ createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet;
2178
+ /**
2179
+ * A slot-backed attribute holding a promise which is created with the device, remains
2180
+ * pending for the lifetime of the device, then resolves when the device is lost.
2181
+ * Upon initialization, it is set to a new promise.
2182
+ */
2183
+ readonly lost: Promise<GPUDeviceLostInfo>;
2184
+ /**
2185
+ * Pushes a new GPU error scope onto the {@link GPUDevice#[[errorScopeStack]]} for `this`.
2186
+ * @param filter - Which class of errors this error scope observes.
2187
+ */
2188
+ pushErrorScope(filter: GPUErrorFilter): undefined;
2189
+ /**
2190
+ * Pops a GPU error scope off the {@link GPUDevice#[[errorScopeStack]]} for `this`
2191
+ * and resolves to **any** {@link GPUError} observed by the error scope, or `null` if none.
2192
+ * There is no guarantee of the ordering of promise resolution.
2193
+ */
2194
+ popErrorScope(): Promise<GPUError | null>;
2195
+ /**
2196
+ * An event handler IDL attribute for the {@link GPUDevice#uncapturederror} event type.
2197
+ */
2198
+ onuncapturederror: EventHandler;
2199
+ }
2200
+
2201
+ declare var GPUDevice: {
2202
+ prototype: GPUDevice;
2203
+ };
2204
+
2205
+ interface GPUDeviceLostInfo {
2206
+ /**
2207
+ * Nominal type branding.
2208
+ * https://github.com/microsoft/TypeScript/pull/33038
2209
+ * @internal
2210
+ */
2211
+ readonly __brand: "GPUDeviceLostInfo";
2212
+ readonly reason: GPUDeviceLostReason;
2213
+ readonly message: string;
2214
+ }
2215
+
2216
+ declare var GPUDeviceLostInfo: {
2217
+ prototype: GPUDeviceLostInfo;
2218
+ };
2219
+
2220
+ interface GPUError {
2221
+ /**
2222
+ * A human-readable, localizable text message providing information about the error that
2223
+ * occurred.
2224
+ * Note: This message is generally intended for application developers to debug their
2225
+ * applications and capture information for debug reports, not to be surfaced to end-users.
2226
+ * Note: User agents should not include potentially machine-parsable details in this message,
2227
+ * such as free system memory on {@link GPUErrorFilter#"out-of-memory"} or other details about the
2228
+ * conditions under which memory was exhausted.
2229
+ * Note: The {@link GPUError#message} should follow the best practices for language and
2230
+ * direction information. This includes making use of any future standards which may emerge
2231
+ * regarding the reporting of string language and direction metadata.
2232
+ * <p class="note editorial"><span class=marker>Editorial note:</span>
2233
+ * At the time of this writing, no language/direction recommendation is available that provides
2234
+ * compatibility and consistency with legacy APIs, but when there is, adopt it formally.
2235
+ */
2236
+ readonly message: string;
2237
+ }
2238
+
2239
+ declare var GPUError: {
2240
+ prototype: GPUError;
2241
+ };
2242
+
2243
+ interface GPUExternalTexture extends GPUObjectBase {
2244
+ /**
2245
+ * Nominal type branding.
2246
+ * https://github.com/microsoft/TypeScript/pull/33038
2247
+ * @internal
2248
+ */
2249
+ readonly __brand: "GPUExternalTexture";
2250
+ }
2251
+
2252
+ declare var GPUExternalTexture: {
2253
+ prototype: GPUExternalTexture;
2254
+ };
2255
+
2256
+ interface GPUInternalError extends GPUError {
2257
+ /**
2258
+ * Nominal type branding.
2259
+ * https://github.com/microsoft/TypeScript/pull/33038
2260
+ * @internal
2261
+ */
2262
+ readonly __brand: "GPUInternalError";
2263
+ }
2264
+
2265
+ declare var GPUInternalError: {
2266
+ prototype: GPUInternalError;
2267
+ new (message: string);
2268
+ };
2269
+
2270
+ interface GPUOutOfMemoryError extends GPUError {
2271
+ /**
2272
+ * Nominal type branding.
2273
+ * https://github.com/microsoft/TypeScript/pull/33038
2274
+ * @internal
2275
+ */
2276
+ readonly __brand: "GPUOutOfMemoryError";
2277
+ }
2278
+
2279
+ declare var GPUOutOfMemoryError: {
2280
+ prototype: GPUOutOfMemoryError;
2281
+ new (message: string);
2282
+ };
2283
+
2284
+ interface GPUPipelineError extends DOMException {
2285
+ /**
2286
+ * Nominal type branding.
2287
+ * https://github.com/microsoft/TypeScript/pull/33038
2288
+ * @internal
2289
+ */
2290
+ readonly __brand: "GPUPipelineError";
2291
+ /**
2292
+ * A read-only slot-backed attribute exposing the type of error encountered in pipeline creation
2293
+ * as a <dfn enum for="">GPUPipelineErrorReason</dfn>:
2294
+ * <ul dfn-type=enum-value dfn-for=GPUPipelineErrorReason>
2295
+ * - <dfn>"validation"</dfn>: A [$validation error$].
2296
+ * - <dfn>"internal"</dfn>: An [$internal error$].
2297
+ * </ul>
2298
+ */
2299
+ readonly reason: GPUPipelineErrorReason;
2300
+ }
2301
+
2302
+ declare var GPUPipelineError: {
2303
+ prototype: GPUPipelineError;
2304
+ new (message?: string, options: GPUPipelineErrorInit);
2305
+ };
2306
+
2307
+ interface GPUPipelineLayout extends GPUObjectBase {
2308
+ /**
2309
+ * Nominal type branding.
2310
+ * https://github.com/microsoft/TypeScript/pull/33038
2311
+ * @internal
2312
+ */
2313
+ readonly __brand: "GPUPipelineLayout";
2314
+ }
2315
+
2316
+ declare var GPUPipelineLayout: {
2317
+ prototype: GPUPipelineLayout;
2318
+ };
2319
+
2320
+ interface GPUQuerySet extends GPUObjectBase {
2321
+ /**
2322
+ * Nominal type branding.
2323
+ * https://github.com/microsoft/TypeScript/pull/33038
2324
+ * @internal
2325
+ */
2326
+ readonly __brand: "GPUQuerySet";
2327
+ /**
2328
+ * Destroys the {@link GPUQuerySet}.
2329
+ */
2330
+ destroy(): undefined;
2331
+ /**
2332
+ * The type of the queries managed by this {@link GPUQuerySet}.
2333
+ */
2334
+ readonly type: GPUQueryType;
2335
+ /**
2336
+ * The number of queries managed by this {@link GPUQuerySet}.
2337
+ */
2338
+ readonly count: GPUSize32Out;
2339
+ }
2340
+
2341
+ declare var GPUQuerySet: {
2342
+ prototype: GPUQuerySet;
2343
+ };
2344
+
2345
+ interface GPUQueue extends GPUObjectBase {
2346
+ /**
2347
+ * Nominal type branding.
2348
+ * https://github.com/microsoft/TypeScript/pull/33038
2349
+ * @internal
2350
+ */
2351
+ readonly __brand: "GPUQueue";
2352
+ /**
2353
+ * Schedules the execution of the command buffers by the GPU on this queue.
2354
+ * Submitted command buffers cannot be used again.
2355
+ * `commandBuffers`:
2356
+ */
2357
+ submit(commandBuffers: Array<GPUCommandBuffer>): undefined;
2358
+ onSubmittedWorkDone(): Promise<undefined>;
2359
+ /**
2360
+ * Issues a write operation of the provided data into a {@link GPUBuffer}.
2361
+ * @param buffer - The buffer to write to.
2362
+ * @param bufferOffset - Offset in bytes into `buffer` to begin writing at.
2363
+ * @param data - Data to write into `buffer`.
2364
+ * @param dataOffset - Offset in into `data` to begin writing from. Given in elements if
2365
+ * `data` is a `TypedArray` and bytes otherwise.
2366
+ * @param size - Size of content to write from `data` to `buffer`. Given in elements if
2367
+ * `data` is a `TypedArray` and bytes otherwise.
2368
+ */
2369
+ writeBuffer(
2370
+ buffer: GPUBuffer,
2371
+ bufferOffset: GPUSize64,
2372
+ data: AllowSharedBufferSource,
2373
+ dataOffset?: GPUSize64,
2374
+ size?: GPUSize64,
2375
+ ): undefined;
2376
+ /**
2377
+ * Issues a write operation of the provided data into a {@link GPUTexture}.
2378
+ * @param destination - The texture subresource and origin to write to.
2379
+ * @param data - Data to write into `destination`.
2380
+ * @param dataLayout - Layout of the content in `data`.
2381
+ * @param size - Extents of the content to write from `data` to `destination`.
2382
+ */
2383
+ writeTexture(
2384
+ destination: GPUImageCopyTexture,
2385
+ data: AllowSharedBufferSource,
2386
+ dataLayout: GPUImageDataLayout,
2387
+ size: GPUExtent3D,
2388
+ ): undefined;
2389
+ /**
2390
+ * Issues a copy operation of the contents of a platform image/canvas
2391
+ * into the destination texture.
2392
+ * This operation performs [[#color-space-conversions|color encoding]] into the destination
2393
+ * encoding according to the parameters of {@link GPUImageCopyTextureTagged}.
2394
+ * Copying into a `-srgb` texture results in the same texture bytes, not the same decoded
2395
+ * values, as copying into the corresponding non-`-srgb` format.
2396
+ * Thus, after a copy operation, sampling the destination texture has
2397
+ * different results depending on whether its format is `-srgb`, all else unchanged.
2398
+ * <!-- POSTV1(srgb-linear): If added, explain here how it interacts. -->
2399
+ * @param source - source image and origin to copy to `destination`.
2400
+ * @param destination - The texture subresource and origin to write to, and its encoding metadata.
2401
+ * @param copySize - Extents of the content to write from `source` to `destination`.
2402
+ */
2403
+ copyExternalImageToTexture(
2404
+ source: GPUImageCopyExternalImage,
2405
+ destination: GPUImageCopyTextureTagged,
2406
+ copySize: GPUExtent3D,
2407
+ ): undefined;
2408
+ }
2409
+
2410
+ declare var GPUQueue: {
2411
+ prototype: GPUQueue;
2412
+ };
2413
+
2414
+ interface GPURenderBundle extends GPUObjectBase {
2415
+ /**
2416
+ * Nominal type branding.
2417
+ * https://github.com/microsoft/TypeScript/pull/33038
2418
+ * @internal
2419
+ */
2420
+ readonly __brand: "GPURenderBundle";
2421
+ }
2422
+
2423
+ declare var GPURenderBundle: {
2424
+ prototype: GPURenderBundle;
2425
+ };
2426
+
2427
+ interface GPURenderBundleEncoder
2428
+ extends GPUObjectBase,
2429
+ GPUCommandsMixin,
2430
+ GPUDebugCommandsMixin,
2431
+ GPUBindingCommandsMixin,
2432
+ GPURenderCommandsMixin {
2433
+ /**
2434
+ * Nominal type branding.
2435
+ * https://github.com/microsoft/TypeScript/pull/33038
2436
+ * @internal
2437
+ */
2438
+ readonly __brand: "GPURenderBundleEncoder";
2439
+ /**
2440
+ * Completes recording of the render bundle commands sequence.
2441
+ * descriptor:
2442
+ */
2443
+ finish(descriptor?: GPURenderBundleDescriptor): GPURenderBundle;
2444
+ }
2445
+
2446
+ declare var GPURenderBundleEncoder: {
2447
+ prototype: GPURenderBundleEncoder;
2448
+ };
2449
+
2450
+ interface GPURenderPassEncoder
2451
+ extends GPUObjectBase,
2452
+ GPUCommandsMixin,
2453
+ GPUDebugCommandsMixin,
2454
+ GPUBindingCommandsMixin,
2455
+ GPURenderCommandsMixin {
2456
+ /**
2457
+ * Nominal type branding.
2458
+ * https://github.com/microsoft/TypeScript/pull/33038
2459
+ * @internal
2460
+ */
2461
+ readonly __brand: "GPURenderPassEncoder";
2462
+ /**
2463
+ * Sets the viewport used during the rasterization stage to linearly map from
2464
+ * NDC|normalized device coordinates to viewport coordinates.
2465
+ * @param x - Minimum X value of the viewport in pixels.
2466
+ * @param y - Minimum Y value of the viewport in pixels.
2467
+ * @param width - Width of the viewport in pixels.
2468
+ * @param height - Height of the viewport in pixels.
2469
+ * @param minDepth - Minimum depth value of the viewport.
2470
+ * @param maxDepth - Maximum depth value of the viewport.
2471
+ */
2472
+ setViewport(
2473
+ x: number,
2474
+ y: number,
2475
+ width: number,
2476
+ height: number,
2477
+ minDepth: number,
2478
+ maxDepth: number,
2479
+ ): undefined;
2480
+ /**
2481
+ * Sets the scissor rectangle used during the rasterization stage.
2482
+ * After transformation into viewport coordinates any fragments which fall outside the scissor
2483
+ * rectangle will be discarded.
2484
+ * @param x - Minimum X value of the scissor rectangle in pixels.
2485
+ * @param y - Minimum Y value of the scissor rectangle in pixels.
2486
+ * @param width - Width of the scissor rectangle in pixels.
2487
+ * @param height - Height of the scissor rectangle in pixels.
2488
+ */
2489
+ setScissorRect(
2490
+ x: GPUIntegerCoordinate,
2491
+ y: GPUIntegerCoordinate,
2492
+ width: GPUIntegerCoordinate,
2493
+ height: GPUIntegerCoordinate,
2494
+ ): undefined;
2495
+ /**
2496
+ * Sets the constant blend color and alpha values used with {@link GPUBlendFactor#"constant"}
2497
+ * and {@link GPUBlendFactor#"one-minus-constant"} {@link GPUBlendFactor}s.
2498
+ * @param color - The color to use when blending.
2499
+ */
2500
+ setBlendConstant(color: GPUColor): undefined;
2501
+ /**
2502
+ * Sets the {@link RenderState#[[stencilReference]]} value used during stencil tests with
2503
+ * the {@link GPUStencilOperation#"replace"} {@link GPUStencilOperation}.
2504
+ * @param reference - The new stencil reference value.
2505
+ */
2506
+ setStencilReference(reference: GPUStencilValue): undefined;
2507
+ /**
2508
+ * @param queryIndex - The index of the query in the query set.
2509
+ */
2510
+ beginOcclusionQuery(queryIndex: GPUSize32): undefined;
2511
+ /**
2512
+ */
2513
+ endOcclusionQuery(): undefined;
2514
+ /**
2515
+ * Executes the commands previously recorded into the given {@link GPURenderBundle}s as part of
2516
+ * this render pass.
2517
+ * When a {@link GPURenderBundle} is executed, it does not inherit the render pass's pipeline, bind
2518
+ * groups, or vertex and index buffers. After a {@link GPURenderBundle} has executed, the render
2519
+ * pass's pipeline, bind group, and vertex/index buffer state is cleared
2520
+ * (to the initial, empty values).
2521
+ * Note: The state is cleared, not restored to the previous state.
2522
+ * This occurs even if zero {@link GPURenderBundle|GPURenderBundles} are executed.
2523
+ * @param bundles - List of render bundles to execute.
2524
+ */
2525
+ executeBundles(bundles: Array<GPURenderBundle>): undefined;
2526
+ /**
2527
+ * Completes recording of the render pass commands sequence.
2528
+ */
2529
+ end(): undefined;
2530
+ }
2531
+
2532
+ declare var GPURenderPassEncoder: {
2533
+ prototype: GPURenderPassEncoder;
2534
+ };
2535
+
2536
+ interface GPURenderPipeline extends GPUObjectBase, GPUPipelineBase {
2537
+ /**
2538
+ * Nominal type branding.
2539
+ * https://github.com/microsoft/TypeScript/pull/33038
2540
+ * @internal
2541
+ */
2542
+ readonly __brand: "GPURenderPipeline";
2543
+ }
2544
+
2545
+ declare var GPURenderPipeline: {
2546
+ prototype: GPURenderPipeline;
2547
+ };
2548
+
2549
+ interface GPUSampler extends GPUObjectBase {
2550
+ /**
2551
+ * Nominal type branding.
2552
+ * https://github.com/microsoft/TypeScript/pull/33038
2553
+ * @internal
2554
+ */
2555
+ readonly __brand: "GPUSampler";
2556
+ }
2557
+
2558
+ declare var GPUSampler: {
2559
+ prototype: GPUSampler;
2560
+ };
2561
+
2562
+ interface GPUShaderModule extends GPUObjectBase {
2563
+ /**
2564
+ * Nominal type branding.
2565
+ * https://github.com/microsoft/TypeScript/pull/33038
2566
+ * @internal
2567
+ */
2568
+ readonly __brand: "GPUShaderModule";
2569
+ /**
2570
+ * Returns any messages generated during the {@link GPUShaderModule}'s compilation.
2571
+ * The locations, order, and contents of messages are implementation-defined.
2572
+ * In particular, messages may not be ordered by {@link GPUCompilationMessage#lineNum}.
2573
+ */
2574
+ getCompilationInfo(): Promise<GPUCompilationInfo>;
2575
+ }
2576
+
2577
+ declare var GPUShaderModule: {
2578
+ prototype: GPUShaderModule;
2579
+ };
2580
+
2581
+ type GPUSupportedFeatures = ReadonlySet<string>;
2582
+
2583
+ interface GPUSupportedLimits {
2584
+ /**
2585
+ * Nominal type branding.
2586
+ * https://github.com/microsoft/TypeScript/pull/33038
2587
+ * @internal
2588
+ */
2589
+ readonly __brand: "GPUSupportedLimits";
2590
+ readonly maxTextureDimension1D: number;
2591
+ readonly maxTextureDimension2D: number;
2592
+ readonly maxTextureDimension3D: number;
2593
+ readonly maxTextureArrayLayers: number;
2594
+ readonly maxBindGroups: number;
2595
+ readonly maxBindGroupsPlusVertexBuffers: number;
2596
+ readonly maxBindingsPerBindGroup: number;
2597
+ readonly maxDynamicUniformBuffersPerPipelineLayout: number;
2598
+ readonly maxDynamicStorageBuffersPerPipelineLayout: number;
2599
+ readonly maxSampledTexturesPerShaderStage: number;
2600
+ readonly maxSamplersPerShaderStage: number;
2601
+ readonly maxStorageBuffersPerShaderStage: number;
2602
+ readonly maxStorageTexturesPerShaderStage: number;
2603
+ readonly maxUniformBuffersPerShaderStage: number;
2604
+ readonly maxUniformBufferBindingSize: number;
2605
+ readonly maxStorageBufferBindingSize: number;
2606
+ readonly minUniformBufferOffsetAlignment: number;
2607
+ readonly minStorageBufferOffsetAlignment: number;
2608
+ readonly maxVertexBuffers: number;
2609
+ readonly maxBufferSize: number;
2610
+ readonly maxVertexAttributes: number;
2611
+ readonly maxVertexBufferArrayStride: number;
2612
+ readonly maxInterStageShaderComponents: number;
2613
+ readonly maxInterStageShaderVariables: number;
2614
+ readonly maxColorAttachments: number;
2615
+ readonly maxColorAttachmentBytesPerSample: number;
2616
+ readonly maxComputeWorkgroupStorageSize: number;
2617
+ readonly maxComputeInvocationsPerWorkgroup: number;
2618
+ readonly maxComputeWorkgroupSizeX: number;
2619
+ readonly maxComputeWorkgroupSizeY: number;
2620
+ readonly maxComputeWorkgroupSizeZ: number;
2621
+ readonly maxComputeWorkgroupsPerDimension: number;
2622
+ }
2623
+
2624
+ declare var GPUSupportedLimits: {
2625
+ prototype: GPUSupportedLimits;
2626
+ };
2627
+
2628
+ interface GPUTexture extends GPUObjectBase {
2629
+ /**
2630
+ * Nominal type branding.
2631
+ * https://github.com/microsoft/TypeScript/pull/33038
2632
+ * @internal
2633
+ */
2634
+ readonly __brand: "GPUTexture";
2635
+ /**
2636
+ * Creates a {@link GPUTextureView}.
2637
+ * @param descriptor - Description of the {@link GPUTextureView} to create.
2638
+ */
2639
+ createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
2640
+ /**
2641
+ * Destroys the {@link GPUTexture}.
2642
+ */
2643
+ destroy(): undefined;
2644
+ /**
2645
+ * The width of this {@link GPUTexture}.
2646
+ */
2647
+ readonly width: GPUIntegerCoordinateOut;
2648
+ /**
2649
+ * The height of this {@link GPUTexture}.
2650
+ */
2651
+ readonly height: GPUIntegerCoordinateOut;
2652
+ /**
2653
+ * The depth or layer count of this {@link GPUTexture}.
2654
+ */
2655
+ readonly depthOrArrayLayers: GPUIntegerCoordinateOut;
2656
+ /**
2657
+ * The number of mip levels of this {@link GPUTexture}.
2658
+ */
2659
+ readonly mipLevelCount: GPUIntegerCoordinateOut;
2660
+ /**
2661
+ * The number of sample count of this {@link GPUTexture}.
2662
+ */
2663
+ readonly sampleCount: GPUSize32Out;
2664
+ /**
2665
+ * The dimension of the set of texel for each of this {@link GPUTexture}'s subresources.
2666
+ */
2667
+ readonly dimension: GPUTextureDimension;
2668
+ /**
2669
+ * The format of this {@link GPUTexture}.
2670
+ */
2671
+ readonly format: GPUTextureFormat;
2672
+ /**
2673
+ * The allowed usages for this {@link GPUTexture}.
2674
+ */
2675
+ readonly usage: GPUFlagsConstant;
2676
+ }
2677
+
2678
+ declare var GPUTexture: {
2679
+ prototype: GPUTexture;
2680
+ };
2681
+
2682
+ interface GPUTextureView extends GPUObjectBase {
2683
+ /**
2684
+ * Nominal type branding.
2685
+ * https://github.com/microsoft/TypeScript/pull/33038
2686
+ * @internal
2687
+ */
2688
+ readonly __brand: "GPUTextureView";
2689
+ }
2690
+
2691
+ declare var GPUTextureView: {
2692
+ prototype: GPUTextureView;
2693
+ };
2694
+
2695
+ interface GPUUncapturedErrorEvent extends Event {
2696
+ /**
2697
+ * Nominal type branding.
2698
+ * https://github.com/microsoft/TypeScript/pull/33038
2699
+ * @internal
2700
+ */
2701
+ readonly __brand: "GPUUncapturedErrorEvent";
2702
+ /**
2703
+ * A slot-backed attribute holding an object representing the error that was uncaptured.
2704
+ * This has the same type as errors returned by {@link GPUDevice#popErrorScope}.
2705
+ */
2706
+ readonly error: GPUError;
2707
+ }
2708
+
2709
+ declare var GPUUncapturedErrorEvent: {
2710
+ prototype: GPUUncapturedErrorEvent;
2711
+ new (
2712
+ type: string,
2713
+ gpuUncapturedErrorEventInitDict: GPUUncapturedErrorEventInit,
2714
+ );
2715
+ };
2716
+
2717
+ interface GPUValidationError extends GPUError {
2718
+ /**
2719
+ * Nominal type branding.
2720
+ * https://github.com/microsoft/TypeScript/pull/33038
2721
+ * @internal
2722
+ */
2723
+ readonly __brand: "GPUValidationError";
2724
+ }
2725
+
2726
+ declare var GPUValidationError: {
2727
+ prototype: GPUValidationError;
2728
+ new (message: string);
2729
+ };
2730
+
2731
+ type WGSLLanguageFeatures = ReadonlySet<string>;
2732
+
2733
+ interface Navigator extends NavigatorGPU {}
2734
+
2735
+ interface WorkerNavigator extends NavigatorGPU {}
2736
+
2737
+ interface GPUBufferUsage {
2738
+ readonly MAP_READ: GPUFlagsConstant;
2739
+ readonly MAP_WRITE: GPUFlagsConstant;
2740
+ readonly COPY_SRC: GPUFlagsConstant;
2741
+ readonly COPY_DST: GPUFlagsConstant;
2742
+ readonly INDEX: GPUFlagsConstant;
2743
+ readonly VERTEX: GPUFlagsConstant;
2744
+ readonly UNIFORM: GPUFlagsConstant;
2745
+ readonly STORAGE: GPUFlagsConstant;
2746
+ readonly INDIRECT: GPUFlagsConstant;
2747
+ readonly QUERY_RESOLVE: GPUFlagsConstant;
2748
+ }
2749
+
2750
+ interface GPUColorWrite {
2751
+ readonly RED: GPUFlagsConstant;
2752
+ readonly GREEN: GPUFlagsConstant;
2753
+ readonly BLUE: GPUFlagsConstant;
2754
+ readonly ALPHA: GPUFlagsConstant;
2755
+ readonly ALL: GPUFlagsConstant;
2756
+ }
2757
+
2758
+ interface GPUMapMode {
2759
+ readonly READ: GPUFlagsConstant;
2760
+ readonly WRITE: GPUFlagsConstant;
2761
+ }
2762
+
2763
+ interface GPUShaderStage {
2764
+ readonly VERTEX: GPUFlagsConstant;
2765
+ readonly FRAGMENT: GPUFlagsConstant;
2766
+ readonly COMPUTE: GPUFlagsConstant;
2767
+ }
2768
+
2769
+ interface GPUTextureUsage {
2770
+ readonly COPY_SRC: GPUFlagsConstant;
2771
+ readonly COPY_DST: GPUFlagsConstant;
2772
+ readonly TEXTURE_BINDING: GPUFlagsConstant;
2773
+ readonly STORAGE_BINDING: GPUFlagsConstant;
2774
+ readonly RENDER_ATTACHMENT: GPUFlagsConstant;
2775
+ }
2776
+
2777
+ type PresentMode = "fifo" | "fifoRelaxed" | "immediate" | "mailbox";
2778
+
2779
+ interface Renderer {
2780
+ getPreferredFormat(): GPUTextureFormat;
2781
+ getAlphaMode(): 'opaque' | 'premultiplied';
2782
+ getCurrentTexture(): GPUTexture;
2783
+ getCurrentTextureView(): GPUTextureView;
2784
+ swap();
2785
+ resize();
2786
+ destroy();
2787
+ }
2788
+
2789
+ interface WebGPU {
2790
+ GPUSupportedFeatures: GPUSupportedFeatures;
2791
+ GPUSupportedLimits: GPUSupportedLimits;
2792
+ GPUCommandBuffer: GPUCommandBuffer;
2793
+ GPUBuffer: GPUBuffer;
2794
+ GPUTextureView: GPUTextureView;
2795
+ GPUTexture: GPUTexture;
2796
+ GPUQueue: GPUQueue;
2797
+ GPUSampler: GPUSampler;
2798
+ GPUExternalTexture: GPUExternalTexture;
2799
+ GPUBindGroupLayout: GPUBindGroupLayout;
2800
+ GPUPipelineLayout: GPUPipelineLayout;
2801
+ GPUBindGroup: GPUBindGroup;
2802
+ GPUCompilationMessage: GPUCompilationMessage;
2803
+ GPUCompilationInfo: GPUCompilationInfo;
2804
+ GPUShaderModule: GPUShaderModule;
2805
+ GPUComputePipeline: GPUComputePipeline;
2806
+ GPURenderPipeline: GPURenderPipeline;
2807
+ GPURenderBundle: GPURenderBundle;
2808
+ GPURenderPassEncoder: GPURenderPassEncoder;
2809
+ GPUQuerySet: GPUQuerySet;
2810
+ GPUComputePassEncoder: GPUComputePassEncoder;
2811
+ GPUCommandEncoder: GPUCommandEncoder;
2812
+ GPURenderBundleEncoder: GPURenderBundleEncoder;
2813
+ GPUDeviceLostInfo: GPUDeviceLostInfo;
2814
+ GPUError: GPUError;
2815
+ GPUDevice: GPUDevice;
2816
+ GPUAdapterInfo: GPUAdapterInfo;
2817
+ GPUAdapter: GPUAdapter;
2818
+ WGSLLanguageFeatures: WGSLLanguageFeatures;
2819
+ GPU: GPU;
2820
+ GPUBufferUsage: GPUBufferUsage;
2821
+ GPUMapMode: GPUMapMode;
2822
+ GPUTextureUsage: GPUTextureUsage;
2823
+ GPUShaderStage: GPUShaderStage;
2824
+ GPUPipelineError: GPUPipelineError;
2825
+ GPUColorWrite: GPUColorWrite;
2826
+ GPUCanvasContext: GPUCanvasContext;
2827
+ GPUValidationError: GPUValidationError;
2828
+ GPUOutOfMemoryError: GPUOutOfMemoryError;
2829
+ GPUInternalError: GPUInternalError;
2830
+ GPUUncapturedErrorEvent: GPUUncapturedErrorEvent;
2831
+
2832
+ createWindowContext(options: {
2833
+ flags: string[];
2834
+ window: any;
2835
+ presentMode?: PresentMode;
2836
+ alphaMode?: "opaque" | "premultiplied";
2837
+ }): {
2838
+ gpu: GPU;
2839
+ adapter: GPUAdapter;
2840
+ device: GPUDevice;
2841
+ renderer: Renderer;
2842
+ };
2843
+ destroy(context: object);
2844
+ }
2845
+
2846
+ declare const gpu: WebGPU;
2847
+ export = gpu;