diff --git a/server/package-lock.json b/server/package-lock.json index ac1aba90b..a9fb615dd 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/server", - "version": "0.115.31", + "version": "0.115.32", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@scrypted/server", - "version": "0.115.31", + "version": "0.115.32", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/server/src/plugin/runtime/electron-worker.ts b/server/src/plugin/runtime/electron-worker.ts index 13b85b1f0..d5daac042 100644 --- a/server/src/plugin/runtime/electron-worker.ts +++ b/server/src/plugin/runtime/electron-worker.ts @@ -11,7 +11,7 @@ export class ElectronForkWorker extends ChildProcessWorker { static allocatedDisplays = new Set(); allocatedDisplay: number; - constructor(_mainFilename: string, pluginId: string, options: RuntimeWorkerOptions, runtime: ScryptedRuntime) { + constructor(_mainFilename: string, pluginId: string, options: RuntimeWorkerOptions, runtime: ScryptedRuntime, mode: 'default' | 'webgl' | 'webgpu') { super(pluginId, options); const { env } = options; @@ -24,6 +24,13 @@ export class ElectronForkWorker extends ChildProcessWorker { '--disable-features=BlockInsecurePrivateNetworkRequests,PrivateNetworkAccessSendPreflights', '--enable-features=SharedArrayBuffer', ]; + + if (mode !== 'default') { + args.push( + '--ignore-gpu-blocklist', + ); + } + if (process.platform === 'linux') { // crappy but should work. for (let i = 50; i < 100; i++) { @@ -44,11 +51,15 @@ export class ElectronForkWorker extends ChildProcessWorker { // https://github.com/gpuweb/gpuweb/wiki/Implementation-Status#chromium-chrome-edge-etc args.push( '--no-sandbox', - '--enable-unsafe-webgpu', - '--ignore-gpu-blocklist', - '--enable-features=Vulkan', - '--disable-vulkan-surface', ); + + if (mode === 'webgpu') { + args.push( + '--enable-unsafe-webgpu', + '--enable-features=Vulkan', + '--disable-vulkan-surface', + ); + } } if (process.platform === 'darwin') { diff --git a/server/src/plugin/runtime/runtime-host.ts b/server/src/plugin/runtime/runtime-host.ts index ce4428578..81c493b5b 100644 --- a/server/src/plugin/runtime/runtime-host.ts +++ b/server/src/plugin/runtime/runtime-host.ts @@ -13,7 +13,13 @@ export function getBuiltinRuntimeHosts() { pluginHosts.set('custom', (_, pluginId, options, runtime) => new CustomRuntimeWorker(pluginId, options, runtime)); pluginHosts.set('python', (_, pluginId, options) => new PythonRuntimeWorker(pluginId, options)); pluginHosts.set('node', (mainFilename, pluginId, options) => new NodeForkWorker(mainFilename, pluginId, options)); - pluginHosts.set('electron', (mainFilename, pluginId, options, runtime) => new ElectronForkWorker(mainFilename, pluginId, options, runtime)); + + // safe + pluginHosts.set('electron', (mainFilename, pluginId, options, runtime) => new ElectronForkWorker(mainFilename, pluginId, options, runtime, 'default')); + // mostly safe + pluginHosts.set('electron-webgl', (mainFilename, pluginId, options, runtime) => new ElectronForkWorker(mainFilename, pluginId, options, runtime, 'webgl')); + // there be dragons + pluginHosts.set('electron-webgpu', (mainFilename, pluginId, options, runtime) => new ElectronForkWorker(mainFilename, pluginId, options, runtime, 'webgpu')); return pluginHosts; }