@types/webworker 0.0.63 → 0.0.64

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.
@@ -83,6 +83,27 @@ interface GPUBindingCommandsMixin {
83
83
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup | null, dynamicOffsets?: Iterable<GPUBufferDynamicOffset>): void;
84
84
  }
85
85
 
86
+ interface GPUCommandEncoder {
87
+ /**
88
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
89
+ *
90
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
91
+ */
92
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
93
+ /**
94
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
95
+ *
96
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
97
+ */
98
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
99
+ /**
100
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
101
+ *
102
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
103
+ */
104
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
105
+ }
106
+
86
107
  interface GPUQueue {
87
108
  /**
88
109
  * 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
@@ -362,6 +362,20 @@ interface FontFaceSetLoadEventInit extends EventInit {
362
362
  fontfaces?: FontFace[];
363
363
  }
364
364
 
365
+ interface GPUCanvasConfiguration {
366
+ alphaMode?: GPUCanvasAlphaMode;
367
+ colorSpace?: PredefinedColorSpace;
368
+ device: GPUDevice;
369
+ format: GPUTextureFormat;
370
+ toneMapping?: GPUCanvasToneMapping;
371
+ usage?: GPUTextureUsageFlags;
372
+ viewFormats?: GPUTextureFormat[];
373
+ }
374
+
375
+ interface GPUCanvasToneMapping {
376
+ mode?: GPUCanvasToneMappingMode;
377
+ }
378
+
365
379
  interface GPUColorDict {
366
380
  a: number;
367
381
  b: number;
@@ -369,6 +383,19 @@ interface GPUColorDict {
369
383
  r: number;
370
384
  }
371
385
 
386
+ interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {
387
+ }
388
+
389
+ interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
390
+ timestampWrites?: GPUComputePassTimestampWrites;
391
+ }
392
+
393
+ interface GPUComputePassTimestampWrites {
394
+ beginningOfPassWriteIndex?: GPUSize32;
395
+ endOfPassWriteIndex?: GPUSize32;
396
+ querySet: GPUQuerySet;
397
+ }
398
+
372
399
  interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
373
400
  colorSpace?: PredefinedColorSpace;
374
401
  premultipliedAlpha?: boolean;
@@ -408,6 +435,45 @@ interface GPUPipelineErrorInit {
408
435
  interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
409
436
  }
410
437
 
438
+ interface GPURenderPassColorAttachment {
439
+ clearValue?: GPUColor;
440
+ depthSlice?: GPUIntegerCoordinate;
441
+ loadOp: GPULoadOp;
442
+ resolveTarget?: GPUTexture | GPUTextureView;
443
+ storeOp: GPUStoreOp;
444
+ view: GPUTexture | GPUTextureView;
445
+ }
446
+
447
+ interface GPURenderPassDepthStencilAttachment {
448
+ depthClearValue?: number;
449
+ depthLoadOp?: GPULoadOp;
450
+ depthReadOnly?: boolean;
451
+ depthStoreOp?: GPUStoreOp;
452
+ stencilClearValue?: GPUStencilValue;
453
+ stencilLoadOp?: GPULoadOp;
454
+ stencilReadOnly?: boolean;
455
+ stencilStoreOp?: GPUStoreOp;
456
+ view: GPUTexture | GPUTextureView;
457
+ }
458
+
459
+ interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
460
+ colorAttachments: (GPURenderPassColorAttachment | null)[];
461
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
462
+ maxDrawCount?: GPUSize64;
463
+ occlusionQuerySet?: GPUQuerySet;
464
+ timestampWrites?: GPURenderPassTimestampWrites;
465
+ }
466
+
467
+ interface GPURenderPassTimestampWrites {
468
+ beginningOfPassWriteIndex?: GPUSize32;
469
+ endOfPassWriteIndex?: GPUSize32;
470
+ querySet: GPUQuerySet;
471
+ }
472
+
473
+ interface GPUTexelCopyBufferInfo extends GPUTexelCopyBufferLayout {
474
+ buffer: GPUBuffer;
475
+ }
476
+
411
477
  interface GPUTexelCopyBufferLayout {
412
478
  bytesPerRow?: GPUSize32;
413
479
  offset?: GPUSize64;
@@ -5096,6 +5162,50 @@ declare var GPUBuffer: {
5096
5162
  new(): GPUBuffer;
5097
5163
  };
5098
5164
 
5165
+ /**
5166
+ * 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".
5167
+ * Available only in secure contexts.
5168
+ *
5169
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext)
5170
+ */
5171
+ interface GPUCanvasContext {
5172
+ /**
5173
+ * The **`canvas`** read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.
5174
+ *
5175
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/canvas)
5176
+ */
5177
+ readonly canvas: OffscreenCanvas;
5178
+ /**
5179
+ * 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.
5180
+ *
5181
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/configure)
5182
+ */
5183
+ configure(configuration: GPUCanvasConfiguration): void;
5184
+ /**
5185
+ * The **`getConfiguration()`** method of the GPUCanvasContext interface returns the current configuration set for the context.
5186
+ *
5187
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getConfiguration)
5188
+ */
5189
+ getConfiguration(): GPUCanvasConfiguration | null;
5190
+ /**
5191
+ * The **`getCurrentTexture()`** method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.
5192
+ *
5193
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getCurrentTexture)
5194
+ */
5195
+ getCurrentTexture(): GPUTexture;
5196
+ /**
5197
+ * 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.
5198
+ *
5199
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/unconfigure)
5200
+ */
5201
+ unconfigure(): void;
5202
+ }
5203
+
5204
+ declare var GPUCanvasContext: {
5205
+ prototype: GPUCanvasContext;
5206
+ new(): GPUCanvasContext;
5207
+ };
5208
+
5099
5209
  /**
5100
5210
  * The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
5101
5211
  * Available only in secure contexts.
@@ -5110,6 +5220,75 @@ declare var GPUCommandBuffer: {
5110
5220
  new(): GPUCommandBuffer;
5111
5221
  };
5112
5222
 
5223
+ /**
5224
+ * The **`GPUCommandEncoder`** interface of the WebGPU API represents an encoder that collects a sequence of GPU commands to be issued to the GPU.
5225
+ * Available only in secure contexts.
5226
+ *
5227
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder)
5228
+ */
5229
+ interface GPUCommandEncoder extends GPUDebugCommandsMixin, GPUObjectBase {
5230
+ /**
5231
+ * The **`beginComputePass()`** method of the GPUCommandEncoder interface starts encoding a compute pass, returning a GPUComputePassEncoder that can be used to control computation.
5232
+ *
5233
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginComputePass)
5234
+ */
5235
+ beginComputePass(descriptor?: GPUComputePassDescriptor): GPUComputePassEncoder;
5236
+ /**
5237
+ * The **`beginRenderPass()`** method of the GPUCommandEncoder interface starts encoding a render pass, returning a GPURenderPassEncoder that can be used to control rendering.
5238
+ *
5239
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginRenderPass)
5240
+ */
5241
+ beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
5242
+ /**
5243
+ * The **`clearBuffer()`** method of the GPUCommandEncoder interface encodes a command that fills a region of a GPUBuffer with zeroes.
5244
+ *
5245
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/clearBuffer)
5246
+ */
5247
+ clearBuffer(buffer: GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
5248
+ /**
5249
+ * The **`copyBufferToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUBuffer to another.
5250
+ *
5251
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)
5252
+ */
5253
+ copyBufferToBuffer(source: GPUBuffer, destination: GPUBuffer, size?: GPUSize64): void;
5254
+ copyBufferToBuffer(source: GPUBuffer, sourceOffset: GPUSize64, destination: GPUBuffer, destinationOffset: GPUSize64, size?: GPUSize64): void;
5255
+ /**
5256
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
5257
+ *
5258
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
5259
+ */
5260
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
5261
+ /**
5262
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
5263
+ *
5264
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
5265
+ */
5266
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: GPUExtent3D): void;
5267
+ /**
5268
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
5269
+ *
5270
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
5271
+ */
5272
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
5273
+ /**
5274
+ * The **`finish()`** method of the GPUCommandEncoder interface completes recording of the command sequence encoded on this GPUCommandEncoder, returning a corresponding GPUCommandBuffer.
5275
+ *
5276
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/finish)
5277
+ */
5278
+ finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
5279
+ /**
5280
+ * The **`resolveQuerySet()`** method of the GPUCommandEncoder interface encodes a command that resolves a GPUQuerySet, copying the results into a specified GPUBuffer.
5281
+ *
5282
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/resolveQuerySet)
5283
+ */
5284
+ resolveQuerySet(querySet: GPUQuerySet, firstQuery: GPUSize32, queryCount: GPUSize32, destination: GPUBuffer, destinationOffset: GPUSize64): void;
5285
+ }
5286
+
5287
+ declare var GPUCommandEncoder: {
5288
+ prototype: GPUCommandEncoder;
5289
+ new(): GPUCommandEncoder;
5290
+ };
5291
+
5113
5292
  /**
5114
5293
  * 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.
5115
5294
  * Available only in secure contexts.
@@ -5241,6 +5420,60 @@ interface GPUDebugCommandsMixin {
5241
5420
  pushDebugGroup(groupLabel: string): void;
5242
5421
  }
5243
5422
 
5423
+ interface GPUDeviceEventMap {
5424
+ "uncapturederror": GPUUncapturedErrorEvent;
5425
+ }
5426
+
5427
+ /**
5428
+ * 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.
5429
+ * Available only in secure contexts.
5430
+ *
5431
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice)
5432
+ */
5433
+ interface GPUDevice extends EventTarget, GPUObjectBase {
5434
+ /**
5435
+ * The **`adapterInfo`** read-only property of the GPUDevice interface returns a GPUAdapterInfo object containing identifying information about the device's originating adapter.
5436
+ *
5437
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/adapterInfo)
5438
+ */
5439
+ readonly adapterInfo: GPUAdapterInfo;
5440
+ /**
5441
+ * 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.
5442
+ *
5443
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/features)
5444
+ */
5445
+ readonly features: GPUSupportedFeatures;
5446
+ /**
5447
+ * 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.
5448
+ *
5449
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/limits)
5450
+ */
5451
+ readonly limits: GPUSupportedLimits;
5452
+ /**
5453
+ * 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.
5454
+ *
5455
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/lost)
5456
+ */
5457
+ readonly lost: Promise<GPUDeviceLostInfo>;
5458
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/uncapturederror_event) */
5459
+ onuncapturederror: ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any) | null;
5460
+ /**
5461
+ * The **`queue`** read-only property of the GPUDevice interface returns the primary GPUQueue for the device.
5462
+ *
5463
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/queue)
5464
+ */
5465
+ readonly queue: GPUQueue;
5466
+ addEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
5467
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
5468
+ removeEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
5469
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
5470
+ }
5471
+
5472
+ declare var GPUDevice: {
5473
+ prototype: GPUDevice;
5474
+ new(): GPUDevice;
5475
+ };
5476
+
5244
5477
  /**
5245
5478
  * 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.
5246
5479
  * Available only in secure contexts.
@@ -14396,7 +14629,7 @@ type ImageDataArray = Uint8ClampedArray;
14396
14629
  type Int32List = Int32Array | GLint[];
14397
14630
  type MessageEventSource = MessagePort | ServiceWorker;
14398
14631
  type NamedCurve = string;
14399
- type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
14632
+ type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext | GPUCanvasContext;
14400
14633
  type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
14401
14634
  type PerformanceEntryList = PerformanceEntry[];
14402
14635
  type PushMessageDataInit = BufferSource | string;
@@ -14445,11 +14678,15 @@ type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
14445
14678
  type FontFaceSetLoadStatus = "loaded" | "loading";
14446
14679
  type FrameType = "auxiliary" | "nested" | "none" | "top-level";
14447
14680
  type GPUBufferMapState = "mapped" | "pending" | "unmapped";
14681
+ type GPUCanvasAlphaMode = "opaque" | "premultiplied";
14682
+ type GPUCanvasToneMappingMode = "extended" | "standard";
14448
14683
  type GPUCompilationMessageType = "error" | "info" | "warning";
14449
14684
  type GPUDeviceLostReason = "destroyed" | "unknown";
14450
14685
  type GPUIndexFormat = "uint16" | "uint32";
14686
+ type GPULoadOp = "clear" | "load";
14451
14687
  type GPUPipelineErrorReason = "internal" | "validation";
14452
14688
  type GPUQueryType = "occlusion" | "timestamp";
14689
+ type GPUStoreOp = "discard" | "store";
14453
14690
  type GPUTextureAspect = "all" | "depth-only" | "stencil-only";
14454
14691
  type GPUTextureDimension = "1d" | "2d" | "3d";
14455
14692
  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";
@@ -87,6 +87,27 @@ interface GPUBindingCommandsMixin {
87
87
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup | null, dynamicOffsets?: Iterable<GPUBufferDynamicOffset>): void;
88
88
  }
89
89
 
90
+ interface GPUCommandEncoder {
91
+ /**
92
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
93
+ *
94
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
95
+ */
96
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
97
+ /**
98
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
99
+ *
100
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
101
+ */
102
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
103
+ /**
104
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
105
+ *
106
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
107
+ */
108
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: Iterable<GPUIntegerCoordinate>): void;
109
+ }
110
+
90
111
  interface GPUQueue {
91
112
  /**
92
113
  * 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
@@ -362,6 +362,20 @@ interface FontFaceSetLoadEventInit extends EventInit {
362
362
  fontfaces?: FontFace[];
363
363
  }
364
364
 
365
+ interface GPUCanvasConfiguration {
366
+ alphaMode?: GPUCanvasAlphaMode;
367
+ colorSpace?: PredefinedColorSpace;
368
+ device: GPUDevice;
369
+ format: GPUTextureFormat;
370
+ toneMapping?: GPUCanvasToneMapping;
371
+ usage?: GPUTextureUsageFlags;
372
+ viewFormats?: GPUTextureFormat[];
373
+ }
374
+
375
+ interface GPUCanvasToneMapping {
376
+ mode?: GPUCanvasToneMappingMode;
377
+ }
378
+
365
379
  interface GPUColorDict {
366
380
  a: number;
367
381
  b: number;
@@ -369,6 +383,19 @@ interface GPUColorDict {
369
383
  r: number;
370
384
  }
371
385
 
386
+ interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {
387
+ }
388
+
389
+ interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
390
+ timestampWrites?: GPUComputePassTimestampWrites;
391
+ }
392
+
393
+ interface GPUComputePassTimestampWrites {
394
+ beginningOfPassWriteIndex?: GPUSize32;
395
+ endOfPassWriteIndex?: GPUSize32;
396
+ querySet: GPUQuerySet;
397
+ }
398
+
372
399
  interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
373
400
  colorSpace?: PredefinedColorSpace;
374
401
  premultipliedAlpha?: boolean;
@@ -408,6 +435,45 @@ interface GPUPipelineErrorInit {
408
435
  interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
409
436
  }
410
437
 
438
+ interface GPURenderPassColorAttachment {
439
+ clearValue?: GPUColor;
440
+ depthSlice?: GPUIntegerCoordinate;
441
+ loadOp: GPULoadOp;
442
+ resolveTarget?: GPUTexture | GPUTextureView;
443
+ storeOp: GPUStoreOp;
444
+ view: GPUTexture | GPUTextureView;
445
+ }
446
+
447
+ interface GPURenderPassDepthStencilAttachment {
448
+ depthClearValue?: number;
449
+ depthLoadOp?: GPULoadOp;
450
+ depthReadOnly?: boolean;
451
+ depthStoreOp?: GPUStoreOp;
452
+ stencilClearValue?: GPUStencilValue;
453
+ stencilLoadOp?: GPULoadOp;
454
+ stencilReadOnly?: boolean;
455
+ stencilStoreOp?: GPUStoreOp;
456
+ view: GPUTexture | GPUTextureView;
457
+ }
458
+
459
+ interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
460
+ colorAttachments: (GPURenderPassColorAttachment | null)[];
461
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
462
+ maxDrawCount?: GPUSize64;
463
+ occlusionQuerySet?: GPUQuerySet;
464
+ timestampWrites?: GPURenderPassTimestampWrites;
465
+ }
466
+
467
+ interface GPURenderPassTimestampWrites {
468
+ beginningOfPassWriteIndex?: GPUSize32;
469
+ endOfPassWriteIndex?: GPUSize32;
470
+ querySet: GPUQuerySet;
471
+ }
472
+
473
+ interface GPUTexelCopyBufferInfo extends GPUTexelCopyBufferLayout {
474
+ buffer: GPUBuffer;
475
+ }
476
+
411
477
  interface GPUTexelCopyBufferLayout {
412
478
  bytesPerRow?: GPUSize32;
413
479
  offset?: GPUSize64;
@@ -5096,6 +5162,50 @@ declare var GPUBuffer: {
5096
5162
  new(): GPUBuffer;
5097
5163
  };
5098
5164
 
5165
+ /**
5166
+ * 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".
5167
+ * Available only in secure contexts.
5168
+ *
5169
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext)
5170
+ */
5171
+ interface GPUCanvasContext {
5172
+ /**
5173
+ * The **`canvas`** read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.
5174
+ *
5175
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/canvas)
5176
+ */
5177
+ readonly canvas: OffscreenCanvas;
5178
+ /**
5179
+ * 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.
5180
+ *
5181
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/configure)
5182
+ */
5183
+ configure(configuration: GPUCanvasConfiguration): void;
5184
+ /**
5185
+ * The **`getConfiguration()`** method of the GPUCanvasContext interface returns the current configuration set for the context.
5186
+ *
5187
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getConfiguration)
5188
+ */
5189
+ getConfiguration(): GPUCanvasConfiguration | null;
5190
+ /**
5191
+ * The **`getCurrentTexture()`** method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.
5192
+ *
5193
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getCurrentTexture)
5194
+ */
5195
+ getCurrentTexture(): GPUTexture;
5196
+ /**
5197
+ * 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.
5198
+ *
5199
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/unconfigure)
5200
+ */
5201
+ unconfigure(): void;
5202
+ }
5203
+
5204
+ declare var GPUCanvasContext: {
5205
+ prototype: GPUCanvasContext;
5206
+ new(): GPUCanvasContext;
5207
+ };
5208
+
5099
5209
  /**
5100
5210
  * The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
5101
5211
  * Available only in secure contexts.
@@ -5110,6 +5220,75 @@ declare var GPUCommandBuffer: {
5110
5220
  new(): GPUCommandBuffer;
5111
5221
  };
5112
5222
 
5223
+ /**
5224
+ * The **`GPUCommandEncoder`** interface of the WebGPU API represents an encoder that collects a sequence of GPU commands to be issued to the GPU.
5225
+ * Available only in secure contexts.
5226
+ *
5227
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder)
5228
+ */
5229
+ interface GPUCommandEncoder extends GPUDebugCommandsMixin, GPUObjectBase {
5230
+ /**
5231
+ * The **`beginComputePass()`** method of the GPUCommandEncoder interface starts encoding a compute pass, returning a GPUComputePassEncoder that can be used to control computation.
5232
+ *
5233
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginComputePass)
5234
+ */
5235
+ beginComputePass(descriptor?: GPUComputePassDescriptor): GPUComputePassEncoder;
5236
+ /**
5237
+ * The **`beginRenderPass()`** method of the GPUCommandEncoder interface starts encoding a render pass, returning a GPURenderPassEncoder that can be used to control rendering.
5238
+ *
5239
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/beginRenderPass)
5240
+ */
5241
+ beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
5242
+ /**
5243
+ * The **`clearBuffer()`** method of the GPUCommandEncoder interface encodes a command that fills a region of a GPUBuffer with zeroes.
5244
+ *
5245
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/clearBuffer)
5246
+ */
5247
+ clearBuffer(buffer: GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
5248
+ /**
5249
+ * The **`copyBufferToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUBuffer to another.
5250
+ *
5251
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)
5252
+ */
5253
+ copyBufferToBuffer(source: GPUBuffer, destination: GPUBuffer, size?: GPUSize64): void;
5254
+ copyBufferToBuffer(source: GPUBuffer, sourceOffset: GPUSize64, destination: GPUBuffer, destinationOffset: GPUSize64, size?: GPUSize64): void;
5255
+ /**
5256
+ * The **`copyBufferToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUBuffer to a GPUTexture.
5257
+ *
5258
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)
5259
+ */
5260
+ copyBufferToTexture(source: GPUTexelCopyBufferInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
5261
+ /**
5262
+ * The **`copyTextureToBuffer()`** method of the GPUCommandEncoder interface encodes a command that copies data from a GPUTexture to a GPUBuffer.
5263
+ *
5264
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)
5265
+ */
5266
+ copyTextureToBuffer(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyBufferInfo, copySize: GPUExtent3D): void;
5267
+ /**
5268
+ * The **`copyTextureToTexture()`** method of the GPUCommandEncoder interface encodes a command that copies data from one GPUTexture to another.
5269
+ *
5270
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)
5271
+ */
5272
+ copyTextureToTexture(source: GPUTexelCopyTextureInfo, destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D): void;
5273
+ /**
5274
+ * The **`finish()`** method of the GPUCommandEncoder interface completes recording of the command sequence encoded on this GPUCommandEncoder, returning a corresponding GPUCommandBuffer.
5275
+ *
5276
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/finish)
5277
+ */
5278
+ finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
5279
+ /**
5280
+ * The **`resolveQuerySet()`** method of the GPUCommandEncoder interface encodes a command that resolves a GPUQuerySet, copying the results into a specified GPUBuffer.
5281
+ *
5282
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCommandEncoder/resolveQuerySet)
5283
+ */
5284
+ resolveQuerySet(querySet: GPUQuerySet, firstQuery: GPUSize32, queryCount: GPUSize32, destination: GPUBuffer, destinationOffset: GPUSize64): void;
5285
+ }
5286
+
5287
+ declare var GPUCommandEncoder: {
5288
+ prototype: GPUCommandEncoder;
5289
+ new(): GPUCommandEncoder;
5290
+ };
5291
+
5113
5292
  /**
5114
5293
  * 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.
5115
5294
  * Available only in secure contexts.
@@ -5241,6 +5420,60 @@ interface GPUDebugCommandsMixin {
5241
5420
  pushDebugGroup(groupLabel: string): void;
5242
5421
  }
5243
5422
 
5423
+ interface GPUDeviceEventMap {
5424
+ "uncapturederror": GPUUncapturedErrorEvent;
5425
+ }
5426
+
5427
+ /**
5428
+ * 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.
5429
+ * Available only in secure contexts.
5430
+ *
5431
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice)
5432
+ */
5433
+ interface GPUDevice extends EventTarget, GPUObjectBase {
5434
+ /**
5435
+ * The **`adapterInfo`** read-only property of the GPUDevice interface returns a GPUAdapterInfo object containing identifying information about the device's originating adapter.
5436
+ *
5437
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/adapterInfo)
5438
+ */
5439
+ readonly adapterInfo: GPUAdapterInfo;
5440
+ /**
5441
+ * 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.
5442
+ *
5443
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/features)
5444
+ */
5445
+ readonly features: GPUSupportedFeatures;
5446
+ /**
5447
+ * 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.
5448
+ *
5449
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/limits)
5450
+ */
5451
+ readonly limits: GPUSupportedLimits;
5452
+ /**
5453
+ * 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.
5454
+ *
5455
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/lost)
5456
+ */
5457
+ readonly lost: Promise<GPUDeviceLostInfo>;
5458
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/uncapturederror_event) */
5459
+ onuncapturederror: ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any) | null;
5460
+ /**
5461
+ * The **`queue`** read-only property of the GPUDevice interface returns the primary GPUQueue for the device.
5462
+ *
5463
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/queue)
5464
+ */
5465
+ readonly queue: GPUQueue;
5466
+ addEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
5467
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
5468
+ removeEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
5469
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
5470
+ }
5471
+
5472
+ declare var GPUDevice: {
5473
+ prototype: GPUDevice;
5474
+ new(): GPUDevice;
5475
+ };
5476
+
5244
5477
  /**
5245
5478
  * 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.
5246
5479
  * Available only in secure contexts.
@@ -14396,7 +14629,7 @@ type ImageDataArray = Uint8ClampedArray<ArrayBuffer>;
14396
14629
  type Int32List = Int32Array<ArrayBufferLike> | GLint[];
14397
14630
  type MessageEventSource = MessagePort | ServiceWorker;
14398
14631
  type NamedCurve = string;
14399
- type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
14632
+ type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext | GPUCanvasContext;
14400
14633
  type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
14401
14634
  type PerformanceEntryList = PerformanceEntry[];
14402
14635
  type PushMessageDataInit = BufferSource | string;
@@ -14445,11 +14678,15 @@ type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
14445
14678
  type FontFaceSetLoadStatus = "loaded" | "loading";
14446
14679
  type FrameType = "auxiliary" | "nested" | "none" | "top-level";
14447
14680
  type GPUBufferMapState = "mapped" | "pending" | "unmapped";
14681
+ type GPUCanvasAlphaMode = "opaque" | "premultiplied";
14682
+ type GPUCanvasToneMappingMode = "extended" | "standard";
14448
14683
  type GPUCompilationMessageType = "error" | "info" | "warning";
14449
14684
  type GPUDeviceLostReason = "destroyed" | "unknown";
14450
14685
  type GPUIndexFormat = "uint16" | "uint32";
14686
+ type GPULoadOp = "clear" | "load";
14451
14687
  type GPUPipelineErrorReason = "internal" | "validation";
14452
14688
  type GPUQueryType = "occlusion" | "timestamp";
14689
+ type GPUStoreOp = "discard" | "store";
14453
14690
  type GPUTextureAspect = "all" | "depth-only" | "stencil-only";
14454
14691
  type GPUTextureDimension = "1d" | "2d" | "3d";
14455
14692
  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";