From 29c0951bd494f1ff1cc208ac17821f278d5ce7d7 Mon Sep 17 00:00:00 2001 From: Vicary A Date: Tue, 20 Sep 2022 09:43:32 +0800 Subject: [PATCH] fix(ext/webgpu): make GPUDevice.features SetLike (#15853) --- cli/dts/lib.deno_webgpu.d.ts | 4 ++-- ext/webgpu/src/01_webgpu.js | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cli/dts/lib.deno_webgpu.d.ts b/cli/dts/lib.deno_webgpu.d.ts index efcc8da4a7..32f1427688 100644 --- a/cli/dts/lib.deno_webgpu.d.ts +++ b/cli/dts/lib.deno_webgpu.d.ts @@ -143,8 +143,8 @@ declare class GPUDevice extends EventTarget implements GPUObjectBase { | ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any) | null; - readonly features: ReadonlyArray; - readonly limits: Record; + readonly features: GPUSupportedFeatures; + readonly limits: GPUSupportedLimits; readonly queue: GPUQueue; destroy(): undefined; diff --git a/ext/webgpu/src/01_webgpu.js b/ext/webgpu/src/01_webgpu.js index 9b8c7eb50a..caa103e625 100644 --- a/ext/webgpu/src/01_webgpu.js +++ b/ext/webgpu/src/01_webgpu.js @@ -25,7 +25,6 @@ Error, MathMax, ObjectDefineProperty, - ObjectFreeze, ObjectPrototypeIsPrototypeOf, Promise, PromiseAll, @@ -344,8 +343,8 @@ const inner = new InnerGPUDevice({ rid, adapter: this, - features: ObjectFreeze(features), - limits: ObjectFreeze(limits), + features: createGPUSupportedFeatures(features), + limits: createGPUSupportedLimits(limits), }); return createGPUDevice( descriptor.label ?? null, @@ -744,8 +743,8 @@ * @typedef InnerGPUDeviceOptions * @property {GPUAdapter} adapter * @property {number | undefined} rid - * @property {GPUFeatureName[]} features - * @property {object} limits + * @property {GPUSupportedFeatures} features + * @property {GPUSupportedLimits} limits */ class InnerGPUDevice { @@ -753,9 +752,9 @@ adapter; /** @type {number | undefined} */ rid; - /** @type {GPUFeatureName[]} */ + /** @type {GPUSupportedFeatures} */ features; - /** @type {object} */ + /** @type {GPUSupportedLimits} */ limits; /** @type {WeakRef[]} */ resources;