Skip to content

Commit

Permalink
desktop: Do not warn about GameMode on non-Linux unless explicitly en…
Browse files Browse the repository at this point in the history
…abled

This makes sure the warning is logged only when someone tries
explicitly enabling GameMode.
  • Loading branch information
kjarosh authored and Dinnerbone committed Oct 12, 2024
1 parent 987a59c commit 27182b3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions desktop/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,20 @@ impl ActivePlayer {
}
}

#[cfg_attr(not(target_os = "linux"), allow(unused))]
let gamemode_enable = match preferences.gamemode_preference() {
GameModePreference::Default => {
preferences.graphics_power_preference() == PowerPreference::High
}
GameModePreference::On => true,
GameModePreference::On => {
if cfg!(not(target_os = "linux")) {
tracing::warn!("Cannot enable GameMode, as it is supported only on Linux");
}
true
}
GameModePreference::Off => false,
};

if cfg!(not(target_os = "linux")) && gamemode_enable {
tracing::warn!("Cannot enable GameMode, as it is supported only on Linux");
}

let renderer = WgpuRenderBackend::new(descriptors, movie_view)
.map_err(|e| anyhow!(e.to_string()))
.expect("Couldn't create wgpu rendering backend");
Expand Down

0 comments on commit 27182b3

Please sign in to comment.