Add HDR toggle for Gamescope

This commit is contained in:
Mathieu Comandon 2024-03-07 00:46:27 -08:00
parent 4f137566ff
commit 2ac897b719
2 changed files with 21 additions and 2 deletions

View file

@ -88,18 +88,24 @@ def get_launch_parameters(runner, gameplay_info):
has_gamescope = system_config.get("gamescope") and system.can_find_executable("gamescope")
if has_gamescope:
launch_arguments = get_gamescope_args(launch_arguments, system_config)
if system_config.get("gamescope_hdr"):
env["ENABLE_HDR_WSI"] = "1"
return launch_arguments, env
def get_gamescope_args(launch_arguments, system_config):
"""Insert gamescope at the start of the launch arguments"""
if system_config.get("gamescope_hdr"):
launch_arguments.insert(0, "DISABLE_HDR_WSI=1")
launch_arguments.insert(0, "DXVK_HDR=1")
launch_arguments.insert(0, "ENABLE_GAMESCOPE_WSI=1")
launch_arguments.insert(0, "env")
launch_arguments.insert(0, "--")
if system_config.get("gamescope_force_grab_cursor"):
launch_arguments.insert(0, "--force-grab-cursor")
if system_config.get("gamescope_fsr_sharpness"):
gamescope_fsr_sharpness = system_config["gamescope_fsr_sharpness"]
launch_arguments.insert(0, gamescope_fsr_sharpness)
launch_arguments.insert(0, system_config["gamescope_fsr_sharpness"])
launch_arguments.insert(0, "--fsr-sharpness")
launch_arguments[0:0] = _get_gamescope_fsr_option()
if system_config.get("gamescope_flags"):
@ -128,6 +134,9 @@ def get_gamescope_args(launch_arguments, system_config):
gpu = GPUS[system_config["gpu"]]
launch_arguments.insert(0, gpu.pci_id)
launch_arguments.insert(0, "--prefer-vk-device")
if system_config.get("gamescope_hdr"):
launch_arguments.insert(0, "--hdr-debug-force-output")
launch_arguments.insert(0, "--hdr-enabled")
launch_arguments.insert(0, "gamescope")
return launch_arguments

View file

@ -209,6 +209,16 @@ system_options = [ # pylint: disable=invalid-name
"condition": system.can_find_executable("gamescope") and linux.LINUX_SYSTEM.nvidia_gamescope_support(),
"help": _("Use gamescope to draw the game window isolated from your desktop.\n" "Toggle fullscreen: Super + F"),
},
{
"section": _("Gamescope"),
"option": "gamescope_hdr",
"type": "bool",
"label": _("Enable HDR (Experimental)"),
"advanced": True,
"default": False,
"condition": bool(system.can_find_executable("gamescope")),
"help": _("Enable HDR for games that support it.\bn" "Requires Plasma 6 and VK_hdr_layer."),
},
{
"section": _("Gamescope"),
"option": "gamescope_force_grab_cursor",