From 79cc8e6133ebf8795dc99e799aebc355d94ff924 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 9 Apr 2026 14:47:32 -0700 Subject: [PATCH] Expand WebGPU availability check to look for devices. --- src/utils/api-support/webgpu.ts | 3 ++- src/utils/logger.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/api-support/webgpu.ts b/src/utils/api-support/webgpu.ts index dfdf969..6ed0fc4 100644 --- a/src/utils/api-support/webgpu.ts +++ b/src/utils/api-support/webgpu.ts @@ -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 diff --git a/src/utils/logger.ts b/src/utils/logger.ts index e902a5b..566f5fa 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -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 } = {} -- 2.47.3