Skip to content

Commit

Permalink
Use vendor id to check for nvidia
Browse files Browse the repository at this point in the history
  • Loading branch information
eero-lehtinen committed Mar 30, 2024
1 parent 8a0eada commit 8c940ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/bevy_render/src/view/window/mod.rs
Expand Up @@ -218,6 +218,9 @@ impl WindowSurfaces {
}
}

#[cfg(target_os = "linux")]
const NVIDIA_VENDOR_ID: u32 = 0x10DE;

/// (re)configures window surfaces, and obtains a swapchain texture for rendering.
///
/// NOTE: `get_current_texture` in `prepare_windows` can take a long time if the GPU workload is
Expand Down Expand Up @@ -311,7 +314,7 @@ pub fn prepare_windows(
render_instance
.enumerate_adapters(wgpu::Backends::VULKAN)
.iter()
.any(|adapter| adapter.get_info().name.starts_with("NVIDIA"))
.any(|adapter| adapter.get_info().vendor & 0xFFFF == NVIDIA_VENDOR_ID)
};

let not_already_configured = window_surfaces.configured_windows.insert(window.entity);
Expand Down

0 comments on commit 8c940ac

Please sign in to comment.