]> git.codecow.com Git - nano-pow.git/commitdiff
Expand WebGPU availability check to look for devices.
authorChris Duncan <chris@codecow.com>
Thu, 9 Apr 2026 21:47:32 +0000 (14:47 -0700)
committerChris Duncan <chris@codecow.com>
Thu, 9 Apr 2026 21:47:32 +0000 (14:47 -0700)
src/utils/api-support/webgpu.ts
src/utils/logger.ts

index dfdf96986ddcf27ac0a51b6cb3eb83c64da11d52..6ed0fc4bdcfaa3bf5f5de77be1f220483cc13fb7 100644 (file)
@@ -7,7 +7,8 @@ Object.defineProperty(webgpu, 'isSupported', {
                let isWebgpuSupported = false
                try {
                        const adapter = await navigator?.gpu?.requestAdapter?.()
-                       isWebgpuSupported = (adapter instanceof GPUAdapter)
+                       const device = await adapter?.requestDevice?.()
+                       isWebgpuSupported = (adapter instanceof GPUAdapter && device instanceof GPUDevice)
                } catch (err) {
                        console.warn('WebGPU is not supported in this environment.\n', err)
                        isWebgpuSupported = false
index e902a5bece52914cf14139c35feaf6c90b8ac933..566f5faac8f092eb7434c394af817a9b360fb867 100644 (file)
@@ -2,9 +2,9 @@
 //! SPDX-License-Identifier: GPL-3.0-or-later
 
 /**
-* Override console logging to provide an informative prefix for each entry and
-* to only output when debug mode is enabled.
-*/
+ * Override console logging to provide an informative prefix for each entry and
+ * to only output when debug mode is enabled.
+ */
 export class Logger {
        isEnabled: boolean = false
        groups: { [key: string]: boolean } = {}