Skip to content

Commit

Permalink
FSR: only set in Gamescope (remove Wine FSR)
Browse files Browse the repository at this point in the history
Motivation: bottlesdevs#2755
  • Loading branch information
Martino Fontana authored and SuperSamus committed Dec 19, 2024
1 parent 0c07176 commit a1f3965
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 247 deletions.
1 change: 0 additions & 1 deletion bottles/backend/managers/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,6 @@ def get_programs(self, config: BottleConfig) -> List[dict]:
"dxvk": _program.get("dxvk"),
"vkd3d": _program.get("vkd3d"),
"dxvk_nvapi": _program.get("dxvk_nvapi"),
"fsr": _program.get("fsr"),
"gamescope": _program.get("gamescope"),
"pulseaudio_latency": _program.get("pulseaudio_latency"),
"virtual_desktop": _program.get("virtual_desktop"),
Expand Down
3 changes: 1 addition & 2 deletions bottles/backend/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ class BottleParams(DictCompatMixIn):
gamescope_fullscreen: bool = True
sync: str = "wine"
fsr: bool = False
fsr_sharpening_strength: int = 2
fsr_quality_mode: str = "none"
fsr_sharpening_strength: int = 8
custom_dpi: int = 96
renderer: str = "gl"
discrete_gpu: bool = False
Expand Down
3 changes: 0 additions & 3 deletions bottles/backend/models/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ class Samples:
"ENABLE_VKBASALT": ("vkbasalt", True),
"WINEESYNC": ("sync", "esync"),
"WINEFSYNC": ("sync", "fsync"),
"WINE_FULLSCREEN_FSR": ("fsr", True),
"WINE_FULLSCREEN_FSR_STRENGTH": ("fsr_sharpening_strength", 2),
"WINE_FULLSCREEN_FSR_MODE": ("fsr_quality_mode", "none"),
"GAMESCOPE": ("gamescope", False),
"DRI_PRIME": ("discrete_gpu", True),
"__NV_PRIME_RENDER_OFFLOAD": ("discrete_gpu", True),
Expand Down
12 changes: 0 additions & 12 deletions bottles/backend/wine/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(
program_dxvk: Optional[bool] = None,
program_vkd3d: Optional[bool] = None,
program_nvapi: Optional[bool] = None,
program_fsr: Optional[bool] = None,
program_gamescope: Optional[bool] = None,
program_virt_desktop: Optional[bool] = None,
):
Expand Down Expand Up @@ -87,16 +86,6 @@ def __init__(
override_nvapi = NVAPIComponent.get_override_keys() + "=b"
env_dll_overrides.append(override_nvapi)

if program_fsr is not None and program_fsr != self.config.Parameters.fsr:
self.environment["WINE_FULLSCREEN_FSR"] = "1" if program_fsr else "0"
self.environment["WINE_FULLSCREEN_FSR_STRENGTH"] = str(
self.config.Parameters.fsr_sharpening_strength
)
if self.config.Parameters.fsr_quality_mode:
self.environment["WINE_FULLSCREEN_FSR_MODE"] = str(
self.config.Parameters.fsr_quality_mode
)

if (
program_gamescope is not None
and program_gamescope != self.config.Parameters.gamescope
Expand Down Expand Up @@ -127,7 +116,6 @@ def run_program(cls, config: BottleConfig, program: dict, terminal: bool = False
program_dxvk=program.get("dxvk"),
program_vkd3d=program.get("vkd3d"),
program_nvapi=program.get("dxvk_nvapi"),
program_fsr=program.get("fsr"),
program_gamescope=program.get("gamescope"),
program_virt_desktop=program.get("virtual_desktop"),
).run()
Expand Down
11 changes: 1 addition & 10 deletions bottles/backend/wine/winecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,6 @@ def get_env(
# if params["aco_compiler"]:
# env.add("ACO_COMPILER", "aco")

# FSR
if params.fsr:
env.add("WINE_FULLSCREEN_FSR", "1")
env.add("WINE_FULLSCREEN_FSR_STRENGTH", str(params.fsr_sharpening_strength))
if params.fsr_quality_mode:
env.add("WINE_FULLSCREEN_FSR_MODE", str(params.fsr_quality_mode))

# PulseAudio latency
if params.pulseaudio_latency:
env.add("PULSE_LATENCY_MSEC", "60")
Expand Down Expand Up @@ -622,10 +615,8 @@ def _get_gamescope_cmd(self, return_steam_cmd: bool = False) -> str:
gamescope_cmd.append("-S integer")
if params.fsr:
gamescope_cmd.append("-F fsr")
# Upscaling sharpness is from 0 to 20. There are 5 FSR upscaling levels,
# so multiply by 4 to reach 20
gamescope_cmd.append(
f"--fsr-sharpness {params.fsr_sharpening_strength * 4}"
f"--fsr-sharpness {params.fsr_sharpening_strength}"
)
if params.gamescope_fps > 0:
gamescope_cmd.append(f"-r {params.gamescope_fps}")
Expand Down
1 change: 0 additions & 1 deletion bottles/frontend/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ def run_program(self):
program.get("dxvk")
program.get("vkd3d")
program.get("dxvk_nvapi")
program.get("fsr")
program.get("gamescope")
program.get("virtual_desktop")

Expand Down
1 change: 0 additions & 1 deletion bottles/frontend/ui/bottles.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<file preprocess="xml-stripblanks">dialog-rename.ui</file>
<file preprocess="xml-stripblanks">dialog-gamescope.ui</file>
<file preprocess="xml-stripblanks">dialog-vkbasalt.ui</file>
<file preprocess="xml-stripblanks">dialog-fsr.ui</file>
<file preprocess="xml-stripblanks">dialog-mangohud.ui</file>
<file preprocess="xml-stripblanks">dialog-display.ui</file>
<file preprocess="xml-stripblanks">dialog-drives.ui</file>
Expand Down
20 changes: 0 additions & 20 deletions bottles/frontend/ui/details-preferences.blp
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,6 @@ template $DetailsPreferences: Adw.PreferencesPage {
}
}

Adw.ActionRow {
activatable-widget: switch_fsr;
title: _("FidelityFX Super Resolution");
subtitle: _("Increase performance at the expense of visuals. Only works on Vulkan.");

Button btn_manage_fsr {
tooltip-text: _("Manage FidelityFX Super Resolution settings");
valign: center;
icon-name: "applications-system-symbolic";

styles [
"flat",
]
}

Switch switch_fsr {
valign: center;
}
}

Adw.ActionRow row_discrete {
visible: false;
activatable-widget: switch_discrete;
Expand Down
63 changes: 0 additions & 63 deletions bottles/frontend/ui/dialog-fsr.blp

This file was deleted.

27 changes: 27 additions & 0 deletions bottles/frontend/ui/dialog-gamescope.blp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,33 @@ template $GamescopeDialog: Adw.Window {
}
}

Adw.PreferencesGroup {
title: _("FSR");

Adw.ActionRow {
title: _("Enable");
activatable-widget: switch_fsr;

Switch switch_fsr {
valign: center;
}
}

Adw.ActionRow {
title: _("Sharpening Strength");

SpinButton {
numeric: true;
valign: center;

adjustment: Adjustment spin_sharpening_strength {
step-increment: 4;
upper: 20;
};
}
}
}

Adw.PreferencesGroup {
title: _("Miscellaneous");

Expand Down
9 changes: 0 additions & 9 deletions bottles/frontend/ui/dialog-launch-options.blp
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,6 @@ template $LaunchOptionsDialog: Adw.Window {
}
}

Adw.ActionRow action_fsr {
activatable-widget: switch_fsr;
title: "FSR";

Switch switch_fsr {
valign: center;
}
}

Adw.ActionRow action_gamescope {
title: _("Gamescope");
activatable-widget: switch_gamescope;
Expand Down
1 change: 0 additions & 1 deletion bottles/frontend/ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ blueprints = custom_target('blueprints',
'dialog-vkbasalt.blp',
'dialog-display.blp',
'dialog-vmtouch.blp',
'dialog-fsr.blp',
'dialog-mangohud.blp',
'dll-override-entry.blp',
'drive-entry.blp',
Expand Down
18 changes: 0 additions & 18 deletions bottles/frontend/views/bottle_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
from bottles.frontend.windows.drives import DrivesDialog
from bottles.frontend.windows.envvars import EnvVarsDialog
from bottles.frontend.windows.exclusionpatterns import ExclusionPatternsDialog
from bottles.frontend.windows.fsr import FsrDialog
from bottles.frontend.windows.gamescope import GamescopeDialog
from bottles.frontend.windows.mangohud import MangoHudDialog
from bottles.frontend.windows.protonalert import ProtonAlertDialog
Expand All @@ -67,7 +66,6 @@ class PreferencesView(Adw.PreferencesPage):
# region Widgets
btn_manage_gamescope = Gtk.Template.Child()
btn_manage_vkbasalt = Gtk.Template.Child()
btn_manage_fsr = Gtk.Template.Child()
btn_manage_mangohud = Gtk.Template.Child()
btn_manage_sandbox = Gtk.Template.Child()
btn_manage_versioning_patterns = Gtk.Template.Child()
Expand All @@ -90,7 +88,6 @@ class PreferencesView(Adw.PreferencesPage):
switch_mangohud = Gtk.Template.Child()
switch_obsvkc = Gtk.Template.Child()
switch_vkbasalt = Gtk.Template.Child()
switch_fsr = Gtk.Template.Child()
switch_nvapi = Gtk.Template.Child()
switch_gamemode = Gtk.Template.Child()
switch_gamescope = Gtk.Template.Child()
Expand Down Expand Up @@ -146,7 +143,6 @@ def __init__(self, details, config, **kwargs):
self.row_manage_display.connect("activated", self.__show_display_settings)
self.btn_manage_gamescope.connect("clicked", self.__show_gamescope_settings)
self.btn_manage_vkbasalt.connect("clicked", self.__show_vkbasalt_settings)
self.btn_manage_fsr.connect("clicked", self.__show_fsr_settings)
self.btn_manage_mangohud.connect("clicked", self.__show_mangohud_settings)
self.btn_manage_sandbox.connect("clicked", self.__show_sandbox_settings)
self.btn_manage_versioning_patterns.connect(
Expand All @@ -158,7 +154,6 @@ def __init__(self, details, config, **kwargs):
self.switch_mangohud.connect("state-set", self.__toggle_mangohud)
self.switch_obsvkc.connect("state-set", self.__toggle_obsvkc)
self.switch_vkbasalt.connect("state-set", self.__toggle_vkbasalt)
self.switch_fsr.connect("state-set", self.__toggle_fsr)
self.switch_nvapi.connect("state-set", self.__toggle_nvapi)
# self.switch_latencyflex.connect('state-set', self.__toggle_latencyflex)
self.switch_gamemode.connect("state-set", self.__toggle_gamemode)
Expand Down Expand Up @@ -414,7 +409,6 @@ def set_config(self, config: BottleConfig):
self.switch_mangohud.handler_block_by_func(self.__toggle_mangohud)
self.switch_nvapi.handler_block_by_func(self.__toggle_nvapi)
self.switch_vkbasalt.handler_block_by_func(self.__toggle_vkbasalt)
self.switch_fsr.handler_block_by_func(self.__toggle_fsr)
self.switch_obsvkc.handler_block_by_func(self.__toggle_obsvkc)
self.switch_gamemode.handler_block_by_func(self.__toggle_gamemode)
self.switch_gamescope.handler_block_by_func(self.__toggle_gamescope)
Expand All @@ -440,7 +434,6 @@ def set_config(self, config: BottleConfig):
self.switch_mangohud.set_active(parameters.mangohud)
self.switch_obsvkc.set_active(parameters.obsvkc)
self.switch_vkbasalt.set_active(parameters.vkbasalt)
self.switch_fsr.set_active(parameters.fsr)
self.switch_nvapi.set_active(parameters.dxvk_nvapi)
self.switch_gamemode.set_active(parameters.gamemode)
self.switch_gamescope.set_active(parameters.gamescope)
Expand Down Expand Up @@ -552,7 +545,6 @@ def set_config(self, config: BottleConfig):
self.switch_mangohud.handler_unblock_by_func(self.__toggle_mangohud)
self.switch_nvapi.handler_unblock_by_func(self.__toggle_nvapi)
self.switch_vkbasalt.handler_unblock_by_func(self.__toggle_vkbasalt)
self.switch_fsr.handler_unblock_by_func(self.__toggle_fsr)
self.switch_obsvkc.handler_unblock_by_func(self.__toggle_obsvkc)
self.switch_gamemode.handler_unblock_by_func(self.__toggle_gamemode)
self.switch_gamescope.handler_unblock_by_func(self.__toggle_gamescope)
Expand Down Expand Up @@ -590,10 +582,6 @@ def __show_vkbasalt_settings(self, widget):
new_window = VkBasaltDialog(parent_window=self.window, config=self.config)
new_window.present()

def __show_fsr_settings(self, widget):
new_window = FsrDialog(parent_window=self.window, config=self.config)
new_window.present()

def __show_mangohud_settings(self, widget):
new_window = MangoHudDialog(parent_window=self.window, config=self.config)
new_window.present()
Expand Down Expand Up @@ -669,12 +657,6 @@ def __toggle_vkbasalt(self, widget, state):
config=self.config, key="vkbasalt", value=state, scope="Parameters"
).data["config"]

def __toggle_fsr(self, widget, state):
"""Toggle the FSR for current bottle"""
self.config = self.manager.update_config(
config=self.config, key="fsr", value=state, scope="Parameters"
).data["config"]

def __toggle_nvapi(self, widget=False, state=False):
"""Install/Uninstall NVAPI from the bottle"""
self.queue.add_task()
Expand Down
Loading

0 comments on commit a1f3965

Please sign in to comment.