Skip to content

Commit

Permalink
test(webgpu): remove Deno.resources() usage (denoland#4708)
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats authored May 10, 2024
1 parent c53ca87 commit 6deab72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
11 changes: 0 additions & 11 deletions webgpu/_test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,3 @@ const isLinuxOrMacCI =
const isWsl = await checkIsWsl();

export const ignore = isWsl || isLinuxOrMacCI;

export function cleanUp(device: GPUDevice) {
device.destroy();

// TODO(lucacasonato): webgpu spec should add a explicit destroy method for
// adapters.
// @ts-ignore Until WebGPU resources cleanup is automatically handled.
const resources = Object.keys(Deno[Deno.internal].core.resources());
// @ts-ignore Until WebGPU resources cleanup is automatically handled.
Deno[Deno.internal].core.close(Number(resources[resources.length - 1]));
}
4 changes: 2 additions & 2 deletions webgpu/create_capture_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { assert, assertEquals } from "@std/assert";
import { cleanUp, ignore } from "./_test_util.ts";
import { ignore } from "./_test_util.ts";
import { createCapture } from "./create_capture.ts";

Deno.test({
Expand Down Expand Up @@ -30,6 +30,6 @@ Deno.test({
GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
);

cleanUp(device);
device.destroy();
},
});
4 changes: 2 additions & 2 deletions webgpu/texture_with_data_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { assert } from "@std/assert/assert";
import { createTextureWithData } from "./texture_with_data.ts";
import { cleanUp, ignore } from "./_test_util.ts";
import { ignore } from "./_test_util.ts";

Deno.test({
ignore,
Expand All @@ -22,6 +22,6 @@ Deno.test({
usage: GPUTextureUsage.COPY_SRC,
}, new Uint8Array([1, 1, 1, 1, 1, 1, 1]));

cleanUp(device);
device.destroy();
},
});

0 comments on commit 6deab72

Please sign in to comment.