mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Add "GPU configuration" setting
This commit is contained in:
parent
dbbdc48aab
commit
210fdfbabe
@ -1,6 +1,7 @@
|
|||||||
import vertClarityBoost from "./shaders/clarity_boost.vert" with { type: "text" };
|
import vertClarityBoost from "./shaders/clarity_boost.vert" with { type: "text" };
|
||||||
import fsClarityBoost from "./shaders/clarity_boost.fs" with { type: "text" };
|
import fsClarityBoost from "./shaders/clarity_boost.fs" with { type: "text" };
|
||||||
import { BxLogger } from "@/utils/bx-logger";
|
import { BxLogger } from "@/utils/bx-logger";
|
||||||
|
import { getPref, PrefKey } from "@/utils/preferences";
|
||||||
|
|
||||||
|
|
||||||
const LOG_TAG = 'WebGL2Player';
|
const LOG_TAG = 'WebGL2Player';
|
||||||
@ -120,11 +121,13 @@ export class WebGL2Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#setupShaders() {
|
#setupShaders() {
|
||||||
|
BxLogger.info(LOG_TAG, 'Setting up', getPref(PrefKey.VIDEO_POWER_PREFERENCE));
|
||||||
|
|
||||||
const gl = this.#$canvas.getContext('webgl2', {
|
const gl = this.#$canvas.getContext('webgl2', {
|
||||||
isBx: true,
|
isBx: true,
|
||||||
antialias: true,
|
antialias: true,
|
||||||
alpha: false,
|
alpha: false,
|
||||||
powerPreference: 'high-performance',
|
powerPreference: getPref(PrefKey.VIDEO_POWER_PREFERENCE),
|
||||||
}) as WebGL2RenderingContext;
|
}) as WebGL2RenderingContext;
|
||||||
this.#gl = gl;
|
this.#gl = gl;
|
||||||
|
|
||||||
|
@ -260,9 +260,20 @@ export class StreamPlayer {
|
|||||||
this.#resizePlayer();
|
this.#resizePlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reloadPlayer() {
|
||||||
|
this.#cleanUpWebGL2Player();
|
||||||
|
|
||||||
|
this.#playerType = StreamPlayerType.VIDEO;
|
||||||
|
this.setPlayerType(StreamPlayerType.WEBGL2, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#cleanUpWebGL2Player() {
|
||||||
|
// Clean up WebGL2 Player
|
||||||
|
this.#webGL2Player?.destroy();
|
||||||
|
this.#webGL2Player = null;
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
// Cleanup WebGL2 Player
|
this.#cleanUpWebGL2Player();
|
||||||
this.#webGL2Player?.destroy();
|
|
||||||
this.#webGL2Player = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ export function onChangeVideoPlayerType() {
|
|||||||
const playerType = getPref(PrefKey.VIDEO_PLAYER_TYPE);
|
const playerType = getPref(PrefKey.VIDEO_PLAYER_TYPE);
|
||||||
const $videoProcessing = document.getElementById('bx_setting_video_processing') as HTMLSelectElement;
|
const $videoProcessing = document.getElementById('bx_setting_video_processing') as HTMLSelectElement;
|
||||||
const $videoSharpness = document.getElementById('bx_setting_video_sharpness') as HTMLElement;
|
const $videoSharpness = document.getElementById('bx_setting_video_sharpness') as HTMLElement;
|
||||||
|
const $videoPowerPreference = document.getElementById('bx_setting_video_power_preference') as HTMLElement;
|
||||||
|
|
||||||
let isDisabled = false;
|
let isDisabled = false;
|
||||||
|
|
||||||
@ -28,6 +29,9 @@ export function onChangeVideoPlayerType() {
|
|||||||
$videoProcessing.disabled = isDisabled;
|
$videoProcessing.disabled = isDisabled;
|
||||||
$videoSharpness.dataset.disabled = isDisabled.toString();
|
$videoSharpness.dataset.disabled = isDisabled.toString();
|
||||||
|
|
||||||
|
// Hide Power Preference setting if renderer isn't WebGL2
|
||||||
|
$videoPowerPreference.closest('.bx-stream-settings-row')!.classList.toggle('bx-gone', playerType !== StreamPlayerType.WEBGL2);
|
||||||
|
|
||||||
updateVideoPlayer();
|
updateVideoPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,17 @@ export class StreamSettings {
|
|||||||
}, {
|
}, {
|
||||||
pref: PrefKey.VIDEO_PROCESSING,
|
pref: PrefKey.VIDEO_PROCESSING,
|
||||||
onChange: updateVideoPlayer,
|
onChange: updateVideoPlayer,
|
||||||
|
}, {
|
||||||
|
pref: PrefKey.VIDEO_POWER_PREFERENCE,
|
||||||
|
onChange: () => {
|
||||||
|
const streamPlayer = STATES.currentStream.streamPlayer;
|
||||||
|
if (!streamPlayer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
streamPlayer.reloadPlayer();
|
||||||
|
updateVideoPlayer();
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
pref: PrefKey.VIDEO_SHARPNESS,
|
pref: PrefKey.VIDEO_SHARPNESS,
|
||||||
onChange: updateVideoPlayer,
|
onChange: updateVideoPlayer,
|
||||||
|
@ -82,6 +82,7 @@ export enum PrefKey {
|
|||||||
|
|
||||||
VIDEO_PLAYER_TYPE = 'video_player_type',
|
VIDEO_PLAYER_TYPE = 'video_player_type',
|
||||||
VIDEO_PROCESSING = 'video_processing',
|
VIDEO_PROCESSING = 'video_processing',
|
||||||
|
VIDEO_POWER_PREFERENCE = 'video_power_preference',
|
||||||
VIDEO_SHARPNESS = 'video_sharpness',
|
VIDEO_SHARPNESS = 'video_sharpness',
|
||||||
VIDEO_RATIO = 'video_ratio',
|
VIDEO_RATIO = 'video_ratio',
|
||||||
VIDEO_BRIGHTNESS = 'video_brightness',
|
VIDEO_BRIGHTNESS = 'video_brightness',
|
||||||
@ -637,6 +638,15 @@ export class Preferences {
|
|||||||
[StreamVideoProcessing.CAS]: t('amd-fidelity-cas'),
|
[StreamVideoProcessing.CAS]: t('amd-fidelity-cas'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
[PrefKey.VIDEO_POWER_PREFERENCE]: {
|
||||||
|
label: t('gpu-configuration'),
|
||||||
|
default: 'default',
|
||||||
|
options: {
|
||||||
|
'default': t('default'),
|
||||||
|
'high-performance': t('high-performance'),
|
||||||
|
'low-power': t('low-power'),
|
||||||
|
},
|
||||||
|
},
|
||||||
[PrefKey.VIDEO_SHARPNESS]: {
|
[PrefKey.VIDEO_SHARPNESS]: {
|
||||||
label: t('sharpness'),
|
label: t('sharpness'),
|
||||||
type: SettingElementType.NUMBER_STEPPER,
|
type: SettingElementType.NUMBER_STEPPER,
|
||||||
|
@ -110,6 +110,7 @@ const Texts = {
|
|||||||
"fortnite-force-console-version": "Fortnite: force console version",
|
"fortnite-force-console-version": "Fortnite: force console version",
|
||||||
"game-bar": "Game Bar",
|
"game-bar": "Game Bar",
|
||||||
"getting-consoles-list": "Getting the list of consoles...",
|
"getting-consoles-list": "Getting the list of consoles...",
|
||||||
|
"gpu-configuration": "GPU configuration",
|
||||||
"help": "Help",
|
"help": "Help",
|
||||||
"hide": "Hide",
|
"hide": "Hide",
|
||||||
"hide-idle-cursor": "Hide mouse cursor on idle",
|
"hide-idle-cursor": "Hide mouse cursor on idle",
|
||||||
@ -117,6 +118,7 @@ const Texts = {
|
|||||||
"hide-sections": "Hide sections",
|
"hide-sections": "Hide sections",
|
||||||
"hide-system-menu-icon": "Hide System menu's icon",
|
"hide-system-menu-icon": "Hide System menu's icon",
|
||||||
"hide-touch-controller": "Hide touch controller",
|
"hide-touch-controller": "Hide touch controller",
|
||||||
|
"high-performance": "High performance",
|
||||||
"horizontal-scroll-sensitivity": "Horizontal scroll sensitivity",
|
"horizontal-scroll-sensitivity": "Horizontal scroll sensitivity",
|
||||||
"horizontal-sensitivity": "Horizontal sensitivity",
|
"horizontal-sensitivity": "Horizontal sensitivity",
|
||||||
"ignore": "Ignore",
|
"ignore": "Ignore",
|
||||||
@ -130,6 +132,7 @@ const Texts = {
|
|||||||
"left-stick": "Left stick",
|
"left-stick": "Left stick",
|
||||||
"loading-screen": "Loading screen",
|
"loading-screen": "Loading screen",
|
||||||
"local-co-op": "Local co-op",
|
"local-co-op": "Local co-op",
|
||||||
|
"low-power": "Low power",
|
||||||
"map-mouse-to": "Map mouse to",
|
"map-mouse-to": "Map mouse to",
|
||||||
"may-not-work-properly": "May not work properly!",
|
"may-not-work-properly": "May not work properly!",
|
||||||
"menu": "Menu",
|
"menu": "Menu",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user