From 2769528e12d02e61b6da2b2ab9a7046838e7682a Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sat, 28 Oct 2023 00:16:39 -0500 Subject: [PATCH 1/9] Push `VK_EXT_robustness2` to extensions when not using an outdated intel iGPU driver --- wgpu-hal/src/vulkan/adapter.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index fd62473fd7..156453eb1f 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -669,8 +669,21 @@ impl PhysicalDeviceCapabilities { } // Optional `VK_EXT_robustness2` + // Intel iGPUs with outdated drivers can break rendering if `VK_EXT_robustness2` is pushed. + // Driver version 31.0.101.2115 works, but there's probably an earlier functional version. if self.supports_extension(vk::ExtRobustness2Fn::name()) { - extensions.push(vk::ExtRobustness2Fn::name()); + const DRIVER_VERSION_INTEL_31_0_101: u32 = 0x194000; + const DRIVER_VERSION_INTEL_WORKING: u32 = DRIVER_VERSION_INTEL_31_0_101 + 2115; + + let props = self.properties; + let is_intel_igpu_outdated = props.vendor_id + == crate::auxil::db::intel::VENDOR + && props.device_type == vk::PhysicalDeviceType::INTEGRATED_GPU + && props.driver_version < DRIVER_VERSION_INTEL_WORKING; + + if !is_intel_igpu_outdated { + extensions.push(vk::ExtRobustness2Fn::name()); + } } // Require `VK_KHR_draw_indirect_count` if the associated feature was requested From 7dbd10be407f442c3699a765431161512d94776e Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sat, 28 Oct 2023 00:44:03 -0500 Subject: [PATCH 2/9] Add to changelog --- CHANGELOG.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 725f72b991..c4a0111f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,11 @@ Bottom level categories: ## Unreleased +### Bug Fixes + +#### Vulkan +- Push `VK_EXT_robustness2` to extensions only when not using an outdated intel iGPU driver. By @TheoDulka in [#4602](https://github.com/gfx-rs/wgpu/pull/4602). + For naga changelogs at or before v0.14.0. See [naga's changelog](naga/CHANGELOG.md). ## v0.18.0 (2023-10-25) @@ -57,7 +62,7 @@ By @Zoxc in [#4248](https://github.com/gfx-rs/wgpu/pull/4248) Timestamp queries are now supported on both Metal and Desktop OpenGL. On Apple chips on Metal, they only support timestamp queries in command buffers or in the renderpass descriptor, they do not support them inside a pass. -Metal: By @Wumpf in [#4008](https://github.com/gfx-rs/wgpu/pull/4008) +Metal: By @Wumpf in [#4008](https://github.com/gfx-rs/wgpu/pull/4008) OpenGL: By @Zoxc in [#4267](https://github.com/gfx-rs/wgpu/pull/4267) ### Render/Compute Pass Query Writes @@ -180,7 +185,7 @@ let instance = wgpu::Instance::new(InstanceDescriptor { }); ``` -`gles_minor_version`: By @PJB3005 in [#3998](https://github.com/gfx-rs/wgpu/pull/3998) +`gles_minor_version`: By @PJB3005 in [#3998](https://github.com/gfx-rs/wgpu/pull/3998) `flags`: By @nical in [#4230](https://github.com/gfx-rs/wgpu/pull/4230) ### Many New Examples! @@ -226,7 +231,7 @@ By @teoxoy in [#4185](https://github.com/gfx-rs/wgpu/pull/4185) - Add trace-level logging for most entry points in wgpu-core By @nical in [4183](https://github.com/gfx-rs/wgpu/pull/4183) - Add `Rgb10a2Uint` format. By @teoxoy in [4199](https://github.com/gfx-rs/wgpu/pull/4199) - Validate that resources are used on the right device. By @nical in [4207](https://github.com/gfx-rs/wgpu/pull/4207) -- Expose instance flags. +- Expose instance flags. - Add support for the bgra8unorm-storage feature. By @jinleili and @nical in [#4228](https://github.com/gfx-rs/wgpu/pull/4228) - Calls to lost devices now return `DeviceError::Lost` instead of `DeviceError::Invalid`. By @bradwerth in [#4238]([https://github.com/gfx-rs/wgpu/pull/4238]) - Let the `"strict_asserts"` feature enable check that wgpu-core's lock-ordering tokens are unique per thread. By @jimblandy in [#4258]([https://github.com/gfx-rs/wgpu/pull/4258]) From 08dbdb045b7948b4a40cd488fa5ea7865433165f Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sat, 28 Oct 2023 00:48:30 -0500 Subject: [PATCH 3/9] fmt --- wgpu-hal/src/vulkan/adapter.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 156453eb1f..132aa5c96c 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -676,8 +676,7 @@ impl PhysicalDeviceCapabilities { const DRIVER_VERSION_INTEL_WORKING: u32 = DRIVER_VERSION_INTEL_31_0_101 + 2115; let props = self.properties; - let is_intel_igpu_outdated = props.vendor_id - == crate::auxil::db::intel::VENDOR + let is_intel_igpu_outdated = props.vendor_id == crate::auxil::db::intel::VENDOR && props.device_type == vk::PhysicalDeviceType::INTEGRATED_GPU && props.driver_version < DRIVER_VERSION_INTEL_WORKING; From 800be895bdc3172f698958d288fd20e9d4c34fba Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sat, 28 Oct 2023 12:28:13 -0500 Subject: [PATCH 4/9] Added logging for notifying when the intel igpu is outdated, added issue for context in comment --- wgpu-hal/src/vulkan/adapter.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 132aa5c96c..b127f44e75 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -671,6 +671,7 @@ impl PhysicalDeviceCapabilities { // Optional `VK_EXT_robustness2` // Intel iGPUs with outdated drivers can break rendering if `VK_EXT_robustness2` is pushed. // Driver version 31.0.101.2115 works, but there's probably an earlier functional version. + // context: https://github.com/gfx-rs/wgpu/issues/4599 if self.supports_extension(vk::ExtRobustness2Fn::name()) { const DRIVER_VERSION_INTEL_31_0_101: u32 = 0x194000; const DRIVER_VERSION_INTEL_WORKING: u32 = DRIVER_VERSION_INTEL_31_0_101 + 2115; @@ -680,7 +681,9 @@ impl PhysicalDeviceCapabilities { && props.device_type == vk::PhysicalDeviceType::INTEGRATED_GPU && props.driver_version < DRIVER_VERSION_INTEL_WORKING; - if !is_intel_igpu_outdated { + if is_intel_igpu_outdated { + log::trace!("Disabling robustBufferAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X} less than 0x{:X}, the known good driver (31.0.101.2115)", props.driver_version, DRIVER_VERSION_INTEL_WORKING); + } else { extensions.push(vk::ExtRobustness2Fn::name()); } } From c0b01b332950f88d9932e508248d6baf3cb5a5ef Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sun, 29 Oct 2023 17:32:27 -0500 Subject: [PATCH 5/9] Moved to a function --- wgpu-hal/src/vulkan/adapter.rs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index b127f44e75..c23a600cb1 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -669,21 +669,8 @@ impl PhysicalDeviceCapabilities { } // Optional `VK_EXT_robustness2` - // Intel iGPUs with outdated drivers can break rendering if `VK_EXT_robustness2` is pushed. - // Driver version 31.0.101.2115 works, but there's probably an earlier functional version. - // context: https://github.com/gfx-rs/wgpu/issues/4599 if self.supports_extension(vk::ExtRobustness2Fn::name()) { - const DRIVER_VERSION_INTEL_31_0_101: u32 = 0x194000; - const DRIVER_VERSION_INTEL_WORKING: u32 = DRIVER_VERSION_INTEL_31_0_101 + 2115; - - let props = self.properties; - let is_intel_igpu_outdated = props.vendor_id == crate::auxil::db::intel::VENDOR - && props.device_type == vk::PhysicalDeviceType::INTEGRATED_GPU - && props.driver_version < DRIVER_VERSION_INTEL_WORKING; - - if is_intel_igpu_outdated { - log::trace!("Disabling robustBufferAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X} less than 0x{:X}, the known good driver (31.0.101.2115)", props.driver_version, DRIVER_VERSION_INTEL_WORKING); - } else { + if !is_intel_igpu_outdated_for_robustness2(self.properties) { extensions.push(vk::ExtRobustness2Fn::name()); } } @@ -1793,3 +1780,20 @@ 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) -> bool { + const DRIVER_VERSION_31_0_101: u32 = 0x194000; + const DRIVER_VERSION_WORKING: u32 = DRIVER_VERSION_31_0_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; + + if is_outdated { + log::trace!("Disabling robustBufferAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X} less than 0x{:X}, the known good driver (31.0.101.2115)", props.driver_version, DRIVER_VERSION_WORKING); + } + is_outdated +} From 23d2d21c9ec9d80bc054d454ee31de802bdb4912 Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sun, 29 Oct 2023 17:48:58 -0500 Subject: [PATCH 6/9] Now disabling the feature PhysicalDeviceRobustness2FeaturesEXT rather than removing the extension. Also added another check for intel driver and not mesa --- wgpu-hal/src/vulkan/adapter.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index c23a600cb1..5bf3b69998 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -670,9 +670,7 @@ impl PhysicalDeviceCapabilities { // Optional `VK_EXT_robustness2` if self.supports_extension(vk::ExtRobustness2Fn::name()) { - if !is_intel_igpu_outdated_for_robustness2(self.properties) { - extensions.push(vk::ExtRobustness2Fn::name()); - } + extensions.push(vk::ExtRobustness2Fn::name()); } // Require `VK_KHR_draw_indirect_count` if the associated feature was requested @@ -871,7 +869,9 @@ impl super::InstanceShared { .insert(vk::PhysicalDeviceImageRobustnessFeaturesEXT::default()); builder = builder.push_next(next); } - if capabilities.supports_extension(vk::ExtRobustness2Fn::name()) { + if !is_intel_igpu_outdated_for_robustness2(capabilities.properties, capabilities.driver) + && capabilities.supports_extension(vk::ExtRobustness2Fn::name()) + { let next = features .robustness2 .insert(vk::PhysicalDeviceRobustness2FeaturesEXT::default()); @@ -1784,16 +1784,26 @@ fn supports_bgra8unorm_storage( // 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) -> bool { +fn is_intel_igpu_outdated_for_robustness2( + props: vk::PhysicalDeviceProperties, + driver: Option, +) -> bool { + use crate::auxil::cstr_from_bytes_until_nul; + const DRIVER_VERSION_31_0_101: u32 = 0x194000; const DRIVER_VERSION_WORKING: u32 = DRIVER_VERSION_31_0_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; + && props.driver_version < DRIVER_VERSION_WORKING + && cstr_from_bytes_until_nul(&driver.unwrap_or_default().driver_info) + .unwrap_or_default() + .to_str() + .unwrap_or_default() + == "Intel driver"; if is_outdated { - log::trace!("Disabling robustBufferAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X} less than 0x{:X}, the known good driver (31.0.101.2115)", props.driver_version, DRIVER_VERSION_WORKING); + log::trace!("Disabling robustBufferAccess2 and robustImageAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X} less than 0x{:X}, the known good driver (31.0.101.2115)", props.driver_version, DRIVER_VERSION_WORKING); } is_outdated } From c6b4e5277eac8d5b11753509726ebbf6544b425a Mon Sep 17 00:00:00 2001 From: TheoDulka Date: Sun, 29 Oct 2023 17:55:30 -0500 Subject: [PATCH 7/9] Changelog update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4a0111f09..8bc9e8aa3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ Bottom level categories: ### Bug Fixes #### Vulkan -- Push `VK_EXT_robustness2` to extensions only when not using an outdated intel iGPU driver. By @TheoDulka in [#4602](https://github.com/gfx-rs/wgpu/pull/4602). +- 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). For naga changelogs at or before v0.14.0. See [naga's changelog](naga/CHANGELOG.md). From cb742744ae5cfc8b43e20be53adad6a59a866f14 Mon Sep 17 00:00:00 2001 From: Theo Dulka Date: Sat, 25 Nov 2023 17:37:12 -0600 Subject: [PATCH 8/9] Moved the check into the intitialization of capabilities Removing the ExtRobustness2 from the supported_extensions --- wgpu-hal/src/vulkan/adapter.rs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 26c2ea7fb9..eb5c4bdba8 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -825,6 +825,23 @@ 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.remove( + capabilities + .supported_extensions + .iter() + .position(|&x| { + cstr_from_bytes_until_nul(&x.extension_name) + == Some(vk::ExtRobustness2Fn::name()) + }) + .unwrap(), + ); + } }; capabilities }; @@ -874,9 +891,7 @@ impl super::InstanceShared { .insert(vk::PhysicalDeviceImageRobustnessFeaturesEXT::default()); builder = builder.push_next(next); } - if !is_intel_igpu_outdated_for_robustness2(capabilities.properties, capabilities.driver) - && capabilities.supports_extension(vk::ExtRobustness2Fn::name()) - { + if capabilities.supports_extension(vk::ExtRobustness2Fn::name()) { let next = features .robustness2 .insert(vk::PhysicalDeviceRobustness2FeaturesEXT::default()); @@ -1827,7 +1842,11 @@ fn is_intel_igpu_outdated_for_robustness2( == "Intel driver"; if is_outdated { - log::trace!("Disabling robustBufferAccess2 and robustImageAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X} less than 0x{:X}, the known good driver (31.0.101.2115)", props.driver_version, DRIVER_VERSION_WORKING); + 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 } From 5fde874860de2ed81de6feb7f767fb0fbf30e8f2 Mon Sep 17 00:00:00 2001 From: Theo Dulka Date: Thu, 7 Dec 2023 11:57:24 -0600 Subject: [PATCH 9/9] Apply teo's requests --- wgpu-hal/src/vulkan/adapter.rs | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index eb5c4bdba8..f1068c68ec 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -831,16 +831,10 @@ impl super::InstanceShared { capabilities.driver, ) { use crate::auxil::cstr_from_bytes_until_nul; - capabilities.supported_extensions.remove( - capabilities - .supported_extensions - .iter() - .position(|&x| { - cstr_from_bytes_until_nul(&x.extension_name) - == Some(vk::ExtRobustness2Fn::name()) - }) - .unwrap(), - ); + capabilities.supported_extensions.retain(|&x| { + cstr_from_bytes_until_nul(&x.extension_name) + != Some(vk::ExtRobustness2Fn::name()) + }); } }; capabilities @@ -1827,19 +1821,14 @@ fn is_intel_igpu_outdated_for_robustness2( props: vk::PhysicalDeviceProperties, driver: Option, ) -> bool { - use crate::auxil::cstr_from_bytes_until_nul; - - const DRIVER_VERSION_31_0_101: u32 = 0x194000; - const DRIVER_VERSION_WORKING: u32 = DRIVER_VERSION_31_0_101 + 2115; + 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 - && cstr_from_bytes_until_nul(&driver.unwrap_or_default().driver_info) - .unwrap_or_default() - .to_str() - .unwrap_or_default() - == "Intel driver"; + && driver + .map(|driver| driver.driver_id == vk::DriverId::INTEL_PROPRIETARY_WINDOWS) + .unwrap_or_default(); if is_outdated { log::warn!(