Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use VK_EXT_robustness2 only when not using an outdated intel iGPU driver #4602

Merged
merged 11 commits into from
Dec 7, 2023
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,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).

#### WGL

- Create a hidden window per `wgpu::Instance` instead of sharing a global one.
Expand Down
48 changes: 48 additions & 0 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
TheoDulka marked this conversation as resolved.
Show resolved Hide resolved
capabilities
.supported_extensions
.iter()
.position(|&x| {
cstr_from_bytes_until_nul(&x.extension_name)
== Some(vk::ExtRobustness2Fn::name())
})
.unwrap(),
);
}
};
capabilities
};
Expand Down Expand Up @@ -1802,3 +1819,34 @@ 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<vk::PhysicalDeviceDriverPropertiesKHR>,
) -> 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;
TheoDulka marked this conversation as resolved.
Show resolved Hide resolved

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";
TheoDulka marked this conversation as resolved.
Show resolved Hide resolved

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
}
Loading