1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

chore: use ensureFastOps in 02_surface.js (#22045)

This commit is contained in:
Divy Srivastava 2024-01-23 19:45:40 +05:30 committed by GitHub
parent d6d437c4dc
commit ebe4c1421e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -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() {

View file

@ -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) {