diff --git a/ui/rsc/pane/main.ui b/ui/rsc/pane/main.ui index ccd0e95..437cd85 100644 --- a/ui/rsc/pane/main.ui +++ b/ui/rsc/pane/main.ui @@ -39,6 +39,14 @@ folder-symbolic + + + + Force-disable FP16 + (Global Option) Force-disable FP16 acceleration (use on older NVIDIA GPUs) + false + + diff --git a/ui/src/config.rs b/ui/src/config.rs index 3c8ba67..46644b3 100644 --- a/ui/src/config.rs +++ b/ui/src/config.rs @@ -30,6 +30,7 @@ pub fn default_config() -> TomlConfig { version: 1, global: TomlGlobal { dll: None, + no_fp16: false }, game: vec![ TomlGame { diff --git a/ui/src/config/structs.rs b/ui/src/config/structs.rs index 6c973f4..0c74df0 100644 --- a/ui/src/config/structs.rs +++ b/ui/src/config/structs.rs @@ -62,7 +62,9 @@ impl Into for PresentMode { /// Global configuration for the application #[derive(Debug, Default, Clone, Deserialize, Serialize)] pub struct TomlGlobal { - pub dll: Option + pub dll: Option, + #[serde(default)] + pub no_fp16: bool } /// Game-specific configuration diff --git a/ui/src/ui.rs b/ui/src/ui.rs index c0eaac1..7951abf 100644 --- a/ui/src/ui.rs +++ b/ui/src/ui.rs @@ -25,6 +25,7 @@ pub fn build(app: &adw::Application) { if let Some(dll_path) = config.global.dll { imp.main.imp().dll.imp().entry.set_text(&dll_path); } + imp.main.imp().no_fp16.imp().switch.set_active(config.global.no_fp16); // register handlers on sidebar pane. sidebar_handler::register_signals(&imp.sidebar, imp.main.clone()); diff --git a/ui/src/ui/main_handler.rs b/ui/src/ui/main_handler.rs index d33d28a..6693bf6 100644 --- a/ui/src/ui/main_handler.rs +++ b/ui/src/ui/main_handler.rs @@ -94,6 +94,12 @@ pub fn register_signals(sidebar_: pane::PaneSidebar, main: &pane::PaneMain) { } }); }); + let no_fp16 = main.no_fp16.imp(); + no_fp16.switch.connect_state_notify(|switch| { + let _ = config::edit_config(|config| { + config.global.no_fp16 = switch.state(); + }); + }); // utility buttons let entry = dll.entry.clone(); diff --git a/ui/src/wrapper/pane/main.rs b/ui/src/wrapper/pane/main.rs index e9b0def..9fb4e0d 100644 --- a/ui/src/wrapper/pane/main.rs +++ b/ui/src/wrapper/pane/main.rs @@ -9,6 +9,8 @@ pub struct PaneMain { #[template_child] pub dll: TemplateChild, #[template_child] + pub no_fp16: TemplateChild, + #[template_child] pub profile_name: TemplateChild, #[template_child] pub multiplier: TemplateChild,