mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
BREAKING(webgpu/unstable): Replace async .requestAdapterInfo() with sync .info (#24783)
Closes https://github.com/denoland/deno/issues/24779 Ref https://github.com/gpuweb/gpuweb/pull/4662
This commit is contained in:
parent
7f6b484684
commit
c0e9512b39
3 changed files with 12 additions and 5 deletions
2
cli/tsc/dts/lib.deno_webgpu.d.ts
vendored
2
cli/tsc/dts/lib.deno_webgpu.d.ts
vendored
|
@ -123,10 +123,10 @@ declare type GPUPowerPreference = "low-power" | "high-performance";
|
||||||
declare class GPUAdapter {
|
declare class GPUAdapter {
|
||||||
readonly features: GPUSupportedFeatures;
|
readonly features: GPUSupportedFeatures;
|
||||||
readonly limits: GPUSupportedLimits;
|
readonly limits: GPUSupportedLimits;
|
||||||
|
readonly info: GPUAdapterInfo;
|
||||||
readonly isFallbackAdapter: boolean;
|
readonly isFallbackAdapter: boolean;
|
||||||
|
|
||||||
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
|
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
|
||||||
requestAdapterInfo(): Promise<GPUAdapterInfo>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -423,6 +423,8 @@ class GPUAdapter {
|
||||||
[_adapter];
|
[_adapter];
|
||||||
/** @type {bool} */
|
/** @type {bool} */
|
||||||
[_invalid];
|
[_invalid];
|
||||||
|
/** @type {GPUAdapterInfo | undefined} */
|
||||||
|
#adapterInfo;
|
||||||
|
|
||||||
/** @returns {GPUSupportedFeatures} */
|
/** @returns {GPUSupportedFeatures} */
|
||||||
get features() {
|
get features() {
|
||||||
|
@ -502,9 +504,9 @@ class GPUAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<GPUAdapterInfo>}
|
* @returns {GPUAdapterInfo}
|
||||||
*/
|
*/
|
||||||
requestAdapterInfo() {
|
get info() {
|
||||||
webidl.assertBranded(this, GPUAdapterPrototype);
|
webidl.assertBranded(this, GPUAdapterPrototype);
|
||||||
|
|
||||||
if (this[_invalid]) {
|
if (this[_invalid]) {
|
||||||
|
@ -513,6 +515,10 @@ class GPUAdapter {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.#adapterInfo !== undefined) {
|
||||||
|
return this.#adapterInfo;
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
vendor,
|
vendor,
|
||||||
architecture,
|
architecture,
|
||||||
|
@ -525,7 +531,8 @@ class GPUAdapter {
|
||||||
adapterInfo[_architecture] = architecture;
|
adapterInfo[_architecture] = architecture;
|
||||||
adapterInfo[_device] = device;
|
adapterInfo[_device] = device;
|
||||||
adapterInfo[_description] = description;
|
adapterInfo[_description] = description;
|
||||||
return PromiseResolve(adapterInfo);
|
this.#adapterInfo = adapterInfo;
|
||||||
|
return adapterInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||||
|
|
|
@ -78,11 +78,11 @@ enum GPUPowerPreference {
|
||||||
[Exposed=(Window, Worker), SecureContext]
|
[Exposed=(Window, Worker), SecureContext]
|
||||||
interface GPUAdapter {
|
interface GPUAdapter {
|
||||||
[SameObject] readonly attribute GPUSupportedFeatures features;
|
[SameObject] readonly attribute GPUSupportedFeatures features;
|
||||||
|
[SameObject] readonly attribute GPUAdapterInfo info;
|
||||||
[SameObject] readonly attribute GPUSupportedLimits limits;
|
[SameObject] readonly attribute GPUSupportedLimits limits;
|
||||||
readonly attribute boolean isFallbackAdapter;
|
readonly attribute boolean isFallbackAdapter;
|
||||||
|
|
||||||
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||||
Promise<GPUAdapterInfo> requestAdapterInfo();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUDeviceDescriptor
|
dictionary GPUDeviceDescriptor
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue