Move WebGPU/Electron Store outside of Window creation function to prevent WebGPU initialization failure.

This commit is contained in:
cryptofyre 2021-12-26 17:23:03 -06:00
parent f6e4981083
commit d344aee948

View file

@ -5,8 +5,6 @@ const { app } = require('electron');
const ElectronSentry = require("@sentry/electron"); const ElectronSentry = require("@sentry/electron");
ElectronSentry.init({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214" }); ElectronSentry.init({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214" });
// Enable WebGPU and list adapters (EXPERIMENTAL.)
const configSchema = { const configSchema = {
"general": { "general": {
"close_behavior": 0, // 0 = close, 1 = minimize, 2 = minimize to tray "close_behavior": 0, // 0 = close, 1 = minimize, 2 = minimize to tray
@ -40,12 +38,9 @@ const configSchema = {
} }
} }
// Enable WebGPU and list adapters (EXPERIMENTAL.)
// Note: THIS HAS TO BE BEFORE ANYTHING GETS INITIALIZED.
// Creating the Application Window and Calling all the Functions
function CreateWindow() {
if (app.isQuiting) { app.quit(); return; }
// store
const Store = require("electron-store"); const Store = require("electron-store");
app.cfg = new Store({ app.cfg = new Store({
defaults: configSchema, defaults: configSchema,
@ -58,7 +53,7 @@ function CreateWindow() {
break; break;
case "webgpu": case "webgpu":
console.info("WebGPU is enabled."); console.info("WebGPU is enabled.");
app.commandLine.appendSwitch('enable-unsafe-webgpu'); app.commandLine.appendSwitch('enable-unsafe-webgpu')
break; break;
case "disabled": case "disabled":
console.info("Hardware acceleration is disabled."); console.info("Hardware acceleration is disabled.");
@ -67,6 +62,10 @@ function CreateWindow() {
} }
// Creating the Application Window and Calling all the Functions
function CreateWindow() {
if (app.isQuiting) { app.quit(); return; }
/** CIDER **/ /** CIDER **/
const ciderwin = require("./src/main/cider-base") const ciderwin = require("./src/main/cider-base")
app.win = ciderwin app.win = ciderwin