diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2024-05-10 04:10:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 04:10:22 -0700 |
commit | 6066e069d141d7c0c19e088011fdf3c06782d12c (patch) | |
tree | 5e00678b77a887f604d71629c5876c5b58b19d5f /tests/unit/webgpu_test.ts | |
parent | 19c0633a947f2ee28cc07b59c32322151779101d (diff) |
fix(ext/webgpu): invalidate GPUAdapter when a device is created (#23752)
This removes the need for using `Deno.resources` to close the gpuadapter
resource, while being more spec compliant.
Diffstat (limited to 'tests/unit/webgpu_test.ts')
-rw-r--r-- | tests/unit/webgpu_test.ts | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/tests/unit/webgpu_test.ts b/tests/unit/webgpu_test.ts index 4b65e0033..f31010297 100644 --- a/tests/unit/webgpu_test.ts +++ b/tests/unit/webgpu_test.ts @@ -100,11 +100,6 @@ Deno.test({ stagingBuffer.unmap(); device.destroy(); - - // TODO(lucacasonato): webgpu spec should add a explicit destroy method for - // adapters. - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); }); Deno.test({ @@ -210,11 +205,6 @@ Deno.test({ outputBuffer.unmap(); device.destroy(); - - // TODO(lucacasonato): webgpu spec should add a explicit destroy method for - // adapters. - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); }); Deno.test({ @@ -223,8 +213,8 @@ Deno.test({ const adapter = await navigator.gpu.requestAdapter(); assert(adapter); assert(adapter.features); - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); + const device = await adapter.requestDevice(); + device.destroy(); }); Deno.test({ @@ -243,8 +233,6 @@ Deno.test({ ); device.destroy(); - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); }); Deno.test(function getPreferredCanvasFormat() { @@ -313,8 +301,6 @@ Deno.test({ ); device.destroy(); - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); }); Deno.test({ @@ -409,8 +395,6 @@ Deno.test({ // NOTE: GPUQueue.copyExternalImageToTexture needs to be validated the argument of copySize property's length when its a sequence, but it is not implemented yet device.destroy(); - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); }); Deno.test({ @@ -510,8 +494,6 @@ Deno.test({ // NOTE: GPUQueue.copyExternalImageToTexture needs to be validated the argument of destination.origin property's length when its a sequence, but it is not implemented yet device.destroy(); - const resources = Object.keys(Deno.resources()); - Deno.close(Number(resources[resources.length - 1])); }); async function checkIsWsl() { |