Skip to content

armgit / SOMA

Public Imported from GitHub
0

Desktop app for designing parametric 3D models in CadQuery together with the coding agent of your choice

App: Prüfung auf WebGL beim Start abgesichert, ein Fehler darin verhindert den Start nicht mehr

Kai-Jungsthoefeld86d25e99fd4
diff --git a/app/src/main/main.ts b/app/src/main/main.ts
index ab868f5..2859e42 100644
--- a/app/src/main/main.ts
+++ b/app/src/main/main.ts
@@ -363,10 +363,18 @@ function createWindow(): void {
*/
async function relaunchForSoftwareGl(): Promise<boolean> {
if (process.platform !== 'linux' || app.commandLine.hasSwitch('ignore-gpu-blocklist')) return false;
- // Der Status gilt erst, wenn der GPU-Prozess Auskunft gegeben hat
- await Promise.race([app.getGPUInfo('basic').catch(() => null), new Promise((r) => setTimeout(r, 3000))]);
- const status = app.getGPUFeatureStatus().webgl2;
- if (status.startsWith('enabled')) return false;
+ let status: string;
+ try {
+ // Der Status gilt erst, wenn der GPU-Prozess Auskunft gegeben hat
+ await Promise.race([app.getGPUInfo('basic').catch(() => null), new Promise((r) => setTimeout(r, 3000))]);
+ const all = app.getGPUFeatureStatus() as unknown as Record<string, string | undefined>;
+ console.log('[gpu]', JSON.stringify(all));
+ status = String(all.webgl2 ?? all.webgl ?? '');
+ } catch (e) {
+ console.log('[gpu] status unknown:', e); // im Zweifel normal starten, das Fenster meldet ein Scheitern des Viewers
+ return false;
+ }
+ if (!status || status.startsWith('enabled')) return false;
console.log(`[gpu] WebGL2 ${status}, restarting with --ignore-gpu-blocklist (software rendering)`);
app.relaunch({ args: [...process.argv.slice(1), '--ignore-gpu-blocklist'] });
app.exit(0);