html2pdf-accessible 0.0.0-stage → 0.1.4

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