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(verification): read renderer counters after a completed frame

yhh7157af1dde78
diff --git a/tools/launchers/launch-export.mjs b/tools/launchers/launch-export.mjs
index a69df30dc..2d09ba77f 100644
--- a/tools/launchers/launch-export.mjs
+++ b/tools/launchers/launch-export.mjs
@@ -435,11 +435,19 @@ const SCENE = flag('scene', '');
}
if (RENDER) {
- // Engaging the counters takes a frame to fill them, so ask twice and keep
- // the second: the first reading is of the frame that turned them on.
+ // A software-rendered frame can take longer than a timer. Wait for two
+ // animation callbacks so the engine completes a frame after profiling starts.
await win.webContents.executeJavaScript('window.__estellaCooked?.render() ?? null')
.catch(() => null);
- await new Promise((r) => setTimeout(r, 250));
+ await win.webContents.executeJavaScript(`
+ new Promise((resolve, reject) => {
+ const deadline = setTimeout(() => reject(new Error('renderer counters: no completed frame')), ${TIMEOUT});
+ requestAnimationFrame(() => requestAnimationFrame(() => {
+ clearTimeout(deadline);
+ resolve();
+ }));
+ })
+ `).catch((e) => errors.push(String(e)));
const seen = await win.webContents.executeJavaScript(
'window.__estellaCooked?.render() ?? null',
).catch((e) => ({ error: String(e) }));
diff --git a/tools/lib/electronRun.mjs b/tools/lib/electronRun.mjs
index 41131d78d..75c4385a7 100644
--- a/tools/lib/electronRun.mjs
+++ b/tools/lib/electronRun.mjs
@@ -79,7 +79,11 @@ function electronCommand(args, { via, env, ...options }) {
const [cmd, ...rest] = NEEDS_XVFB
? ['xvfb-run', '-a', '--server-args', SCREEN, ...electron]
: electron;
- return [cmd, [...rest, ...args], {
+ // Windows Electron treats colon-bearing app arguments as protocol launches
+ // unless its own argument parser stops at an explicit separator.
+ const appArgs = process.platform === 'win32' && args[0] && !args[0].startsWith('-')
+ ? [args[0], '--', ...args.slice(1)] : args;
+ return [cmd, [...rest, ...appArgs], {
...options,
env: { ...process.env, ELECTRON_DISABLE_SANDBOX: '1', ...env },
}];
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 20fed9ead..ca26acbeb 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -28,6 +28,8 @@ export const NOTES_FLOOR = 'v0.65.0';
* the reader recognises anyway.
*/
export const NOTED = {
+ 'fix(verification): read renderer counters after a completed frame':
+ { internal: 'Packaged-game acceptance waits for actual render frames before reading counters and separates Windows Electron app arguments; shipping engine and editor behavior are unchanged.' },
'fix(native): keep authored UI inside live device safe areas':
{ note: 'Native UI follows the device safe area.' },
'chore(release): isolate compositor capture and preserve GPU diagnostics':