From 65b57de5a4ae8bf2925b63fa012a4ce48b91c006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Thu, 19 Dec 2024 09:00:57 +0100 Subject: [PATCH] Use featureLevel GPUAdapter attribute --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index be9b169..fbacc7e 100644 --- a/index.js +++ b/index.js @@ -303,8 +303,11 @@ function parseAdapterFlags(adapter) { const flags = { 'isFallbackAdapter': adapter.isFallbackAdapter, }; + if ('featureLevel' in adapter) { + flags.featureLevel = adapter.featureLevel; + } if ('isCompatibilityMode' in adapter) { - flags.isCompatibilityMode = adapter.isCompatibilityMode + flags.isCompatibilityMode = adapter.isCompatibilityMode; } return flags; } @@ -593,7 +596,9 @@ async function checkWorker(parent, workerType) { function adapterOptionsToDesc(requestAdapterOptions, adapter) { const parts = [ ...(adapter?.isFallbackAdapter ? ['fallback'] : []), - ...(adapter?.isCompatibilityMode ? ['compatibilityMode'] : []), + ...(adapter?.featureLevel == 'compatibility' || adapter?.isCompatibilityMode + ? ['compatibilityMode'] + : []), ]; return parts.length > 0 ? parts.join(' ')