pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
1 lines • 2 kB
Source Map (JSON)
{"version":3,"file":"isWebGPUSupported.mjs","sources":["../../../src/utils/browser/isWebGPUSupported.ts"],"sourcesContent":["import { DOMAdapter } from '../../environment/adapter';\n\nlet _isWebGPUSupported: boolean | undefined;\n\n/**\n * Helper for checking for WebGPU support in the current environment.\n * Results are cached after first call for better performance.\n * @example\n * ```ts\n * // Basic WebGPU support check\n * const hasWebGPU = await isWebGPUSupported();\n * console.log('WebGPU available:', hasWebGPU);\n * ```\n * @param options - The options for requesting a GPU adapter\n * @returns Promise that resolves to true if WebGPU is supported\n * @category utils\n * @standard\n */\nexport async function isWebGPUSupported(options: GPURequestAdapterOptions = {}): Promise<boolean>\n{\n if (_isWebGPUSupported !== undefined) return _isWebGPUSupported;\n\n _isWebGPUSupported = await (async (): Promise<boolean> =>\n {\n const gpu = DOMAdapter.get().getNavigator().gpu;\n\n if (!gpu)\n {\n return false;\n }\n\n try\n {\n const adapter = await gpu.requestAdapter(options) as GPUAdapter;\n\n // TODO and one of these!\n await adapter.requestDevice();\n\n return true;\n }\n catch (_e)\n {\n return false;\n }\n })();\n\n return _isWebGPUSupported;\n}\n"],"names":[],"mappings":";;;AAEA,IAAI,kBAAA,CAAA;AAgBkB,eAAA,iBAAA,CAAkB,OAAoC,GAAA,EAC5E,EAAA;AACI,EAAA,IAAI,kBAAuB,KAAA,KAAA,CAAA;AAAW,IAAO,OAAA,kBAAA,CAAA;AAE7C,EAAA,kBAAA,GAAqB,OAAO,YAC5B;AACI,IAAA,MAAM,GAAM,GAAA,UAAA,CAAW,GAAI,EAAA,CAAE,cAAe,CAAA,GAAA,CAAA;AAE5C,IAAA,IAAI,CAAC,GACL,EAAA;AACI,MAAO,OAAA,KAAA,CAAA;AAAA,KACX;AAEA,IACA,IAAA;AACI,MAAA,MAAM,OAAU,GAAA,MAAM,GAAI,CAAA,cAAA,CAAe,OAAO,CAAA,CAAA;AAGhD,MAAA,MAAM,QAAQ,aAAc,EAAA,CAAA;AAE5B,MAAO,OAAA,IAAA,CAAA;AAAA,aAEJ,EACP,EAAA;AACI,MAAO,OAAA,KAAA,CAAA;AAAA,KACX;AAAA,GACD,GAAA,CAAA;AAEH,EAAO,OAAA,kBAAA,CAAA;AACX;;;;"}