Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/webgpu): GPUDevice.features should be SetLike. #15853

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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