mirror of
https://github.com/koush/scrypted.git
synced 2026-04-27 02:11:08 +01:00
server: break out electron runtimes
This commit is contained in:
@@ -11,7 +11,7 @@ export class ElectronForkWorker extends ChildProcessWorker {
|
||||
static allocatedDisplays = new Set<number>();
|
||||
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') {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user