Skip to main content
Home
This release is 10 versions behind 0.224.9 — the latest version of @std/webgpu. Jump to latest

@std/webgpu@0.223.0
Built and signed on GitHub Actions

Works with
This package works with Deno, BrowsersIt is unknown whether this package works with Bun
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score94%
Downloads17/wk
Published2 years ago (0.223.0)

UNSTABLE: Utilities for working with the Web GPU API

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. async function checkIsWsl() { return Deno.build.os === "linux" && await hasMicrosoftProcVersion(); async function hasMicrosoftProcVersion() { // https://github.com/microsoft/WSL/issues/423#issuecomment-221627364 try { const procVersion = await Deno.readTextFile("/proc/version"); return /microsoft/i.test(procVersion); } catch { return false; } } } let isCI: boolean; try { isCI = (Deno.env.get("CI")?.length ?? 0) > 0; } catch { isCI = true; } // Skip these tests on linux CI, because the vulkan emulator is not good enough // yet, and skip on macOS CI because these do not have virtual GPUs. const isLinuxOrMacCI = (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI; // Skip these tests in WSL because it doesn't have good GPU support. 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])); }