mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05: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 {
|
||||
readonly features: GPUSupportedFeatures;
|
||||
readonly limits: GPUSupportedLimits;
|
||||
readonly info: GPUAdapterInfo;
|
||||
readonly isFallbackAdapter: boolean;
|
||||
|
||||
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
|
||||
requestAdapterInfo(): Promise<GPUAdapterInfo>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -423,6 +423,8 @@ class GPUAdapter {
|
|||
[_adapter];
|
||||
/** @type {bool} */
|
||||
[_invalid];
|
||||
/** @type {GPUAdapterInfo | undefined} */
|
||||
#adapterInfo;
|
||||
|
||||
/** @returns {GPUSupportedFeatures} */
|
||||
get features() {
|
||||
|
@ -502,9 +504,9 @@ class GPUAdapter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GPUAdapterInfo>}
|
||||
* @returns {GPUAdapterInfo}
|
||||
*/
|
||||
requestAdapterInfo() {
|
||||
get info() {
|
||||
webidl.assertBranded(this, GPUAdapterPrototype);
|
||||
|
||||
if (this[_invalid]) {
|
||||
|
@ -513,6 +515,10 @@ class GPUAdapter {
|
|||
);
|
||||
}
|
||||
|
||||
if (this.#adapterInfo !== undefined) {
|
||||
return this.#adapterInfo;
|
||||
}
|
||||
|
||||
const {
|
||||
vendor,
|
||||
architecture,
|
||||
|
@ -525,7 +531,8 @@ class GPUAdapter {
|
|||
adapterInfo[_architecture] = architecture;
|
||||
adapterInfo[_device] = device;
|
||||
adapterInfo[_description] = description;
|
||||
return PromiseResolve(adapterInfo);
|
||||
this.#adapterInfo = adapterInfo;
|
||||
return adapterInfo;
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||
|
|
|
@ -78,11 +78,11 @@ enum GPUPowerPreference {
|
|||
[Exposed=(Window, Worker), SecureContext]
|
||||
interface GPUAdapter {
|
||||
[SameObject] readonly attribute GPUSupportedFeatures features;
|
||||
[SameObject] readonly attribute GPUAdapterInfo info;
|
||||
[SameObject] readonly attribute GPUSupportedLimits limits;
|
||||
readonly attribute boolean isFallbackAdapter;
|
||||
|
||||
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||
Promise<GPUAdapterInfo> requestAdapterInfo();
|
||||
};
|
||||
|
||||
dictionary GPUDeviceDescriptor
|
||||
|
|
Loading…
Reference in a new issue