Skip to content

Commit 6c6d22b

Browse files
authored
Add GPU (#2423)
Co-authored-by: saschanaz <saschanaz@users.noreply.github.com>
1 parent 0ef8e68 commit 6c6d22b

18 files changed

+610
-4
lines changed

baselines/dom.generated.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,11 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
10651065
vertex: GPUVertexState;
10661066
}
10671067

1068+
interface GPURequestAdapterOptions {
1069+
forceFallbackAdapter?: boolean;
1070+
powerPreference?: GPUPowerPreference;
1071+
}
1072+
10681073
interface GPUSamplerBindingLayout {
10691074
type?: GPUSamplerBindingType;
10701075
}
@@ -15092,6 +15097,38 @@ declare var FragmentDirective: {
1509215097
new(): FragmentDirective;
1509315098
};
1509415099

15100+
/**
15101+
* The **`GPU`** interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more.
15102+
* Available only in secure contexts.
15103+
*
15104+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU)
15105+
*/
15106+
interface GPU {
15107+
/**
15108+
* The **`wgslLanguageFeatures`** read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.
15109+
*
15110+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/wgslLanguageFeatures)
15111+
*/
15112+
readonly wgslLanguageFeatures: WGSLLanguageFeatures;
15113+
/**
15114+
* The **`getPreferredCanvasFormat()`** method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.
15115+
*
15116+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/getPreferredCanvasFormat)
15117+
*/
15118+
getPreferredCanvasFormat(): GPUTextureFormat;
15119+
/**
15120+
* The **`requestAdapter()`** method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.
15121+
*
15122+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/requestAdapter)
15123+
*/
15124+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
15125+
}
15126+
15127+
declare var GPU: {
15128+
prototype: GPU;
15129+
new(): GPU;
15130+
};
15131+
1509515132
/**
1509615133
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
1509715134
* Available only in secure contexts.
@@ -44259,6 +44296,7 @@ type GPUIndexFormat = "uint16" | "uint32";
4425944296
type GPULoadOp = "clear" | "load";
4426044297
type GPUMipmapFilterMode = "linear" | "nearest";
4426144298
type GPUPipelineErrorReason = "internal" | "validation";
44299+
type GPUPowerPreference = "high-performance" | "low-power";
4426244300
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
4426344301
type GPUQueryType = "occlusion" | "timestamp";
4426444302
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";

baselines/serviceworker.generated.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
531531
vertex: GPUVertexState;
532532
}
533533

534+
interface GPURequestAdapterOptions {
535+
forceFallbackAdapter?: boolean;
536+
powerPreference?: GPUPowerPreference;
537+
}
538+
534539
interface GPUSamplerBindingLayout {
535540
type?: GPUSamplerBindingType;
536541
}
@@ -4531,6 +4536,38 @@ declare var FormData: {
45314536
new(): FormData;
45324537
};
45334538

4539+
/**
4540+
* The **`GPU`** interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more.
4541+
* Available only in secure contexts.
4542+
*
4543+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU)
4544+
*/
4545+
interface GPU {
4546+
/**
4547+
* The **`wgslLanguageFeatures`** read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.
4548+
*
4549+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/wgslLanguageFeatures)
4550+
*/
4551+
readonly wgslLanguageFeatures: WGSLLanguageFeatures;
4552+
/**
4553+
* The **`getPreferredCanvasFormat()`** method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.
4554+
*
4555+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/getPreferredCanvasFormat)
4556+
*/
4557+
getPreferredCanvasFormat(): GPUTextureFormat;
4558+
/**
4559+
* The **`requestAdapter()`** method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.
4560+
*
4561+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/requestAdapter)
4562+
*/
4563+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
4564+
}
4565+
4566+
declare var GPU: {
4567+
prototype: GPU;
4568+
new(): GPU;
4569+
};
4570+
45344571
/**
45354572
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
45364573
* Available only in secure contexts.
@@ -13368,6 +13405,7 @@ type GPUIndexFormat = "uint16" | "uint32";
1336813405
type GPULoadOp = "clear" | "load";
1336913406
type GPUMipmapFilterMode = "linear" | "nearest";
1337013407
type GPUPipelineErrorReason = "internal" | "validation";
13408+
type GPUPowerPreference = "high-performance" | "low-power";
1337113409
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
1337213410
type GPUQueryType = "occlusion" | "timestamp";
1337313411
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";

baselines/sharedworker.generated.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
475475
vertex: GPUVertexState;
476476
}
477477

478+
interface GPURequestAdapterOptions {
479+
forceFallbackAdapter?: boolean;
480+
powerPreference?: GPUPowerPreference;
481+
}
482+
478483
interface GPUSamplerBindingLayout {
479484
type?: GPUSamplerBindingType;
480485
}
@@ -4214,6 +4219,38 @@ declare var FormData: {
42144219
new(): FormData;
42154220
};
42164221

4222+
/**
4223+
* The **`GPU`** interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more.
4224+
* Available only in secure contexts.
4225+
*
4226+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU)
4227+
*/
4228+
interface GPU {
4229+
/**
4230+
* The **`wgslLanguageFeatures`** read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.
4231+
*
4232+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/wgslLanguageFeatures)
4233+
*/
4234+
readonly wgslLanguageFeatures: WGSLLanguageFeatures;
4235+
/**
4236+
* The **`getPreferredCanvasFormat()`** method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.
4237+
*
4238+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/getPreferredCanvasFormat)
4239+
*/
4240+
getPreferredCanvasFormat(): GPUTextureFormat;
4241+
/**
4242+
* The **`requestAdapter()`** method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.
4243+
*
4244+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/requestAdapter)
4245+
*/
4246+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
4247+
}
4248+
4249+
declare var GPU: {
4250+
prototype: GPU;
4251+
new(): GPU;
4252+
};
4253+
42174254
/**
42184255
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
42194256
* Available only in secure contexts.
@@ -13053,6 +13090,7 @@ type GPUIndexFormat = "uint16" | "uint32";
1305313090
type GPULoadOp = "clear" | "load";
1305413091
type GPUMipmapFilterMode = "linear" | "nearest";
1305513092
type GPUPipelineErrorReason = "internal" | "validation";
13093+
type GPUPowerPreference = "high-performance" | "low-power";
1305613094
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
1305713095
type GPUQueryType = "occlusion" | "timestamp";
1305813096
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,11 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
10621062
vertex: GPUVertexState;
10631063
}
10641064

1065+
interface GPURequestAdapterOptions {
1066+
forceFallbackAdapter?: boolean;
1067+
powerPreference?: GPUPowerPreference;
1068+
}
1069+
10651070
interface GPUSamplerBindingLayout {
10661071
type?: GPUSamplerBindingType;
10671072
}
@@ -15078,6 +15083,38 @@ declare var FragmentDirective: {
1507815083
new(): FragmentDirective;
1507915084
};
1508015085

15086+
/**
15087+
* The **`GPU`** interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more.
15088+
* Available only in secure contexts.
15089+
*
15090+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU)
15091+
*/
15092+
interface GPU {
15093+
/**
15094+
* The **`wgslLanguageFeatures`** read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.
15095+
*
15096+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/wgslLanguageFeatures)
15097+
*/
15098+
readonly wgslLanguageFeatures: WGSLLanguageFeatures;
15099+
/**
15100+
* The **`getPreferredCanvasFormat()`** method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.
15101+
*
15102+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/getPreferredCanvasFormat)
15103+
*/
15104+
getPreferredCanvasFormat(): GPUTextureFormat;
15105+
/**
15106+
* The **`requestAdapter()`** method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.
15107+
*
15108+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/requestAdapter)
15109+
*/
15110+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
15111+
}
15112+
15113+
declare var GPU: {
15114+
prototype: GPU;
15115+
new(): GPU;
15116+
};
15117+
1508115118
/**
1508215119
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
1508315120
* Available only in secure contexts.
@@ -44233,6 +44270,7 @@ type GPUIndexFormat = "uint16" | "uint32";
4423344270
type GPULoadOp = "clear" | "load";
4423444271
type GPUMipmapFilterMode = "linear" | "nearest";
4423544272
type GPUPipelineErrorReason = "internal" | "validation";
44273+
type GPUPowerPreference = "high-performance" | "low-power";
4423644274
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
4423744275
type GPUQueryType = "occlusion" | "timestamp";
4423844276
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,11 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
528528
vertex: GPUVertexState;
529529
}
530530

531+
interface GPURequestAdapterOptions {
532+
forceFallbackAdapter?: boolean;
533+
powerPreference?: GPUPowerPreference;
534+
}
535+
531536
interface GPUSamplerBindingLayout {
532537
type?: GPUSamplerBindingType;
533538
}
@@ -4528,6 +4533,38 @@ declare var FormData: {
45284533
new(): FormData;
45294534
};
45304535

4536+
/**
4537+
* The **`GPU`** interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more.
4538+
* Available only in secure contexts.
4539+
*
4540+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU)
4541+
*/
4542+
interface GPU {
4543+
/**
4544+
* The **`wgslLanguageFeatures`** read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.
4545+
*
4546+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/wgslLanguageFeatures)
4547+
*/
4548+
readonly wgslLanguageFeatures: WGSLLanguageFeatures;
4549+
/**
4550+
* The **`getPreferredCanvasFormat()`** method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.
4551+
*
4552+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/getPreferredCanvasFormat)
4553+
*/
4554+
getPreferredCanvasFormat(): GPUTextureFormat;
4555+
/**
4556+
* The **`requestAdapter()`** method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.
4557+
*
4558+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/requestAdapter)
4559+
*/
4560+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
4561+
}
4562+
4563+
declare var GPU: {
4564+
prototype: GPU;
4565+
new(): GPU;
4566+
};
4567+
45314568
/**
45324569
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
45334570
* Available only in secure contexts.
@@ -13365,6 +13402,7 @@ type GPUIndexFormat = "uint16" | "uint32";
1336513402
type GPULoadOp = "clear" | "load";
1336613403
type GPUMipmapFilterMode = "linear" | "nearest";
1336713404
type GPUPipelineErrorReason = "internal" | "validation";
13405+
type GPUPowerPreference = "high-performance" | "low-power";
1336813406
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
1336913407
type GPUQueryType = "occlusion" | "timestamp";
1337013408
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
472472
vertex: GPUVertexState;
473473
}
474474

475+
interface GPURequestAdapterOptions {
476+
forceFallbackAdapter?: boolean;
477+
powerPreference?: GPUPowerPreference;
478+
}
479+
475480
interface GPUSamplerBindingLayout {
476481
type?: GPUSamplerBindingType;
477482
}
@@ -4211,6 +4216,38 @@ declare var FormData: {
42114216
new(): FormData;
42124217
};
42134218

4219+
/**
4220+
* The **`GPU`** interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more.
4221+
* Available only in secure contexts.
4222+
*
4223+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU)
4224+
*/
4225+
interface GPU {
4226+
/**
4227+
* The **`wgslLanguageFeatures`** read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.
4228+
*
4229+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/wgslLanguageFeatures)
4230+
*/
4231+
readonly wgslLanguageFeatures: WGSLLanguageFeatures;
4232+
/**
4233+
* The **`getPreferredCanvasFormat()`** method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.
4234+
*
4235+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/getPreferredCanvasFormat)
4236+
*/
4237+
getPreferredCanvasFormat(): GPUTextureFormat;
4238+
/**
4239+
* The **`requestAdapter()`** method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.
4240+
*
4241+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPU/requestAdapter)
4242+
*/
4243+
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
4244+
}
4245+
4246+
declare var GPU: {
4247+
prototype: GPU;
4248+
new(): GPU;
4249+
};
4250+
42144251
/**
42154252
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
42164253
* Available only in secure contexts.
@@ -13050,6 +13087,7 @@ type GPUIndexFormat = "uint16" | "uint32";
1305013087
type GPULoadOp = "clear" | "load";
1305113088
type GPUMipmapFilterMode = "linear" | "nearest";
1305213089
type GPUPipelineErrorReason = "internal" | "validation";
13090+
type GPUPowerPreference = "high-performance" | "low-power";
1305313091
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
1305413092
type GPUQueryType = "occlusion" | "timestamp";
1305513093
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";

0 commit comments

Comments
 (0)