From b10456edb8c0eeb9b56c5e5281aa8db939392c76 Mon Sep 17 00:00:00 2001 From: Theo Dulka <127643579+TheoDulka@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:08:21 -0600 Subject: [PATCH] Use `VK_EXT_robustness2` only when not using an outdated intel iGPU driver (#4602) --- CHANGELOG.md | 4 ++++ wgpu-hal/src/vulkan/adapter.rs | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fe3646b4b..91c064e91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -158,6 +158,10 @@ Passing an owned value `window` to `Surface` will return a `Surface<'static>`. S ### Bug Fixes +#### Vulkan + +- Use `VK_EXT_robustness2` only when not using an outdated intel iGPU driver. By @TheoDulka in [#4602](https://github.com/gfx-rs/wgpu/pull/4602). + #### WebGPU - Allow calling `BufferSlice::get_mapped_range` multiple times on the same buffer slice (instead of throwing a Javascript exception): By @DouglasDwyer in [#4726](https://github.com/gfx-rs/wgpu/pull/4726) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index b4e3cd0bad..737615215d 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -943,6 +943,17 @@ impl super::InstanceShared { unsafe { get_device_properties.get_physical_device_properties2(phd, &mut properties2); } + + if is_intel_igpu_outdated_for_robustness2( + capabilities.properties, + capabilities.driver, + ) { + use crate::auxil::cstr_from_bytes_until_nul; + capabilities.supported_extensions.retain(|&x| { + cstr_from_bytes_until_nul(&x.extension_name) + != Some(vk::ExtRobustness2Fn::name()) + }); + } }; capabilities }; @@ -1953,3 +1964,29 @@ fn supports_bgra8unorm_storage( && features3.contains(vk::FormatFeatureFlags2::STORAGE_WRITE_WITHOUT_FORMAT) } } + +// For https://github.com/gfx-rs/wgpu/issues/4599 +// Intel iGPUs with outdated drivers can break rendering if `VK_EXT_robustness2` is used. +// Driver version 31.0.101.2115 works, but there's probably an earlier functional version. +fn is_intel_igpu_outdated_for_robustness2( + props: vk::PhysicalDeviceProperties, + driver: Option, +) -> bool { + const DRIVER_VERSION_WORKING: u32 = (101 << 14) | 2115; // X.X.101.2115 + + let is_outdated = props.vendor_id == crate::auxil::db::intel::VENDOR + && props.device_type == vk::PhysicalDeviceType::INTEGRATED_GPU + && props.driver_version < DRIVER_VERSION_WORKING + && driver + .map(|driver| driver.driver_id == vk::DriverId::INTEL_PROPRIETARY_WINDOWS) + .unwrap_or_default(); + + if is_outdated { + log::warn!( + "Disabling robustBufferAccess2 and robustImageAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X}, less than the known good version 0x{:X} (31.0.101.2115)", + props.driver_version, + DRIVER_VERSION_WORKING + ); + } + is_outdated +}