Skip to content

Commit 48a7913

Browse files
author
lijiahao
committed
feat: Add vulkan option to resolve black screen
1 parent f82fae6 commit 48a7913

9 files changed

Lines changed: 65 additions & 33 deletions

File tree

app/background.js

Lines changed: 23 additions & 13 deletions
Large diffs are not rendered by default.

main/application.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,29 @@ export default class Application {
4545
);
4646
this._log = Debug("xstreaming");
4747

48-
// ElectronApp.commandLine.appendSwitch('use-vulkan')
49-
// // ElectronApp.commandLine.appendSwitch('use-angle', 'vulkan')
50-
// ElectronApp.commandLine.appendSwitch('enable-features', 'Vulkan,VulkanFromANGLE,DefaultANGLEVulkan,VaapiIgnoreDriverChecks,VaapiVideoDecoder,PlatformHEVCDecoderSupport,CanvasOopRasterization')
51-
// // ElectronApp.commandLine.appendSwitch('disable-features', 'UseChromeOSDirectVideoDecoder');
52-
// ElectronApp.commandLine.appendSwitch('enable-gpu-rasterization')
53-
// ElectronApp.commandLine.appendSwitch('enable-oop-rasterization')
54-
// ElectronApp.commandLine.appendSwitch('enable-accelerated-video-decode')
55-
// ElectronApp.commandLine.appendSwitch('ozone-platform-hint', 'x11')
56-
// ElectronApp.commandLine.appendSwitch('ignore-gpu-blocklist')
57-
// ElectronApp.commandLine.appendSwitch('no-sandbox');
58-
// ElectronApp.commandLine.appendSwitch('enable-zero-copy');
59-
60-
ElectronApp.commandLine.appendSwitch('ignore-gpu-blacklist')
61-
ElectronApp.commandLine.appendSwitch('enable-gpu-rasterization')
62-
ElectronApp.commandLine.appendSwitch('enable-oop-rasterization')
63-
ElectronApp.commandLine.appendSwitch('enable-accelerated-video-decode')
64-
ElectronApp.commandLine.appendSwitch('ozone-platform-hint', 'x11')
48+
const settings: any = this._store.get('settings', defaultSettings)
49+
50+
if (settings.use_vulkan) {
51+
ElectronApp.commandLine.appendSwitch('use-vulkan')
52+
ElectronApp.commandLine.appendSwitch('enable-features', 'Vulkan,VulkanFromANGLE,DefaultANGLEVulkan,VaapiIgnoreDriverChecks,VaapiVideoDecoder,PlatformHEVCDecoderSupport,CanvasOopRasterization')
53+
ElectronApp.commandLine.appendSwitch('enable-gpu-rasterization')
54+
ElectronApp.commandLine.appendSwitch('enable-oop-rasterization')
55+
ElectronApp.commandLine.appendSwitch('enable-accelerated-video-decode')
56+
ElectronApp.commandLine.appendSwitch('ozone-platform-hint', 'x11')
57+
ElectronApp.commandLine.appendSwitch('ignore-gpu-blocklist')
58+
ElectronApp.commandLine.appendSwitch('no-sandbox');
59+
ElectronApp.commandLine.appendSwitch('enable-zero-copy');
60+
} else {
61+
ElectronApp.commandLine.appendSwitch('ignore-gpu-blacklist')
62+
ElectronApp.commandLine.appendSwitch('enable-gpu-rasterization')
63+
ElectronApp.commandLine.appendSwitch('enable-oop-rasterization')
64+
ElectronApp.commandLine.appendSwitch('enable-accelerated-video-decode')
65+
ElectronApp.commandLine.appendSwitch('ozone-platform-hint', 'x11')
66+
}
6567

6668
this.readStartupFlags();
6769
this.loadApplicationDefaults();
6870

69-
// ElectronApp.removeAsDefaultProtocolClient('ms-xal-public-beta-000000004c20a908')
70-
7171
this._ipc = new Ipc(this);
7272
this._authentication = new Authentication(this);
7373

@@ -294,7 +294,7 @@ export default class Application {
294294
...windowOptions,
295295
});
296296

297-
this._mainWindow.openDevTools();
297+
// this._mainWindow.openDevTools();
298298

299299
if (settings.background_keepalive) {
300300
this._mainWindow.webContents.setBackgroundThrottling(false);

renderer/common/settings.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ const getSettingsMetas = (t) => {
9898
{value: true, label: t('Enable')},
9999
],
100100
},
101+
{
102+
name: 'use_vulkan',
103+
type: 'radio',
104+
title: t('value_vulkan_title'),
105+
description: t('value_vulkan_desc'),
106+
needRestart: true,
107+
data: [
108+
{value: false, label: t('Disable')},
109+
{value: true, label: t('Enable')},
110+
],
111+
},
101112
{
102113
name: 'fsr',
103114
type: 'radio',

renderer/context/userContext.defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const defaultSettings = {
6464
contrast: 100,
6565
brightness: 100,
6666
},
67+
use_vulkan: false,
6768
fsr: false,
6869
fsr_sharpness: 2,
6970
debug: false,

renderer/public/locales/en/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131
"Saved": "Saved",
132132
"Background keepalive": "Background keepalive",
133133
"background_keepalive_desc": "Whether keepalive input when app is in background(This feature is not available on Windows)",
134+
"value_vulkan_title": "Use Vulkan Rendering",
135+
"value_vulkan_desc": "Enabling Vulkan rendering can improve rendering performance on some devices, but may lead to instability (such as black screen, etc.)",
134136
"FSR": "FSR",
135137
"FSR started": "FSR started",
136138
"FSR_desc": "Enable FSR (FidelityFX Super Resolution) to achieve super-resolution, which can improve image clarity without increasing bandwidth, but will increase CPU/GPU load",

renderer/public/locales/jp/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@
117117
"Saved": "Saved",
118118
"Background keepalive": "Background keepalive",
119119
"background_keepalive_desc": "Whether keepalive input when app is in background",
120+
"value_vulkan_title": "Use Vulkan Rendering",
121+
"value_vulkan_desc": "Enabling Vulkan rendering can improve rendering performance on some devices, but may lead to instability (such as black screen, etc.)",
120122
"FSR": "FSR",
121123
"FSR started": "FSR started",
122124
"FSR_desc": "Enable FSR (FidelityFX Super Resolution) to achieve super-resolution, which can improve image clarity without increasing bandwidth, but will increase CPU/GPU load",

renderer/public/locales/pt/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
"Saved": "Saved",
130130
"Background keepalive": "Background keepalive",
131131
"background_keepalive_desc": "Whether keepalive input when app is in background(This feature is not available on Windows)",
132+
"value_vulkan_title": "Use Vulkan Rendering",
133+
"value_vulkan_desc": "Enabling Vulkan rendering can improve rendering performance on some devices, but may lead to instability (such as black screen, etc.)",
132134
"FSR": "FSR",
133135
"FSR started": "FSR started",
134136
"FSR_desc": "Enable FSR (FidelityFX Super Resolution) to achieve super-resolution, which can improve image clarity without increasing bandwidth, but will increase CPU/GPU load",

renderer/public/locales/zh/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
"Saved": "保存成功",
117117
"Background keepalive": "后台保持活跃",
118118
"background_keepalive_desc": "应用在后台时,是否保持手柄输入活跃(Windows无法使用该功能)",
119+
"value_vulkan_title": "使用Vulkan渲染",
120+
"value_vulkan_desc": "启用Vulkan渲染,可以提升部分设备的渲染性能,但可能会导致不稳定(比如黑屏等)",
119121
"FSR": "FSR",
120122
"FSR started": "FSR 已启动",
121123
"FSR_desc": "启用FSR(FidelityFX Super Resolution)实现超分辨率,可以在不增加带宽的情况下提升画面清晰度,但会增加CPU/GPU负载",

renderer/public/locales/zht/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
"Saved": "儲存成功",
117117
"Background keepalive": "後台保持活躍",
118118
"background_keepalive_desc": "應用在後台時,是否保持手柄輸入活躍(Windows無法使用該功能)",
119+
"value_vulkan_title": "使用Vulkan渲染",
120+
"value_vulkan_desc": "啟用Vulkan渲染,可以提升部分設備的渲染性能,但可能會導致不穩定(比如黑屏等)",
119121
"FSR": "FSR",
120122
"FSR started": "FSR 已启动",
121123
"FSR_desc": "啟用FSR(FidelityFX Super Resolution)實現超分辨率,可以在不增加帶寬的情況下提升畫面清晰度,但會增加CPU/GPU負載",

0 commit comments

Comments
 (0)