@types/sharedworker 0.0.213 → 0.0.214

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.
@@ -68,6 +68,27 @@ interface GPUBindingCommandsMixin {
68
68
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup | null, dynamicOffsets?: Iterable<GPUBufferDynamicOffset>): void;
69
69
  }
70
70
 
71
+ interface GPUCommandEncoder {
72
+ /**
73
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
74
+ *
75
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
76
+ */
77
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
78
+ /**
79
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
80
+ *
81
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
82
+ */
83
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
84
+ /**
85
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
86
+ *
87
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
88
+ */
89
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
90
+ }
91
+
71
92
  interface GPUQueue {
72
93
  /**
73
94
  * The **`copyExternalImageToTexture()`** method of the GPUQueue interface copies a snapshot taken from a source image, video, or canvas into a given GPUTexture.
package/ts5.6/index.d.ts CHANGED
@@ -216,6 +216,20 @@ interface FontFaceSetLoadEventInit extends EventInit {
216
216
  fontfaces?: FontFace[];
217
217
  }
218
218
 
219
+ interface GPUCanvasConfiguration {
220
+ alphaMode?: GPUCanvasAlphaMode;
221
+ colorSpace?: PredefinedColorSpace;
222
+ device: GPUDevice;
223
+ format: GPUTextureFormat;
224
+ toneMapping?: GPUCanvasToneMapping;
225
+ usage?: GPUTextureUsageFlags;
226
+ viewFormats?: GPUTextureFormat[];
227
+ }
228
+
229
+ interface GPUCanvasToneMapping {
230
+ mode?: GPUCanvasToneMappingMode;
231
+ }
232
+
219
233
  interface GPUColorDict {
220
234
  a: number;
221
235
  b: number;
@@ -223,6 +237,19 @@ interface GPUColorDict {
223
237
  r: number;
224
238
  }
225
239
 
240
+ interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {
241
+ }
242
+
243
+ interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
244
+ timestampWrites?: GPUComputePassTimestampWrites;
245
+ }
246
+
247
+ interface GPUComputePassTimestampWrites {
248
+ beginningOfPassWriteIndex?: GPUSize32;
249
+ endOfPassWriteIndex?: GPUSize32;
250
+ querySet: GPUQuerySet;
251
+ }
252
+
226
253
  interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
227
254
  colorSpace?: PredefinedColorSpace;
228
255
  premultipliedAlpha?: boolean;
@@ -262,6 +289,45 @@ interface GPUPipelineErrorInit {
262
289
  interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
263
290
  }
264
291
 
292
+ interface GPURenderPassColorAttachment {
293
+ clearValue?: GPUColor;
294
+ depthSlice?: GPUIntegerCoordinate;
295
+ loadOp: GPULoadOp;
296
+ resolveTarget?: GPUTexture | GPUTextureView;
297
+ storeOp: GPUStoreOp;
298
+ view: GPUTexture | GPUTextureView;
299
+ }
300
+
301
+ interface GPURenderPassDepthStencilAttachment {
302
+ depthClearValue?: number;
303
+ depthLoadOp?: GPULoadOp;
304
+ depthReadOnly?: boolean;
305
+ depthStoreOp?: GPUStoreOp;
306
+ stencilClearValue?: GPUStencilValue;
307
+ stencilLoadOp?: GPULoadOp;
308
+ stencilReadOnly?: boolean;
309
+ stencilStoreOp?: GPUStoreOp;
310
+ view: GPUTexture | GPUTextureView;
311
+ }
312
+
313
+ interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
314
+ colorAttachments: (GPURenderPassColorAttachment | null)[];
315
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
316
+ maxDrawCount?: GPUSize64;
317
+ occlusionQuerySet?: GPUQuerySet;
318
+ timestampWrites?: GPURenderPassTimestampWrites;
319
+ }
320
+
321
+ interface GPURenderPassTimestampWrites {
322
+ beginningOfPassWriteIndex?: GPUSize32;
323
+ endOfPassWriteIndex?: GPUSize32;
324
+ querySet: GPUQuerySet;
325
+ }
326
+
327
+ interface GPUTexelCopyBufferInfo extends GPUTexelCopyBufferLayout {
328
+ buffer: GPUBuffer;
329
+ }
330
+
265
331
  interface GPUTexelCopyBufferLayout {
266
332
  bytesPerRow?: GPUSize32;
267
333
  offset?: GPUSize64;
@@ -4077,6 +4143,50 @@ declare var GPUBuffer: {
4077
4143
  new(): GPUBuffer;
4078
4144
  };
4079
4145
 
4146
+ /**
4147
+ * The **`GPUCanvasContext`** interface of the WebGPU API represents the WebGPU rendering context of a <canvas> element, returned via an HTMLCanvasElement.getContext() call with a contextType of "webgpu".
4148
+ * Available only in secure contexts.
4149
+ *
4150
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext)
4151
+ */
4152
+ interface GPUCanvasContext {
4153
+ /**
4154
+ * The **`canvas`** read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.
4155
+ *
4156
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/canvas)
4157
+ */
4158
+ readonly canvas: OffscreenCanvas;
4159
+ /**
4160
+ * The **`configure()`** method of the GPUCanvasContext interface configures the context to use for rendering with a given GPUDevice. When called the canvas will initially be cleared to transparent black.
4161
+ *
4162
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/configure)
4163
+ */
4164
+ configure(configuration: GPUCanvasConfiguration): void;
4165
+ /**
4166
+ * The **`getConfiguration()`** method of the GPUCanvasContext interface returns the current configuration set for the context.
4167
+ *
4168
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getConfiguration)
4169
+ */
4170
+ getConfiguration(): GPUCanvasConfiguration | null;
4171
+ /**
4172
+ * The **`getCurrentTexture()`** method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.
4173
+ *
4174
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getCurrentTexture)
4175
+ */
4176
+ getCurrentTexture(): GPUTexture;
4177
+ /**
4178
+ * The **`unconfigure()`** method of the GPUCanvasContext interface removes any previously-set context configuration, and destroys any textures returned via getCurrentTexture() while the canvas context was configured.
4179
+ *
4180
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/unconfigure)
4181
+ */
4182
+ unconfigure(): void;
4183
+ }
4184
+
4185
+ declare var GPUCanvasContext: {
4186
+ prototype: GPUCanvasContext;
4187
+ new(): GPUCanvasContext;
4188
+ };
4189
+
4080
4190
  /**
4081
4191
  * The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
4082
4192
  * Available only in secure contexts.
@@ -4091,6 +4201,75 @@ declare var GPUCommandBuffer: {
4091
4201
  new(): GPUCommandBuffer;
4092
4202
  };
4093
4203
 
4204
+ /**
4205
+ * The **`GPUCommandEncoder`** interface of the WebGPU API represents an encoder that collects a sequence of GPU commands to be issued to the GPU.
4206
+ * Available only in secure contexts.
4207
+ *
4208
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder)
4209
+ */
4210
+ interface GPUCommandEncoder extends GPUDebugCommandsMixin, GPUObjectBase {
4211
+ /**
4212
+ * The **`beginComputePass()`** method of the GPUCommandEncoder interface starts encoding a compute pass, returning a GPUComputePassEncoder that can be used to control computation.
4213
+ *
4214
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginComputePass)
4215
+ */
4216
+ beginComputePass(descriptor?: GPUComputePassDescriptor): GPUComputePassEncoder;
4217
+ /**
4218
+ * The **`beginRenderPass()`** method of the GPUCommandEncoder interface starts encoding a render pass, returning a GPURenderPassEncoder that can be used to control rendering.
4219
+ *
4220
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginRenderPass)
4221
+ */
4222
+ beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
4223
+ /**
4224
+ * The **`clearBuffer()`** method of the GPUCommandEncoder interface encodes a command that fills a region of a GPUBuffer with zeroes.
4225
+ *
4226
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/clearBuffer)
4227
+ */
4228
+ clearBuffer(buffer: GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
4229
+ /**
4230
+ * The **`copyBufferToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUBuffer to another.
4231
+ *
4232
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)
4233
+ */
4234
+ copyBufferToBuffer(source: GPUBuffer, destination: GPUBuffer, size?: GPUSize64): void;
4235
+ copyBufferToBuffer(source: GPUBuffer, sourceOffset: GPUSize64, destination: GPUBuffer, destinationOffset: GPUSize64, size?: GPUSize64): void;
4236
+ /**
4237
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
4238
+ *
4239
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
4240
+ */
4241
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
4242
+ /**
4243
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
4244
+ *
4245
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
4246
+ */
4247
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: GPUExtent3D): void;
4248
+ /**
4249
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
4250
+ *
4251
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
4252
+ */
4253
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
4254
+ /**
4255
+ * The **`finish()`** method of the GPUCommandEncoder interface completes recording of the command sequence encoded on this GPUCommandEncoder, returning a corresponding GPUCommandBuffer.
4256
+ *
4257
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/finish)
4258
+ */
4259
+ finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
4260
+ /**
4261
+ * The **`resolveQuerySet()`** method of the GPUCommandEncoder interface encodes a command that resolves a GPUQuerySet, copying the results into a specified GPUBuffer.
4262
+ *
4263
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/resolveQuerySet)
4264
+ */
4265
+ resolveQuerySet(querySet: GPUQuerySet, firstQuery: GPUSize32, queryCount: GPUSize32, destination: GPUBuffer, destinationOffset: GPUSize64): void;
4266
+ }
4267
+
4268
+ declare var GPUCommandEncoder: {
4269
+ prototype: GPUCommandEncoder;
4270
+ new(): GPUCommandEncoder;
4271
+ };
4272
+
4094
4273
  /**
4095
4274
  * The **`GPUCompilationInfo`** interface of the WebGPU API represents an array of GPUCompilationMessage objects generated by the GPU shader module compiler to help diagnose problems with shader code.
4096
4275
  * Available only in secure contexts.
@@ -4222,6 +4401,60 @@ interface GPUDebugCommandsMixin {
4222
4401
  pushDebugGroup(groupLabel: string): void;
4223
4402
  }
4224
4403
 
4404
+ interface GPUDeviceEventMap {
4405
+ "uncapturederror": GPUUncapturedErrorEvent;
4406
+ }
4407
+
4408
+ /**
4409
+ * The **`GPUDevice`** interface of the WebGPU API represents a logical GPU device. This is the main interface through which the majority of WebGPU functionality is accessed.
4410
+ * Available only in secure contexts.
4411
+ *
4412
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice)
4413
+ */
4414
+ interface GPUDevice extends EventTarget, GPUObjectBase {
4415
+ /**
4416
+ * The **`adapterInfo`** read-only property of the GPUDevice interface returns a GPUAdapterInfo object containing identifying information about the device's originating adapter.
4417
+ *
4418
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/adapterInfo)
4419
+ */
4420
+ readonly adapterInfo: GPUAdapterInfo;
4421
+ /**
4422
+ * The **`features`** read-only property of the GPUDevice interface returns a GPUSupportedFeatures object that describes additional functionality supported by the device. Only features requested during the creation of the device (i.e., when GPUAdapter.requestDevice() is called) are included.
4423
+ *
4424
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/features)
4425
+ */
4426
+ readonly features: GPUSupportedFeatures;
4427
+ /**
4428
+ * The **`limits`** read-only property of the GPUDevice interface returns a GPUSupportedLimits object that describes the limits supported by the device. All limit values will be included, and the limits requested during the creation of the device (i.e., when GPUAdapter.requestDevice() is called) will be reflected in those values.
4429
+ *
4430
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/limits)
4431
+ */
4432
+ readonly limits: GPUSupportedLimits;
4433
+ /**
4434
+ * The **`lost`** read-only property of the GPUDevice interface contains a Promise that remains pending throughout the device's lifetime and resolves with a GPUDeviceLostInfo object when the device is lost.
4435
+ *
4436
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/lost)
4437
+ */
4438
+ readonly lost: Promise<GPUDeviceLostInfo>;
4439
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/uncapturederror_event) */
4440
+ onuncapturederror: ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any) | null;
4441
+ /**
4442
+ * The **`queue`** read-only property of the GPUDevice interface returns the primary GPUQueue for the device.
4443
+ *
4444
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/queue)
4445
+ */
4446
+ readonly queue: GPUQueue;
4447
+ addEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
4448
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
4449
+ removeEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
4450
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
4451
+ }
4452
+
4453
+ declare var GPUDevice: {
4454
+ prototype: GPUDevice;
4455
+ new(): GPUDevice;
4456
+ };
4457
+
4225
4458
  /**
4226
4459
  * The **`GPUDeviceLostInfo`** interface of the WebGPU API represents the object returned when the GPUDevice.lost Promise resolves. This provides information as to why a device has been lost.
4227
4460
  * Available only in secure contexts.
@@ -12388,7 +12621,7 @@ type ImageDataArray = Uint8ClampedArray;
12388
12621
  type Int32List = Int32Array | GLint[];
12389
12622
  type MessageEventSource = MessagePort | ServiceWorker;
12390
12623
  type NamedCurve = string;
12391
- type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
12624
+ type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext | GPUCanvasContext;
12392
12625
  type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
12393
12626
  type PerformanceEntryList = PerformanceEntry[];
12394
12627
  type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
@@ -12425,11 +12658,15 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
12425
12658
  type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
12426
12659
  type FontFaceSetLoadStatus = "loaded" | "loading";
12427
12660
  type GPUBufferMapState = "mapped" | "pending" | "unmapped";
12661
+ type GPUCanvasAlphaMode = "opaque" | "premultiplied";
12662
+ type GPUCanvasToneMappingMode = "extended" | "standard";
12428
12663
  type GPUCompilationMessageType = "error" | "info" | "warning";
12429
12664
  type GPUDeviceLostReason = "destroyed" | "unknown";
12430
12665
  type GPUIndexFormat = "uint16" | "uint32";
12666
+ type GPULoadOp = "clear" | "load";
12431
12667
  type GPUPipelineErrorReason = "internal" | "validation";
12432
12668
  type GPUQueryType = "occlusion" | "timestamp";
12669
+ type GPUStoreOp = "discard" | "store";
12433
12670
  type GPUTextureAspect = "all" | "depth-only" | "stencil-only";
12434
12671
  type GPUTextureDimension = "1d" | "2d" | "3d";
12435
12672
  type GPUTextureFormat = "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-snorm" | "bc4-r-unorm" | "bc5-rg-snorm" | "bc5-rg-unorm" | "bc6h-rgb-float" | "bc6h-rgb-ufloat" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "bgra8unorm" | "bgra8unorm-srgb" | "depth16unorm" | "depth24plus" | "depth24plus-stencil8" | "depth32float" | "depth32float-stencil8" | "eac-r11snorm" | "eac-r11unorm" | "eac-rg11snorm" | "eac-rg11unorm" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "r16float" | "r16sint" | "r16snorm" | "r16uint" | "r16unorm" | "r32float" | "r32sint" | "r32uint" | "r8sint" | "r8snorm" | "r8uint" | "r8unorm" | "rg11b10ufloat" | "rg16float" | "rg16sint" | "rg16snorm" | "rg16uint" | "rg16unorm" | "rg32float" | "rg32sint" | "rg32uint" | "rg8sint" | "rg8snorm" | "rg8uint" | "rg8unorm" | "rgb10a2uint" | "rgb10a2unorm" | "rgb9e5ufloat" | "rgba16float" | "rgba16sint" | "rgba16snorm" | "rgba16uint" | "rgba16unorm" | "rgba32float" | "rgba32sint" | "rgba32uint" | "rgba8sint" | "rgba8snorm" | "rgba8uint" | "rgba8unorm" | "rgba8unorm-srgb" | "stencil8";
@@ -72,6 +72,27 @@ interface GPUBindingCommandsMixin {
72
72
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup | null, dynamicOffsets?: Iterable<GPUBufferDynamicOffset>): void;
73
73
  }
74
74
 
75
+ interface GPUCommandEncoder {
76
+ /**
77
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
78
+ *
79
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
80
+ */
81
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
82
+ /**
83
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
84
+ *
85
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
86
+ */
87
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
88
+ /**
89
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
90
+ *
91
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
92
+ */
93
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
94
+ }
95
+
75
96
  interface GPUQueue {
76
97
  /**
77
98
  * The **`copyExternalImageToTexture()`** method of the GPUQueue interface copies a snapshot taken from a source image, video, or canvas into a given GPUTexture.
package/ts5.9/index.d.ts CHANGED
@@ -216,6 +216,20 @@ interface FontFaceSetLoadEventInit extends EventInit {
216
216
  fontfaces?: FontFace[];
217
217
  }
218
218
 
219
+ interface GPUCanvasConfiguration {
220
+ alphaMode?: GPUCanvasAlphaMode;
221
+ colorSpace?: PredefinedColorSpace;
222
+ device: GPUDevice;
223
+ format: GPUTextureFormat;
224
+ toneMapping?: GPUCanvasToneMapping;
225
+ usage?: GPUTextureUsageFlags;
226
+ viewFormats?: GPUTextureFormat[];
227
+ }
228
+
229
+ interface GPUCanvasToneMapping {
230
+ mode?: GPUCanvasToneMappingMode;
231
+ }
232
+
219
233
  interface GPUColorDict {
220
234
  a: number;
221
235
  b: number;
@@ -223,6 +237,19 @@ interface GPUColorDict {
223
237
  r: number;
224
238
  }
225
239
 
240
+ interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {
241
+ }
242
+
243
+ interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
244
+ timestampWrites?: GPUComputePassTimestampWrites;
245
+ }
246
+
247
+ interface GPUComputePassTimestampWrites {
248
+ beginningOfPassWriteIndex?: GPUSize32;
249
+ endOfPassWriteIndex?: GPUSize32;
250
+ querySet: GPUQuerySet;
251
+ }
252
+
226
253
  interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
227
254
  colorSpace?: PredefinedColorSpace;
228
255
  premultipliedAlpha?: boolean;
@@ -262,6 +289,45 @@ interface GPUPipelineErrorInit {
262
289
  interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
263
290
  }
264
291
 
292
+ interface GPURenderPassColorAttachment {
293
+ clearValue?: GPUColor;
294
+ depthSlice?: GPUIntegerCoordinate;
295
+ loadOp: GPULoadOp;
296
+ resolveTarget?: GPUTexture | GPUTextureView;
297
+ storeOp: GPUStoreOp;
298
+ view: GPUTexture | GPUTextureView;
299
+ }
300
+
301
+ interface GPURenderPassDepthStencilAttachment {
302
+ depthClearValue?: number;
303
+ depthLoadOp?: GPULoadOp;
304
+ depthReadOnly?: boolean;
305
+ depthStoreOp?: GPUStoreOp;
306
+ stencilClearValue?: GPUStencilValue;
307
+ stencilLoadOp?: GPULoadOp;
308
+ stencilReadOnly?: boolean;
309
+ stencilStoreOp?: GPUStoreOp;
310
+ view: GPUTexture | GPUTextureView;
311
+ }
312
+
313
+ interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
314
+ colorAttachments: (GPURenderPassColorAttachment | null)[];
315
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
316
+ maxDrawCount?: GPUSize64;
317
+ occlusionQuerySet?: GPUQuerySet;
318
+ timestampWrites?: GPURenderPassTimestampWrites;
319
+ }
320
+
321
+ interface GPURenderPassTimestampWrites {
322
+ beginningOfPassWriteIndex?: GPUSize32;
323
+ endOfPassWriteIndex?: GPUSize32;
324
+ querySet: GPUQuerySet;
325
+ }
326
+
327
+ interface GPUTexelCopyBufferInfo extends GPUTexelCopyBufferLayout {
328
+ buffer: GPUBuffer;
329
+ }
330
+
265
331
  interface GPUTexelCopyBufferLayout {
266
332
  bytesPerRow?: GPUSize32;
267
333
  offset?: GPUSize64;
@@ -4077,6 +4143,50 @@ declare var GPUBuffer: {
4077
4143
  new(): GPUBuffer;
4078
4144
  };
4079
4145
 
4146
+ /**
4147
+ * The **`GPUCanvasContext`** interface of the WebGPU API represents the WebGPU rendering context of a <canvas> element, returned via an HTMLCanvasElement.getContext() call with a contextType of "webgpu".
4148
+ * Available only in secure contexts.
4149
+ *
4150
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext)
4151
+ */
4152
+ interface GPUCanvasContext {
4153
+ /**
4154
+ * The **`canvas`** read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.
4155
+ *
4156
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/canvas)
4157
+ */
4158
+ readonly canvas: OffscreenCanvas;
4159
+ /**
4160
+ * The **`configure()`** method of the GPUCanvasContext interface configures the context to use for rendering with a given GPUDevice. When called the canvas will initially be cleared to transparent black.
4161
+ *
4162
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/configure)
4163
+ */
4164
+ configure(configuration: GPUCanvasConfiguration): void;
4165
+ /**
4166
+ * The **`getConfiguration()`** method of the GPUCanvasContext interface returns the current configuration set for the context.
4167
+ *
4168
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getConfiguration)
4169
+ */
4170
+ getConfiguration(): GPUCanvasConfiguration | null;
4171
+ /**
4172
+ * The **`getCurrentTexture()`** method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.
4173
+ *
4174
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getCurrentTexture)
4175
+ */
4176
+ getCurrentTexture(): GPUTexture;
4177
+ /**
4178
+ * The **`unconfigure()`** method of the GPUCanvasContext interface removes any previously-set context configuration, and destroys any textures returned via getCurrentTexture() while the canvas context was configured.
4179
+ *
4180
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/unconfigure)
4181
+ */
4182
+ unconfigure(): void;
4183
+ }
4184
+
4185
+ declare var GPUCanvasContext: {
4186
+ prototype: GPUCanvasContext;
4187
+ new(): GPUCanvasContext;
4188
+ };
4189
+
4080
4190
  /**
4081
4191
  * The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
4082
4192
  * Available only in secure contexts.
@@ -4091,6 +4201,75 @@ declare var GPUCommandBuffer: {
4091
4201
  new(): GPUCommandBuffer;
4092
4202
  };
4093
4203
 
4204
+ /**
4205
+ * The **`GPUCommandEncoder`** interface of the WebGPU API represents an encoder that collects a sequence of GPU commands to be issued to the GPU.
4206
+ * Available only in secure contexts.
4207
+ *
4208
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder)
4209
+ */
4210
+ interface GPUCommandEncoder extends GPUDebugCommandsMixin, GPUObjectBase {
4211
+ /**
4212
+ * The **`beginComputePass()`** method of the GPUCommandEncoder interface starts encoding a compute pass, returning a GPUComputePassEncoder that can be used to control computation.
4213
+ *
4214
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginComputePass)
4215
+ */
4216
+ beginComputePass(descriptor?: GPUComputePassDescriptor): GPUComputePassEncoder;
4217
+ /**
4218
+ * The **`beginRenderPass()`** method of the GPUCommandEncoder interface starts encoding a render pass, returning a GPURenderPassEncoder that can be used to control rendering.
4219
+ *
4220
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginRenderPass)
4221
+ */
4222
+ beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
4223
+ /**
4224
+ * The **`clearBuffer()`** method of the GPUCommandEncoder interface encodes a command that fills a region of a GPUBuffer with zeroes.
4225
+ *
4226
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/clearBuffer)
4227
+ */
4228
+ clearBuffer(buffer: GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
4229
+ /**
4230
+ * The **`copyBufferToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUBuffer to another.
4231
+ *
4232
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)
4233
+ */
4234
+ copyBufferToBuffer(source: GPUBuffer, destination: GPUBuffer, size?: GPUSize64): void;
4235
+ copyBufferToBuffer(source: GPUBuffer, sourceOffset: GPUSize64, destination: GPUBuffer, destinationOffset: GPUSize64, size?: GPUSize64): void;
4236
+ /**
4237
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
4238
+ *
4239
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
4240
+ */
4241
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
4242
+ /**
4243
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
4244
+ *
4245
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
4246
+ */
4247
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: GPUExtent3D): void;
4248
+ /**
4249
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
4250
+ *
4251
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
4252
+ */
4253
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
4254
+ /**
4255
+ * The **`finish()`** method of the GPUCommandEncoder interface completes recording of the command sequence encoded on this GPUCommandEncoder, returning a corresponding GPUCommandBuffer.
4256
+ *
4257
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/finish)
4258
+ */
4259
+ finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
4260
+ /**
4261
+ * The **`resolveQuerySet()`** method of the GPUCommandEncoder interface encodes a command that resolves a GPUQuerySet, copying the results into a specified GPUBuffer.
4262
+ *
4263
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/resolveQuerySet)
4264
+ */
4265
+ resolveQuerySet(querySet: GPUQuerySet, firstQuery: GPUSize32, queryCount: GPUSize32, destination: GPUBuffer, destinationOffset: GPUSize64): void;
4266
+ }
4267
+
4268
+ declare var GPUCommandEncoder: {
4269
+ prototype: GPUCommandEncoder;
4270
+ new(): GPUCommandEncoder;
4271
+ };
4272
+
4094
4273
  /**
4095
4274
  * The **`GPUCompilationInfo`** interface of the WebGPU API represents an array of GPUCompilationMessage objects generated by the GPU shader module compiler to help diagnose problems with shader code.
4096
4275
  * Available only in secure contexts.
@@ -4222,6 +4401,60 @@ interface GPUDebugCommandsMixin {
4222
4401
  pushDebugGroup(groupLabel: string): void;
4223
4402
  }
4224
4403
 
4404
+ interface GPUDeviceEventMap {
4405
+ "uncapturederror": GPUUncapturedErrorEvent;
4406
+ }
4407
+
4408
+ /**
4409
+ * The **`GPUDevice`** interface of the WebGPU API represents a logical GPU device. This is the main interface through which the majority of WebGPU functionality is accessed.
4410
+ * Available only in secure contexts.
4411
+ *
4412
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice)
4413
+ */
4414
+ interface GPUDevice extends EventTarget, GPUObjectBase {
4415
+ /**
4416
+ * The **`adapterInfo`** read-only property of the GPUDevice interface returns a GPUAdapterInfo object containing identifying information about the device's originating adapter.
4417
+ *
4418
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/adapterInfo)
4419
+ */
4420
+ readonly adapterInfo: GPUAdapterInfo;
4421
+ /**
4422
+ * The **`features`** read-only property of the GPUDevice interface returns a GPUSupportedFeatures object that describes additional functionality supported by the device. Only features requested during the creation of the device (i.e., when GPUAdapter.requestDevice() is called) are included.
4423
+ *
4424
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/features)
4425
+ */
4426
+ readonly features: GPUSupportedFeatures;
4427
+ /**
4428
+ * The **`limits`** read-only property of the GPUDevice interface returns a GPUSupportedLimits object that describes the limits supported by the device. All limit values will be included, and the limits requested during the creation of the device (i.e., when GPUAdapter.requestDevice() is called) will be reflected in those values.
4429
+ *
4430
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/limits)
4431
+ */
4432
+ readonly limits: GPUSupportedLimits;
4433
+ /**
4434
+ * The **`lost`** read-only property of the GPUDevice interface contains a Promise that remains pending throughout the device's lifetime and resolves with a GPUDeviceLostInfo object when the device is lost.
4435
+ *
4436
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/lost)
4437
+ */
4438
+ readonly lost: Promise<GPUDeviceLostInfo>;
4439
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/uncapturederror_event) */
4440
+ onuncapturederror: ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any) | null;
4441
+ /**
4442
+ * The **`queue`** read-only property of the GPUDevice interface returns the primary GPUQueue for the device.
4443
+ *
4444
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/queue)
4445
+ */
4446
+ readonly queue: GPUQueue;
4447
+ addEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
4448
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
4449
+ removeEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
4450
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
4451
+ }
4452
+
4453
+ declare var GPUDevice: {
4454
+ prototype: GPUDevice;
4455
+ new(): GPUDevice;
4456
+ };
4457
+
4225
4458
  /**
4226
4459
  * The **`GPUDeviceLostInfo`** interface of the WebGPU API represents the object returned when the GPUDevice.lost Promise resolves. This provides information as to why a device has been lost.
4227
4460
  * Available only in secure contexts.
@@ -12388,7 +12621,7 @@ type ImageDataArray = Uint8ClampedArray<ArrayBuffer>;
12388
12621
  type Int32List = Int32Array<ArrayBufferLike> | GLint[];
12389
12622
  type MessageEventSource = MessagePort | ServiceWorker;
12390
12623
  type NamedCurve = string;
12391
- type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
12624
+ type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext | GPUCanvasContext;
12392
12625
  type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
12393
12626
  type PerformanceEntryList = PerformanceEntry[];
12394
12627
  type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
@@ -12425,11 +12658,15 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
12425
12658
  type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
12426
12659
  type FontFaceSetLoadStatus = "loaded" | "loading";
12427
12660
  type GPUBufferMapState = "mapped" | "pending" | "unmapped";
12661
+ type GPUCanvasAlphaMode = "opaque" | "premultiplied";
12662
+ type GPUCanvasToneMappingMode = "extended" | "standard";
12428
12663
  type GPUCompilationMessageType = "error" | "info" | "warning";
12429
12664
  type GPUDeviceLostReason = "destroyed" | "unknown";
12430
12665
  type GPUIndexFormat = "uint16" | "uint32";
12666
+ type GPULoadOp = "clear" | "load";
12431
12667
  type GPUPipelineErrorReason = "internal" | "validation";
12432
12668
  type GPUQueryType = "occlusion" | "timestamp";
12669
+ type GPUStoreOp = "discard" | "store";
12433
12670
  type GPUTextureAspect = "all" | "depth-only" | "stencil-only";
12434
12671
  type GPUTextureDimension = "1d" | "2d" | "3d";
12435
12672
  type GPUTextureFormat = "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-snorm" | "bc4-r-unorm" | "bc5-rg-snorm" | "bc5-rg-unorm" | "bc6h-rgb-float" | "bc6h-rgb-ufloat" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "bgra8unorm" | "bgra8unorm-srgb" | "depth16unorm" | "depth24plus" | "depth24plus-stencil8" | "depth32float" | "depth32float-stencil8" | "eac-r11snorm" | "eac-r11unorm" | "eac-rg11snorm" | "eac-rg11unorm" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "r16float" | "r16sint" | "r16snorm" | "r16uint" | "r16unorm" | "r32float" | "r32sint" | "r32uint" | "r8sint" | "r8snorm" | "r8uint" | "r8unorm" | "rg11b10ufloat" | "rg16float" | "rg16sint" | "rg16snorm" | "rg16uint" | "rg16unorm" | "rg32float" | "rg32sint" | "rg32uint" | "rg8sint" | "rg8snorm" | "rg8uint" | "rg8unorm" | "rgb10a2uint" | "rgb10a2unorm" | "rgb9e5ufloat" | "rgba16float" | "rgba16sint" | "rgba16snorm" | "rgba16uint" | "rgba16unorm" | "rgba32float" | "rgba32sint" | "rgba32uint" | "rgba8sint" | "rgba8snorm" | "rgba8uint" | "rgba8unorm" | "rgba8unorm-srgb" | "stencil8";