From a949d2c0c8360968628305566693fe6f978f41b7 Mon Sep 17 00:00:00 2001 From: KPal <48248865+kpal81xd@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:50:13 +0000 Subject: [PATCH] Fixed fallthrough of devices (#7095) --- examples/iframe/utils.mjs | 6 +++--- examples/src/examples/misc/editor.example.mjs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/iframe/utils.mjs b/examples/iframe/utils.mjs index 18e3727eacd..ed87976ac57 100644 --- a/examples/iframe/utils.mjs +++ b/examples/iframe/utils.mjs @@ -119,7 +119,7 @@ export function updateDeviceType(config) { deviceType = 'webgl1'; return; } - if (config.WEBGL1_DISABLED && deviceType !== 'webgl2') { + if ((config.WEBGL1_DISABLED && deviceType !== 'webgl2') || deviceType === 'webgpu') { console.warn('WebGPU is disabled. Using WebGL 2.0 device instead.'); deviceType = 'webgl2'; return; @@ -131,14 +131,14 @@ export function updateDeviceType(config) { deviceType = 'webgl1'; return; } - if (config.WEBGL1_DISABLED && deviceType !== 'webgpu') { + if ((config.WEBGL1_DISABLED && deviceType !== 'webgpu') || deviceType === 'webgl2') { console.warn('WebGL 2.0 is disabled. Using WebGPU device instead.'); deviceType = 'webgpu'; return; } } if (config.WEBGL1_DISABLED) { - if (config.WEBGPU_DISABLED && deviceType !== 'webgl2') { + if ((config.WEBGPU_DISABLED && deviceType !== 'webgl2') || deviceType === 'webgl1') { console.warn('WebGL 1.0 is disabled. Using WebGL 2.0 device instead.'); deviceType = 'webgl2'; return; diff --git a/examples/src/examples/misc/editor.example.mjs b/examples/src/examples/misc/editor.example.mjs index 851959c20b2..c8c3a6075f7 100644 --- a/examples/src/examples/misc/editor.example.mjs +++ b/examples/src/examples/misc/editor.example.mjs @@ -1,4 +1,5 @@ // @config DESCRIPTION
Translate (1), Rotate (2), Scale (3)
World/Local (X)
Perspective (P), Orthographic (O)
+// @config WEBGPU_DISABLED import * as pc from 'playcanvas'; import { data } from 'examples/observer'; import { deviceType, rootPath, localImport } from 'examples/utils';