Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(ci): a package launcher on a GPU-less runner gets SwiftShader too

esengine5da6e9d9e081
diff --git a/desktop/scripts/launch-export.mjs b/desktop/scripts/launch-export.mjs
index ef737be13..d632296f8 100644
--- a/desktop/scripts/launch-export.mjs
+++ b/desktop/scripts/launch-export.mjs
@@ -42,6 +42,10 @@ import { fileURLToPath } from 'node:url';
import { onRendererConsole } from './rendererConsole.mjs';
import { inputScript } from './inputScript.mjs';
+// Headless / GPU-less (CI) WebGL2 falls back to SwiftShader; harmless with a GPU.
+// Without it Chromium refuses the context outright and the package boots to
+// "WebGL2 is not available" — which is a runner without a GPU, not a broken game.
+app.commandLine.appendSwitch('enable-unsafe-swiftshader');
// capturePage pixels go through the OS display profile; pin sRGB so a colour
// judgement reads the same on a wide-gamut machine as on a CI runner.
app.commandLine.appendSwitch('force-color-profile', 'srgb');
diff --git a/desktop/scripts/launch-minigame.mjs b/desktop/scripts/launch-minigame.mjs
index e41187e81..fa06f9eb4 100644
--- a/desktop/scripts/launch-minigame.mjs
+++ b/desktop/scripts/launch-minigame.mjs
@@ -27,6 +27,8 @@ import { onRendererConsole } from './rendererConsole.mjs';
import { HOST_PAGE } from './minigameHost.mjs';
import { inputScript } from './inputScript.mjs';
+// Headless / GPU-less (CI) WebGL2 falls back to SwiftShader; harmless with a GPU.
+app.commandLine.appendSwitch('enable-unsafe-swiftshader');
app.commandLine.appendSwitch('force-color-profile', 'srgb');
const argv = process.argv.slice(2);