feat(fp16): add no fp16 flag to ui

This commit is contained in:
PancakeTAS 2025-08-05 02:19:32 +02:00 committed by Pancake
parent 012b18b97c
commit 3a86e5ade4
6 changed files with 21 additions and 1 deletions

View file

@ -39,6 +39,14 @@
<property name="icon-name">folder-symbolic</property>
</object>
</child>
<!--General Properties: FP16 Override -->
<child>
<object class="LSPrefSwitch" id="no_fp16">
<property name="opt-name">Force-disable FP16</property>
<property name="opt-subtitle">(Global Option) Force-disable FP16 acceleration (use on older NVIDIA GPUs)</property>
<property name="default-state">false</property>
</object>
</child>
<!--General Properties: Profile name -->
<child>
<object class="LSPrefEntry" id="profile_name">

View file

@ -30,6 +30,7 @@ pub fn default_config() -> TomlConfig {
version: 1,
global: TomlGlobal {
dll: None,
no_fp16: false
},
game: vec![
TomlGame {

View file

@ -62,7 +62,9 @@ impl Into<u32> for PresentMode {
/// Global configuration for the application
#[derive(Debug, Default, Clone, Deserialize, Serialize)]
pub struct TomlGlobal {
pub dll: Option<String>
pub dll: Option<String>,
#[serde(default)]
pub no_fp16: bool
}
/// Game-specific configuration

View file

@ -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());

View file

@ -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();

View file

@ -9,6 +9,8 @@ pub struct PaneMain {
#[template_child]
pub dll: TemplateChild<PrefEntry>,
#[template_child]
pub no_fp16: TemplateChild<PrefSwitch>,
#[template_child]
pub profile_name: TemplateChild<PrefEntry>,
#[template_child]
pub multiplier: TemplateChild<PrefNumber>,