Skip to content

Commit 4599f54

Browse files
authored
Add GPUDevice.createComputePipeline[Async] (#2414)
Co-authored-by: saschanaz <saschanaz@users.noreply.github.com>
1 parent e3e3dd6 commit 4599f54

17 files changed

+448
-2
lines changed

baselines/dom.generated.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,10 @@ interface GPUComputePassTimestampWrites {
864864
querySet: GPUQuerySet;
865865
}
866866

867+
interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
868+
compute: GPUProgrammableStage;
869+
}
870+
867871
interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
868872
colorSpace?: PredefinedColorSpace;
869873
premultipliedAlpha?: boolean;
@@ -901,10 +905,20 @@ interface GPUOrigin3DDict {
901905
z?: GPUIntegerCoordinate;
902906
}
903907

908+
interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
909+
layout: GPUPipelineLayout | GPUAutoLayoutMode;
910+
}
911+
904912
interface GPUPipelineErrorInit {
905913
reason: GPUPipelineErrorReason;
906914
}
907915

916+
interface GPUProgrammableStage {
917+
constants?: Record<string, GPUPipelineConstantValue>;
918+
entryPoint?: string;
919+
module: GPUShaderModule;
920+
}
921+
908922
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
909923
}
910924

@@ -15377,6 +15391,18 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
1537715391
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createCommandEncoder)
1537815392
*/
1537915393
createCommandEncoder(descriptor?: GPUCommandEncoderDescriptor): GPUCommandEncoder;
15394+
/**
15395+
* The **`createComputePipeline()`** method of the GPUDevice interface creates a GPUComputePipeline that can control the compute shader stage and be used in a GPUComputePassEncoder.
15396+
*
15397+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipeline)
15398+
*/
15399+
createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline;
15400+
/**
15401+
* The **`createComputePipelineAsync()`** method of the GPUDevice interface returns a Promise that fulfills with a GPUComputePipeline, which can control the compute shader stage and be used in a GPUComputePassEncoder, once the pipeline can be used without any stalling.
15402+
*
15403+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipelineAsync)
15404+
*/
15405+
createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
1538015406
/**
1538115407
* The **`createRenderBundleEncoder()`** method of the GPUDevice interface creates a GPURenderBundleEncoder that can be used to pre-record bundles of commands. These can be reused in GPURenderPassEncoders via the executeBundles() method, as many times as required.
1538215408
*
@@ -43836,6 +43862,7 @@ type GPUIntegerCoordinateOut = number;
4383643862
type GPUMapModeFlags = number;
4383743863
type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
4383843864
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
43865+
type GPUPipelineConstantValue = number;
4383943866
type GPUSignedOffset32 = number;
4384043867
type GPUSize32 = number;
4384143868
type GPUSize32Out = number;
@@ -43949,6 +43976,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
4394943976
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
4395043977
type FontFaceSetLoadStatus = "loaded" | "loading";
4395143978
type FullscreenNavigationUI = "auto" | "hide" | "show";
43979+
type GPUAutoLayoutMode = "auto";
4395243980
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
4395343981
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
4395443982
type GPUCanvasToneMappingMode = "extended" | "standard";

baselines/serviceworker.generated.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ interface GPUComputePassTimestampWrites {
331331
querySet: GPUQuerySet;
332332
}
333333

334+
interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
335+
compute: GPUProgrammableStage;
336+
}
337+
334338
interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
335339
colorSpace?: PredefinedColorSpace;
336340
premultipliedAlpha?: boolean;
@@ -367,10 +371,20 @@ interface GPUOrigin3DDict {
367371
z?: GPUIntegerCoordinate;
368372
}
369373

374+
interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
375+
layout: GPUPipelineLayout | GPUAutoLayoutMode;
376+
}
377+
370378
interface GPUPipelineErrorInit {
371379
reason: GPUPipelineErrorReason;
372380
}
373381

382+
interface GPUProgrammableStage {
383+
constants?: Record<string, GPUPipelineConstantValue>;
384+
entryPoint?: string;
385+
module: GPUShaderModule;
386+
}
387+
374388
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
375389
}
376390

@@ -4819,6 +4833,18 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
48194833
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createCommandEncoder)
48204834
*/
48214835
createCommandEncoder(descriptor?: GPUCommandEncoderDescriptor): GPUCommandEncoder;
4836+
/**
4837+
* The **`createComputePipeline()`** method of the GPUDevice interface creates a GPUComputePipeline that can control the compute shader stage and be used in a GPUComputePassEncoder.
4838+
*
4839+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipeline)
4840+
*/
4841+
createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline;
4842+
/**
4843+
* The **`createComputePipelineAsync()`** method of the GPUDevice interface returns a Promise that fulfills with a GPUComputePipeline, which can control the compute shader stage and be used in a GPUComputePassEncoder, once the pipeline can be used without any stalling.
4844+
*
4845+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipelineAsync)
4846+
*/
4847+
createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
48224848
/**
48234849
* The **`createRenderBundleEncoder()`** method of the GPUDevice interface creates a GPURenderBundleEncoder that can be used to pre-record bundles of commands. These can be reused in GPURenderPassEncoders via the executeBundles() method, as many times as required.
48244850
*
@@ -13026,6 +13052,7 @@ type GPUIntegerCoordinateOut = number;
1302613052
type GPUMapModeFlags = number;
1302713053
type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
1302813054
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
13055+
type GPUPipelineConstantValue = number;
1302913056
type GPUSignedOffset32 = number;
1303013057
type GPUSize32 = number;
1303113058
type GPUSize32Out = number;
@@ -13081,6 +13108,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
1308113108
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
1308213109
type FontFaceSetLoadStatus = "loaded" | "loading";
1308313110
type FrameType = "auxiliary" | "nested" | "none" | "top-level";
13111+
type GPUAutoLayoutMode = "auto";
1308413112
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
1308513113
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
1308613114
type GPUCanvasToneMappingMode = "extended" | "standard";

baselines/sharedworker.generated.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ interface GPUComputePassTimestampWrites {
275275
querySet: GPUQuerySet;
276276
}
277277

278+
interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
279+
compute: GPUProgrammableStage;
280+
}
281+
278282
interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
279283
colorSpace?: PredefinedColorSpace;
280284
premultipliedAlpha?: boolean;
@@ -311,10 +315,20 @@ interface GPUOrigin3DDict {
311315
z?: GPUIntegerCoordinate;
312316
}
313317

318+
interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
319+
layout: GPUPipelineLayout | GPUAutoLayoutMode;
320+
}
321+
314322
interface GPUPipelineErrorInit {
315323
reason: GPUPipelineErrorReason;
316324
}
317325

326+
interface GPUProgrammableStage {
327+
constants?: Record<string, GPUPipelineConstantValue>;
328+
entryPoint?: string;
329+
module: GPUShaderModule;
330+
}
331+
318332
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
319333
}
320334

@@ -4502,6 +4516,18 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
45024516
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createCommandEncoder)
45034517
*/
45044518
createCommandEncoder(descriptor?: GPUCommandEncoderDescriptor): GPUCommandEncoder;
4519+
/**
4520+
* The **`createComputePipeline()`** method of the GPUDevice interface creates a GPUComputePipeline that can control the compute shader stage and be used in a GPUComputePassEncoder.
4521+
*
4522+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipeline)
4523+
*/
4524+
createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline;
4525+
/**
4526+
* The **`createComputePipelineAsync()`** method of the GPUDevice interface returns a Promise that fulfills with a GPUComputePipeline, which can control the compute shader stage and be used in a GPUComputePassEncoder, once the pipeline can be used without any stalling.
4527+
*
4528+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipelineAsync)
4529+
*/
4530+
createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
45054531
/**
45064532
* The **`createRenderBundleEncoder()`** method of the GPUDevice interface creates a GPURenderBundleEncoder that can be used to pre-record bundles of commands. These can be reused in GPURenderPassEncoders via the executeBundles() method, as many times as required.
45074533
*
@@ -12702,6 +12728,7 @@ type GPUIntegerCoordinateOut = number;
1270212728
type GPUMapModeFlags = number;
1270312729
type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
1270412730
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
12731+
type GPUPipelineConstantValue = number;
1270512732
type GPUSignedOffset32 = number;
1270612733
type GPUSize32 = number;
1270712734
type GPUSize32Out = number;
@@ -12753,6 +12780,7 @@ type FileSystemHandleKind = "directory" | "file";
1275312780
type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
1275412781
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
1275512782
type FontFaceSetLoadStatus = "loaded" | "loading";
12783+
type GPUAutoLayoutMode = "auto";
1275612784
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
1275712785
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
1275812786
type GPUCanvasToneMappingMode = "extended" | "standard";

baselines/ts5.5/dom.generated.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,10 @@ interface GPUComputePassTimestampWrites {
861861
querySet: GPUQuerySet;
862862
}
863863

864+
interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
865+
compute: GPUProgrammableStage;
866+
}
867+
864868
interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
865869
colorSpace?: PredefinedColorSpace;
866870
premultipliedAlpha?: boolean;
@@ -898,10 +902,20 @@ interface GPUOrigin3DDict {
898902
z?: GPUIntegerCoordinate;
899903
}
900904

905+
interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
906+
layout: GPUPipelineLayout | GPUAutoLayoutMode;
907+
}
908+
901909
interface GPUPipelineErrorInit {
902910
reason: GPUPipelineErrorReason;
903911
}
904912

913+
interface GPUProgrammableStage {
914+
constants?: Record<string, GPUPipelineConstantValue>;
915+
entryPoint?: string;
916+
module: GPUShaderModule;
917+
}
918+
905919
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
906920
}
907921

@@ -15363,6 +15377,18 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
1536315377
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createCommandEncoder)
1536415378
*/
1536515379
createCommandEncoder(descriptor?: GPUCommandEncoderDescriptor): GPUCommandEncoder;
15380+
/**
15381+
* The **`createComputePipeline()`** method of the GPUDevice interface creates a GPUComputePipeline that can control the compute shader stage and be used in a GPUComputePassEncoder.
15382+
*
15383+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipeline)
15384+
*/
15385+
createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline;
15386+
/**
15387+
* The **`createComputePipelineAsync()`** method of the GPUDevice interface returns a Promise that fulfills with a GPUComputePipeline, which can control the compute shader stage and be used in a GPUComputePassEncoder, once the pipeline can be used without any stalling.
15388+
*
15389+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipelineAsync)
15390+
*/
15391+
createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
1536615392
/**
1536715393
* The **`createRenderBundleEncoder()`** method of the GPUDevice interface creates a GPURenderBundleEncoder that can be used to pre-record bundles of commands. These can be reused in GPURenderPassEncoders via the executeBundles() method, as many times as required.
1536815394
*
@@ -43810,6 +43836,7 @@ type GPUIntegerCoordinateOut = number;
4381043836
type GPUMapModeFlags = number;
4381143837
type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
4381243838
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
43839+
type GPUPipelineConstantValue = number;
4381343840
type GPUSignedOffset32 = number;
4381443841
type GPUSize32 = number;
4381543842
type GPUSize32Out = number;
@@ -43923,6 +43950,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
4392343950
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
4392443951
type FontFaceSetLoadStatus = "loaded" | "loading";
4392543952
type FullscreenNavigationUI = "auto" | "hide" | "show";
43953+
type GPUAutoLayoutMode = "auto";
4392643954
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
4392743955
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
4392843956
type GPUCanvasToneMappingMode = "extended" | "standard";

baselines/ts5.5/serviceworker.generated.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ interface GPUComputePassTimestampWrites {
328328
querySet: GPUQuerySet;
329329
}
330330

331+
interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
332+
compute: GPUProgrammableStage;
333+
}
334+
331335
interface GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo {
332336
colorSpace?: PredefinedColorSpace;
333337
premultipliedAlpha?: boolean;
@@ -364,10 +368,20 @@ interface GPUOrigin3DDict {
364368
z?: GPUIntegerCoordinate;
365369
}
366370

371+
interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
372+
layout: GPUPipelineLayout | GPUAutoLayoutMode;
373+
}
374+
367375
interface GPUPipelineErrorInit {
368376
reason: GPUPipelineErrorReason;
369377
}
370378

379+
interface GPUProgrammableStage {
380+
constants?: Record<string, GPUPipelineConstantValue>;
381+
entryPoint?: string;
382+
module: GPUShaderModule;
383+
}
384+
371385
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
372386
}
373387

@@ -4816,6 +4830,18 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
48164830
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createCommandEncoder)
48174831
*/
48184832
createCommandEncoder(descriptor?: GPUCommandEncoderDescriptor): GPUCommandEncoder;
4833+
/**
4834+
* The **`createComputePipeline()`** method of the GPUDevice interface creates a GPUComputePipeline that can control the compute shader stage and be used in a GPUComputePassEncoder.
4835+
*
4836+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipeline)
4837+
*/
4838+
createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline;
4839+
/**
4840+
* The **`createComputePipelineAsync()`** method of the GPUDevice interface returns a Promise that fulfills with a GPUComputePipeline, which can control the compute shader stage and be used in a GPUComputePassEncoder, once the pipeline can be used without any stalling.
4841+
*
4842+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createComputePipelineAsync)
4843+
*/
4844+
createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
48194845
/**
48204846
* The **`createRenderBundleEncoder()`** method of the GPUDevice interface creates a GPURenderBundleEncoder that can be used to pre-record bundles of commands. These can be reused in GPURenderPassEncoders via the executeBundles() method, as many times as required.
48214847
*
@@ -13023,6 +13049,7 @@ type GPUIntegerCoordinateOut = number;
1302313049
type GPUMapModeFlags = number;
1302413050
type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
1302513051
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
13052+
type GPUPipelineConstantValue = number;
1302613053
type GPUSignedOffset32 = number;
1302713054
type GPUSize32 = number;
1302813055
type GPUSize32Out = number;
@@ -13078,6 +13105,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
1307813105
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
1307913106
type FontFaceSetLoadStatus = "loaded" | "loading";
1308013107
type FrameType = "auxiliary" | "nested" | "none" | "top-level";
13108+
type GPUAutoLayoutMode = "auto";
1308113109
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
1308213110
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
1308313111
type GPUCanvasToneMappingMode = "extended" | "standard";

0 commit comments

Comments
 (0)