Skip to content

Commit

Permalink
fix(ext/webgpu): make GPUDevice.features SetLike (denoland#15853)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicary authored and dsherret committed Sep 22, 2022
1 parent ff57472 commit 29c0951
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cli/dts/lib.deno_webgpu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ declare class GPUDevice extends EventTarget implements GPUObjectBase {
| ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any)
| null;

readonly features: ReadonlyArray<GPUFeatureName>;
readonly limits: Record<string, number>;
readonly features: GPUSupportedFeatures;
readonly limits: GPUSupportedLimits;
readonly queue: GPUQueue;

destroy(): undefined;
Expand Down
13 changes: 6 additions & 7 deletions ext/webgpu/src/01_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
Error,
MathMax,
ObjectDefineProperty,
ObjectFreeze,
ObjectPrototypeIsPrototypeOf,
Promise,
PromiseAll,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -744,18 +743,18 @@
* @typedef InnerGPUDeviceOptions
* @property {GPUAdapter} adapter
* @property {number | undefined} rid
* @property {GPUFeatureName[]} features
* @property {object} limits
* @property {GPUSupportedFeatures} features
* @property {GPUSupportedLimits} limits
*/

class InnerGPUDevice {
/** @type {GPUAdapter} */
adapter;
/** @type {number | undefined} */
rid;
/** @type {GPUFeatureName[]} */
/** @type {GPUSupportedFeatures} */
features;
/** @type {object} */
/** @type {GPUSupportedLimits} */
limits;
/** @type {WeakRef<any>[]} */
resources;
Expand Down

0 comments on commit 29c0951

Please sign in to comment.