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: #2755
  • Loading branch information
Martino Fontana committed Jun 6, 2023
1 parent ccf32a4 commit cade35c
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 254 deletions.
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 @@ -45,9 +45,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"),
"DRI_PRIME": ("discrete_gpu", True),
"__NV_PRIME_RENDER_OFFLOAD": ("discrete_gpu", True),
"PULSE_LATENCY_MSEC": ("pulseaudio_latency", True),
Expand Down
9 changes: 0 additions & 9 deletions bottles/backend/wine/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def __init__(
override_dxvk: Optional[bool] = None,
override_vkd3d: Optional[bool] = None,
override_nvapi: Optional[bool] = None,
override_fsr: Optional[bool] = None,
override_virt_desktop: Optional[bool] = None
):
logging.info("Launching an executable…")
Expand Down Expand Up @@ -77,10 +76,6 @@ def __init__(
and self.config.Parameters.dxvk_nvapi:
env_dll_overrides.append("nvapi,nvapi64=b")

if override_fsr is not None and override_fsr:
self.environment["WINE_FULLSCREEN_FSR"] = "1"
self.environment["WINE_FULLSCREEN_FSR_STRENGTH"] = str(self.config.Parameters.fsr_sharpening_strength)

if "WINEDLLOVERRIDES" in self.environment:
self.environment["WINEDLLOVERRIDES"] += "," + ",".join(env_dll_overrides)
else:
Expand All @@ -94,7 +89,6 @@ def run_program(cls, config: BottleConfig, program: dict, terminal: bool = False
dxvk = config.Parameters.dxvk
vkd3d = config.Parameters.vkd3d
nvapi = config.Parameters.dxvk_nvapi
fsr = config.Parameters.fsr
virt_desktop = config.Parameters.virtual_desktop

if program.get("dxvk") != dxvk:
Expand All @@ -103,8 +97,6 @@ def run_program(cls, config: BottleConfig, program: dict, terminal: bool = False
vkd3d = program.get("vkd3d")
if program.get("dxvk_nvapi") != nvapi:
nvapi = program.get("dxvk_nvapi")
if program.get("fsr") != fsr:
fsr = program.get("fsr")
if program.get("virtual_desktop") != virt_desktop:
virt_desktop = program.get("virtual_desktop")

Expand All @@ -118,7 +110,6 @@ def run_program(cls, config: BottleConfig, program: dict, terminal: bool = False
override_dxvk=dxvk,
override_vkd3d=vkd3d,
override_nvapi=nvapi,
override_fsr=fsr,
override_virt_desktop=virt_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 @@ -338,13 +338,6 @@ def get_env(self, environment: Optional[dict] = None, return_steam_env: bool = F
# 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 @@ -556,9 +549,7 @@ def _get_gamescope_cmd(self, return_steam_cmd: bool = False) -> str:
gamescope_cmd.append("-n")
if params.fsr:
gamescope_cmd.append("-U")
# 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}")
gamescope_cmd.append(f"--fsr-sharpness {params.fsr_sharpening_strength}")
if params.gamescope_fps > 0:
gamescope_cmd.append(f"-r {params.gamescope_fps}")
if params.gamescope_fps_no_focus > 0:
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 @@ -594,7 +594,6 @@ def run_program(self):
override_dxvk=_dxvk,
override_vkd3d=_vkd3d,
override_nvapi=_nvapi,
override_fsr=_fsr,
override_virt_desktop=_virt_desktop
).run_cli()

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 @@ -39,7 +39,6 @@
<file>dialog-rename.ui</file>
<file>dialog-gamescope.ui</file>
<file>dialog-vkbasalt.ui</file>
<file>dialog-fsr.ui</file>
<file>dialog-display.ui</file>
<file>dialog-drives.ui</file>
<file>dialog-journal.ui</file>
Expand Down
19 changes: 0 additions & 19 deletions bottles/frontend/ui/details-preferences.blp
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,6 @@ template DetailsPreferences : .AdwPreferencesPage {
}
}

.AdwActionRow {
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;
}
}

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

This file was deleted.

30 changes: 30 additions & 0 deletions bottles/frontend/ui/dialog-gamescope.blp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,36 @@ template GamescopeDialog : .AdwWindow {
}
}
}

.AdwPreferencesGroup {
title: _("FSR");

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

Switch switch_fsr {
valign: center;
}
}

.AdwActionRow {
title: _("Sharpening Strength");

SpinButton {
numeric: true;
valign: center;
adjustment:
Adjustment spin_sharpening_strength {
step-increment: 4;
upper: 20;
}

;
}
}
}

}
}
}
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 @@ -152,15 +152,6 @@ template LaunchOptionsDialog : .AdwWindow {
}
}

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

Switch switch_fsr {
valign: center;
}
}

.AdwActionRow action_virt_desktop {
title: _("Virtual Desktop");
activatable-widget: "switch_virt_desktop";
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 @@ -30,7 +30,6 @@ blueprints = custom_target('blueprints',
'dialog-vkbasalt.blp',
'dialog-display.blp',
'dialog-vmtouch.blp',
'dialog-fsr.blp',
'dll-override-entry.blp',
'drive-entry.blp',
'env-var-entry.blp',
Expand Down
24 changes: 0 additions & 24 deletions bottles/frontend/views/bottle_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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.protonalert import ProtonAlertDialog
from bottles.frontend.windows.sandbox import SandboxDialog
Expand All @@ -59,7 +58,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_sandbox = Gtk.Template.Child()
btn_manage_versioning_patterns = Gtk.Template.Child()
btn_manage_vmtouch = Gtk.Template.Child()
Expand All @@ -81,7 +79,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 @@ -137,7 +134,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_sandbox.connect("clicked", self.__show_sandbox_settings)
self.btn_manage_versioning_patterns.connect("clicked", self.__show_exclusionpatterns_settings)
self.btn_manage_vmtouch.connect("clicked", self.__show_vmtouch_settings)
Expand All @@ -146,7 +142,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 @@ -375,7 +370,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 @@ -397,7 +391,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 @@ -500,7 +493,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 @@ -536,13 +528,6 @@ def __show_vkbasalt_settings(self, widget):
)
new_window.present()

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

def __show_display_settings(self, widget):
new_window = DisplayDialog(
parent_window=self.window,
Expand Down Expand Up @@ -638,15 +623,6 @@ def __toggle_vkbasalt(self, widget, 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 cade35c

Please sign in to comment.