|
1 | 1 | use settings::{macros::define_settings_group, SupportedPlatforms, SyncToCloud}; |
| 2 | +use warp_core::features::FeatureFlag; |
2 | 3 | use warpui::platform::GraphicsBackend; |
3 | 4 |
|
| 5 | +fn default_to_windows_high_performance_gpu() -> bool { |
| 6 | + cfg!(windows) && FeatureFlag::WindowsHighPerformanceGpuDefault.is_enabled() |
| 7 | +} |
| 8 | + |
4 | 9 | define_settings_group!(GPUSettings, settings: [ |
5 | | - prefer_low_power_gpu: PreferLowPowerGPU { |
6 | | - type: bool, |
7 | | - // Opt for the low power (integrated) GPU on Windows / Linux since discrete GPUs tend to be |
8 | | - // more unstable. |
9 | | - default: cfg!(any(target_os = "linux", target_os = "freebsd", windows)), |
10 | | - supported_platforms: SupportedPlatforms::ALL, |
11 | | - sync_to_cloud: SyncToCloud::Never, |
12 | | - private: false, |
13 | | - toml_path: "system.prefer_low_power_gpu", |
14 | | - description: "Whether to prefer the integrated (low-power) GPU.", |
15 | | - }, |
16 | | - preferred_backend: PreferredGraphicsBackend { |
17 | | - type: Option<GraphicsBackend>, |
18 | | - default: None, |
19 | | - supported_platforms: SupportedPlatforms::WINDOWS, |
20 | | - sync_to_cloud: SyncToCloud::Never, |
21 | | - private: false, |
| 10 | + prefer_low_power_gpu: PreferLowPowerGPU { |
| 11 | + type: bool, |
| 12 | + default: cfg!(any(target_os = "linux", target_os = "freebsd")) |
| 13 | + || (cfg!(windows) && !default_to_windows_high_performance_gpu()), |
| 14 | + supported_platforms: SupportedPlatforms::ALL, |
| 15 | + sync_to_cloud: SyncToCloud::Never, |
| 16 | + private: false, |
| 17 | + toml_path: "system.prefer_low_power_gpu", |
| 18 | + description: "Whether to prefer the integrated (low-power) GPU.", |
| 19 | + }, |
| 20 | + preferred_backend: PreferredGraphicsBackend { |
| 21 | + type: Option<GraphicsBackend>, |
| 22 | + default: default_to_windows_high_performance_gpu().then_some(GraphicsBackend::Vulkan), |
| 23 | + supported_platforms: SupportedPlatforms::WINDOWS, |
| 24 | + sync_to_cloud: SyncToCloud::Never, |
| 25 | + private: false, |
22 | 26 | toml_path: "system.preferred_graphics_backend", |
23 | 27 | description: "The preferred graphics backend on Windows.", |
24 | 28 | }, |
|
0 commit comments