Skip to content

Commit 0ef8e68

Browse files
authored
Add GPUAdapter (#2422)
Co-authored-by: saschanaz <saschanaz@users.noreply.github.com>
1 parent f5fb928 commit 0ef8e68

19 files changed

+774
-22
lines changed

baselines/dom.generated.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,12 @@ interface GPUDepthStencilState {
929929
stencilWriteMask?: GPUStencilValue;
930930
}
931931

932+
interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
933+
defaultQueue?: GPUQueueDescriptor;
934+
requiredFeatures?: GPUFeatureName[];
935+
requiredLimits?: Record<string, GPUSize64 | undefined>;
936+
}
937+
932938
interface GPUExtent3DDict {
933939
depthOrArrayLayers?: GPUIntegerCoordinate;
934940
height?: GPUIntegerCoordinate;
@@ -999,6 +1005,9 @@ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
9991005
type: GPUQueryType;
10001006
}
10011007

1008+
interface GPUQueueDescriptor extends GPUObjectDescriptorBase {
1009+
}
1010+
10021011
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
10031012
}
10041013

@@ -15083,6 +15092,44 @@ declare var FragmentDirective: {
1508315092
new(): FragmentDirective;
1508415093
};
1508515094

15095+
/**
15096+
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
15097+
* Available only in secure contexts.
15098+
*
15099+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter)
15100+
*/
15101+
interface GPUAdapter {
15102+
/**
15103+
* The **`features`** read-only property of the GPUAdapter interface returns a GPUSupportedFeatures object that describes additional functionality supported by the adapter.
15104+
*
15105+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/features)
15106+
*/
15107+
readonly features: GPUSupportedFeatures;
15108+
/**
15109+
* The **`info`** read-only property of the GPUAdapter interface returns a GPUAdapterInfo object containing identifying information about the adapter.
15110+
*
15111+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/info)
15112+
*/
15113+
readonly info: GPUAdapterInfo;
15114+
/**
15115+
* The **`limits`** read-only property of the GPUAdapter interface returns a GPUSupportedLimits object that describes the limits supported by the adapter.
15116+
*
15117+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/limits)
15118+
*/
15119+
readonly limits: GPUSupportedLimits;
15120+
/**
15121+
* The **`requestDevice()`** method of the GPUAdapter interface returns a Promise that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
15122+
*
15123+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/requestDevice)
15124+
*/
15125+
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
15126+
}
15127+
15128+
declare var GPUAdapter: {
15129+
prototype: GPUAdapter;
15130+
new(): GPUAdapter;
15131+
};
15132+
1508615133
/**
1508715134
* The **`GPUAdapterInfo`** interface of the WebGPU API contains identifying information about a GPUAdapter.
1508815135
* Available only in secure contexts.
@@ -44205,6 +44252,7 @@ type GPUCompilationMessageType = "error" | "info" | "warning";
4420544252
type GPUCullMode = "back" | "front" | "none";
4420644253
type GPUDeviceLostReason = "destroyed" | "unknown";
4420744254
type GPUErrorFilter = "internal" | "out-of-memory" | "validation";
44255+
type GPUFeatureName = "bgra8unorm-storage" | "clip-distances" | "core-features-and-limits" | "depth-clip-control" | "depth32float-stencil8" | "dual-source-blending" | "float32-blendable" | "float32-filterable" | "indirect-first-instance" | "primitive-index" | "rg11b10ufloat-renderable" | "shader-f16" | "subgroups" | "texture-compression-astc" | "texture-compression-astc-sliced-3d" | "texture-compression-bc" | "texture-compression-bc-sliced-3d" | "texture-compression-etc2" | "texture-formats-tier1" | "timestamp-query";
4420844256
type GPUFilterMode = "linear" | "nearest";
4420944257
type GPUFrontFace = "ccw" | "cw";
4421044258
type GPUIndexFormat = "uint16" | "uint32";

baselines/serviceworker.generated.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,12 @@ interface GPUDepthStencilState {
396396
stencilWriteMask?: GPUStencilValue;
397397
}
398398

399+
interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
400+
defaultQueue?: GPUQueueDescriptor;
401+
requiredFeatures?: GPUFeatureName[];
402+
requiredLimits?: Record<string, GPUSize64 | undefined>;
403+
}
404+
399405
interface GPUExtent3DDict {
400406
depthOrArrayLayers?: GPUIntegerCoordinate;
401407
height?: GPUIntegerCoordinate;
@@ -465,6 +471,9 @@ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
465471
type: GPUQueryType;
466472
}
467473

474+
interface GPUQueueDescriptor extends GPUObjectDescriptorBase {
475+
}
476+
468477
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
469478
}
470479

@@ -4522,6 +4531,44 @@ declare var FormData: {
45224531
new(): FormData;
45234532
};
45244533

4534+
/**
4535+
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
4536+
* Available only in secure contexts.
4537+
*
4538+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter)
4539+
*/
4540+
interface GPUAdapter {
4541+
/**
4542+
* The **`features`** read-only property of the GPUAdapter interface returns a GPUSupportedFeatures object that describes additional functionality supported by the adapter.
4543+
*
4544+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/features)
4545+
*/
4546+
readonly features: GPUSupportedFeatures;
4547+
/**
4548+
* The **`info`** read-only property of the GPUAdapter interface returns a GPUAdapterInfo object containing identifying information about the adapter.
4549+
*
4550+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/info)
4551+
*/
4552+
readonly info: GPUAdapterInfo;
4553+
/**
4554+
* The **`limits`** read-only property of the GPUAdapter interface returns a GPUSupportedLimits object that describes the limits supported by the adapter.
4555+
*
4556+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/limits)
4557+
*/
4558+
readonly limits: GPUSupportedLimits;
4559+
/**
4560+
* The **`requestDevice()`** method of the GPUAdapter interface returns a Promise that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
4561+
*
4562+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/requestDevice)
4563+
*/
4564+
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
4565+
}
4566+
4567+
declare var GPUAdapter: {
4568+
prototype: GPUAdapter;
4569+
new(): GPUAdapter;
4570+
};
4571+
45254572
/**
45264573
* The **`GPUAdapterInfo`** interface of the WebGPU API contains identifying information about a GPUAdapter.
45274574
* Available only in secure contexts.
@@ -13314,6 +13361,7 @@ type GPUCompilationMessageType = "error" | "info" | "warning";
1331413361
type GPUCullMode = "back" | "front" | "none";
1331513362
type GPUDeviceLostReason = "destroyed" | "unknown";
1331613363
type GPUErrorFilter = "internal" | "out-of-memory" | "validation";
13364+
type GPUFeatureName = "bgra8unorm-storage" | "clip-distances" | "core-features-and-limits" | "depth-clip-control" | "depth32float-stencil8" | "dual-source-blending" | "float32-blendable" | "float32-filterable" | "indirect-first-instance" | "primitive-index" | "rg11b10ufloat-renderable" | "shader-f16" | "subgroups" | "texture-compression-astc" | "texture-compression-astc-sliced-3d" | "texture-compression-bc" | "texture-compression-bc-sliced-3d" | "texture-compression-etc2" | "texture-formats-tier1" | "timestamp-query";
1331713365
type GPUFilterMode = "linear" | "nearest";
1331813366
type GPUFrontFace = "ccw" | "cw";
1331913367
type GPUIndexFormat = "uint16" | "uint32";

baselines/sharedworker.generated.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ interface GPUDepthStencilState {
340340
stencilWriteMask?: GPUStencilValue;
341341
}
342342

343+
interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
344+
defaultQueue?: GPUQueueDescriptor;
345+
requiredFeatures?: GPUFeatureName[];
346+
requiredLimits?: Record<string, GPUSize64 | undefined>;
347+
}
348+
343349
interface GPUExtent3DDict {
344350
depthOrArrayLayers?: GPUIntegerCoordinate;
345351
height?: GPUIntegerCoordinate;
@@ -409,6 +415,9 @@ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
409415
type: GPUQueryType;
410416
}
411417

418+
interface GPUQueueDescriptor extends GPUObjectDescriptorBase {
419+
}
420+
412421
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
413422
}
414423

@@ -4205,6 +4214,44 @@ declare var FormData: {
42054214
new(): FormData;
42064215
};
42074216

4217+
/**
4218+
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
4219+
* Available only in secure contexts.
4220+
*
4221+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter)
4222+
*/
4223+
interface GPUAdapter {
4224+
/**
4225+
* The **`features`** read-only property of the GPUAdapter interface returns a GPUSupportedFeatures object that describes additional functionality supported by the adapter.
4226+
*
4227+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/features)
4228+
*/
4229+
readonly features: GPUSupportedFeatures;
4230+
/**
4231+
* The **`info`** read-only property of the GPUAdapter interface returns a GPUAdapterInfo object containing identifying information about the adapter.
4232+
*
4233+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/info)
4234+
*/
4235+
readonly info: GPUAdapterInfo;
4236+
/**
4237+
* The **`limits`** read-only property of the GPUAdapter interface returns a GPUSupportedLimits object that describes the limits supported by the adapter.
4238+
*
4239+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/limits)
4240+
*/
4241+
readonly limits: GPUSupportedLimits;
4242+
/**
4243+
* The **`requestDevice()`** method of the GPUAdapter interface returns a Promise that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
4244+
*
4245+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/requestDevice)
4246+
*/
4247+
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
4248+
}
4249+
4250+
declare var GPUAdapter: {
4251+
prototype: GPUAdapter;
4252+
new(): GPUAdapter;
4253+
};
4254+
42084255
/**
42094256
* The **`GPUAdapterInfo`** interface of the WebGPU API contains identifying information about a GPUAdapter.
42104257
* Available only in secure contexts.
@@ -12999,6 +13046,7 @@ type GPUCompilationMessageType = "error" | "info" | "warning";
1299913046
type GPUCullMode = "back" | "front" | "none";
1300013047
type GPUDeviceLostReason = "destroyed" | "unknown";
1300113048
type GPUErrorFilter = "internal" | "out-of-memory" | "validation";
13049+
type GPUFeatureName = "bgra8unorm-storage" | "clip-distances" | "core-features-and-limits" | "depth-clip-control" | "depth32float-stencil8" | "dual-source-blending" | "float32-blendable" | "float32-filterable" | "indirect-first-instance" | "primitive-index" | "rg11b10ufloat-renderable" | "shader-f16" | "subgroups" | "texture-compression-astc" | "texture-compression-astc-sliced-3d" | "texture-compression-bc" | "texture-compression-bc-sliced-3d" | "texture-compression-etc2" | "texture-formats-tier1" | "timestamp-query";
1300213050
type GPUFilterMode = "linear" | "nearest";
1300313051
type GPUFrontFace = "ccw" | "cw";
1300413052
type GPUIndexFormat = "uint16" | "uint32";

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,12 @@ interface GPUDepthStencilState {
926926
stencilWriteMask?: GPUStencilValue;
927927
}
928928

929+
interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
930+
defaultQueue?: GPUQueueDescriptor;
931+
requiredFeatures?: GPUFeatureName[];
932+
requiredLimits?: Record<string, GPUSize64 | undefined>;
933+
}
934+
929935
interface GPUExtent3DDict {
930936
depthOrArrayLayers?: GPUIntegerCoordinate;
931937
height?: GPUIntegerCoordinate;
@@ -996,6 +1002,9 @@ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
9961002
type: GPUQueryType;
9971003
}
9981004

1005+
interface GPUQueueDescriptor extends GPUObjectDescriptorBase {
1006+
}
1007+
9991008
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
10001009
}
10011010

@@ -15069,6 +15078,44 @@ declare var FragmentDirective: {
1506915078
new(): FragmentDirective;
1507015079
};
1507115080

15081+
/**
15082+
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
15083+
* Available only in secure contexts.
15084+
*
15085+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter)
15086+
*/
15087+
interface GPUAdapter {
15088+
/**
15089+
* The **`features`** read-only property of the GPUAdapter interface returns a GPUSupportedFeatures object that describes additional functionality supported by the adapter.
15090+
*
15091+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/features)
15092+
*/
15093+
readonly features: GPUSupportedFeatures;
15094+
/**
15095+
* The **`info`** read-only property of the GPUAdapter interface returns a GPUAdapterInfo object containing identifying information about the adapter.
15096+
*
15097+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/info)
15098+
*/
15099+
readonly info: GPUAdapterInfo;
15100+
/**
15101+
* The **`limits`** read-only property of the GPUAdapter interface returns a GPUSupportedLimits object that describes the limits supported by the adapter.
15102+
*
15103+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/limits)
15104+
*/
15105+
readonly limits: GPUSupportedLimits;
15106+
/**
15107+
* The **`requestDevice()`** method of the GPUAdapter interface returns a Promise that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
15108+
*
15109+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/requestDevice)
15110+
*/
15111+
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
15112+
}
15113+
15114+
declare var GPUAdapter: {
15115+
prototype: GPUAdapter;
15116+
new(): GPUAdapter;
15117+
};
15118+
1507215119
/**
1507315120
* The **`GPUAdapterInfo`** interface of the WebGPU API contains identifying information about a GPUAdapter.
1507415121
* Available only in secure contexts.
@@ -44179,6 +44226,7 @@ type GPUCompilationMessageType = "error" | "info" | "warning";
4417944226
type GPUCullMode = "back" | "front" | "none";
4418044227
type GPUDeviceLostReason = "destroyed" | "unknown";
4418144228
type GPUErrorFilter = "internal" | "out-of-memory" | "validation";
44229+
type GPUFeatureName = "bgra8unorm-storage" | "clip-distances" | "core-features-and-limits" | "depth-clip-control" | "depth32float-stencil8" | "dual-source-blending" | "float32-blendable" | "float32-filterable" | "indirect-first-instance" | "primitive-index" | "rg11b10ufloat-renderable" | "shader-f16" | "subgroups" | "texture-compression-astc" | "texture-compression-astc-sliced-3d" | "texture-compression-bc" | "texture-compression-bc-sliced-3d" | "texture-compression-etc2" | "texture-formats-tier1" | "timestamp-query";
4418244230
type GPUFilterMode = "linear" | "nearest";
4418344231
type GPUFrontFace = "ccw" | "cw";
4418444232
type GPUIndexFormat = "uint16" | "uint32";

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ interface GPUDepthStencilState {
393393
stencilWriteMask?: GPUStencilValue;
394394
}
395395

396+
interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
397+
defaultQueue?: GPUQueueDescriptor;
398+
requiredFeatures?: GPUFeatureName[];
399+
requiredLimits?: Record<string, GPUSize64 | undefined>;
400+
}
401+
396402
interface GPUExtent3DDict {
397403
depthOrArrayLayers?: GPUIntegerCoordinate;
398404
height?: GPUIntegerCoordinate;
@@ -462,6 +468,9 @@ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
462468
type: GPUQueryType;
463469
}
464470

471+
interface GPUQueueDescriptor extends GPUObjectDescriptorBase {
472+
}
473+
465474
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {
466475
}
467476

@@ -4519,6 +4528,44 @@ declare var FormData: {
45194528
new(): FormData;
45204529
};
45214530

4531+
/**
4532+
* The **`GPUAdapter`** interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
4533+
* Available only in secure contexts.
4534+
*
4535+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter)
4536+
*/
4537+
interface GPUAdapter {
4538+
/**
4539+
* The **`features`** read-only property of the GPUAdapter interface returns a GPUSupportedFeatures object that describes additional functionality supported by the adapter.
4540+
*
4541+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/features)
4542+
*/
4543+
readonly features: GPUSupportedFeatures;
4544+
/**
4545+
* The **`info`** read-only property of the GPUAdapter interface returns a GPUAdapterInfo object containing identifying information about the adapter.
4546+
*
4547+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/info)
4548+
*/
4549+
readonly info: GPUAdapterInfo;
4550+
/**
4551+
* The **`limits`** read-only property of the GPUAdapter interface returns a GPUSupportedLimits object that describes the limits supported by the adapter.
4552+
*
4553+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/limits)
4554+
*/
4555+
readonly limits: GPUSupportedLimits;
4556+
/**
4557+
* The **`requestDevice()`** method of the GPUAdapter interface returns a Promise that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
4558+
*
4559+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUAdapter/requestDevice)
4560+
*/
4561+
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
4562+
}
4563+
4564+
declare var GPUAdapter: {
4565+
prototype: GPUAdapter;
4566+
new(): GPUAdapter;
4567+
};
4568+
45224569
/**
45234570
* The **`GPUAdapterInfo`** interface of the WebGPU API contains identifying information about a GPUAdapter.
45244571
* Available only in secure contexts.
@@ -13311,6 +13358,7 @@ type GPUCompilationMessageType = "error" | "info" | "warning";
1331113358
type GPUCullMode = "back" | "front" | "none";
1331213359
type GPUDeviceLostReason = "destroyed" | "unknown";
1331313360
type GPUErrorFilter = "internal" | "out-of-memory" | "validation";
13361+
type GPUFeatureName = "bgra8unorm-storage" | "clip-distances" | "core-features-and-limits" | "depth-clip-control" | "depth32float-stencil8" | "dual-source-blending" | "float32-blendable" | "float32-filterable" | "indirect-first-instance" | "primitive-index" | "rg11b10ufloat-renderable" | "shader-f16" | "subgroups" | "texture-compression-astc" | "texture-compression-astc-sliced-3d" | "texture-compression-bc" | "texture-compression-bc-sliced-3d" | "texture-compression-etc2" | "texture-formats-tier1" | "timestamp-query";
1331413362
type GPUFilterMode = "linear" | "nearest";
1331513363
type GPUFrontFace = "ccw" | "cw";
1331613364
type GPUIndexFormat = "uint16" | "uint32";

0 commit comments

Comments
 (0)