Skip to content

Commit

Permalink
Enable vulkan presentation on Intel Mesa >= v21.2 (gfx-rs#4110)
Browse files Browse the repository at this point in the history
Due to an issue with Mesa versions less than 21.2 presentation on Vulkan
was forced to Nvidia only. This in itself brought new issues around the
Nvidia driver specfic format modifers.

As of Mesa 21.2 the Intel vulkan issue is fixed. This commit enables
presentation on versions 21.2 and above for Intel.

References:
- NVIDIA/egl-wayland#72

Closes [gfx-rs#4101](gfx-rs#4101)
  • Loading branch information
flukejones authored and bradwerth committed Sep 19, 2023
1 parent cdcf934 commit bbb3cd9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ By @Valaphee in [#3402](https://github.com/gfx-rs/wgpu/pull/3402)

- Enhancement of [#4038], using ash's definition instead of hard-coded c_str. By @hybcloud in[#4044](https://github.com/gfx-rs/wgpu/pull/4044).

- Enable vulkan presentation on (Linux) Intel Mesa >= v21.2. By @flukejones in[#4110](https://github.com/gfx-rs/wgpu/pull/4110)

#### DX12

- DX12 doesn't support `Features::POLYGON_MODE_POINT``. By @teoxoy in [#4032](https://github.com/gfx-rs/wgpu/pull/4032).
Expand Down
23 changes: 16 additions & 7 deletions wgpu-hal/src/vulkan/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,13 +799,22 @@ impl crate::Instance<super::Api> for super::Instance {
if exposed.info.device_type == wgt::DeviceType::IntegratedGpu
&& exposed.info.vendor == db::intel::VENDOR
{
// See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688
log::warn!(
"Disabling presentation on '{}' (id {:?}) because of NV Optimus (on Linux)",
exposed.info.name,
exposed.adapter.raw
);
exposed.adapter.private_caps.can_present = false;
// Check if mesa driver and version less than 21.2
if let Some(version) = exposed.info.driver_info.split_once("Mesa ").map(|s| {
s.1.rsplit_once('.')
.map(|v| v.0.parse::<f32>().unwrap_or_default())
.unwrap_or_default()
}) {
if version < 21.2 {
// See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688
log::warn!(
"Disabling presentation on '{}' (id {:?}) due to NV Optimus and Intel Mesa < v21.2",
exposed.info.name,
exposed.adapter.raw
);
exposed.adapter.private_caps.can_present = false;
}
}
}
}
}
Expand Down

0 comments on commit bbb3cd9

Please sign in to comment.