From ebe4c1421e13e61295221982900ac5b77c848227 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Tue, 23 Jan 2024 19:45:40 +0530 Subject: [PATCH] chore: use ensureFastOps in 02_surface.js (#22045) --- cli/tests/unit/webgpu_test.ts | 14 +++++++++++++- ext/webgpu/02_surface.js | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts index b204c5e0b2..fcbb34be5b 100644 --- a/cli/tests/unit/webgpu_test.ts +++ b/cli/tests/unit/webgpu_test.ts @@ -227,13 +227,25 @@ Deno.test({ Deno.close(Number(resources[resources.length - 1])); }); -Deno.test(function webgpuNullWindowSurfaceThrows() { +Deno.test({ + ignore: isWsl || isLinuxOrMacCI, +}, async function webgpuNullWindowSurfaceThrows() { + const adapter = await navigator.gpu.requestAdapter(); + assert(adapter); + + const device = await adapter.requestDevice(); + assert(device); + assertThrows( () => { // @ts-expect-error: runtime test for null handle new Deno.UnsafeWindowSurface("cocoa", null, null); }, ); + + device.destroy(); + const resources = Object.keys(Deno.resources()); + Deno.close(Number(resources[resources.length - 1])); }); async function checkIsWsl() { diff --git a/ext/webgpu/02_surface.js b/ext/webgpu/02_surface.js index 1c9751f623..eb3ee80af7 100644 --- a/ext/webgpu/02_surface.js +++ b/ext/webgpu/02_surface.js @@ -8,6 +8,7 @@ import { core, primordials } from "ext:core/mod.js"; const { + op_webgpu_surface_create, op_webgpu_surface_configure, op_webgpu_surface_get_current_texture, op_webgpu_surface_present, @@ -175,7 +176,7 @@ class UnsafeWindowSurface { #surfaceRid; constructor(system, win, display) { - this.#surfaceRid = ops.op_webgpu_surface_create(system, win, display); + this.#surfaceRid = op_webgpu_surface_create(system, win, display); } getContext(context) {