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