Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Improve GPU selection on Windows (#39264)
Cave Bats Of Warea78b560b8b56
diff --git a/crates/gpui/src/platform/windows/directx_devices.rs b/crates/gpui/src/platform/windows/directx_devices.rsindex 4fa4db82749..a6a2381777b 100644--- a/crates/gpui/src/platform/windows/directx_devices.rs+++ b/crates/gpui/src/platform/windows/directx_devices.rs@@ -14,10 +14,11 @@ use windows::Win32::{},Dxgi::{CreateDXGIFactory2, DXGI_CREATE_FACTORY_DEBUG, DXGI_CREATE_FACTORY_FLAGS,- DXGI_GPU_PREFERENCE_MINIMUM_POWER, IDXGIAdapter1, IDXGIFactory6,+ IDXGIAdapter1, IDXGIFactory6,},},};+use windows::core::Interface;pub(crate) fn try_to_recover_from_device_lost<T>(mut f: impl FnMut() -> Result<T>,@@ -121,10 +122,7 @@ fn get_dxgi_factory(debug_layer_available: bool) -> Result<IDXGIFactory6> {#[inline]fn get_adapter(dxgi_factory: &IDXGIFactory6, debug_layer_available: bool) -> Result<IDXGIAdapter1> {for adapter_index in 0.. {- let adapter: IDXGIAdapter1 = unsafe {- dxgi_factory- .EnumAdapterByGpuPreference(adapter_index, DXGI_GPU_PREFERENCE_MINIMUM_POWER)- }?;+ let adapter: IDXGIAdapter1 = unsafe { dxgi_factory.EnumAdapters(adapter_index)?.cast()? };if let Ok(desc) = unsafe { adapter.GetDesc1() } {let gpu_name = String::from_utf16_lossy(&desc.Description).trim_matches(char::from(0))