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

wgpu-hal: Fix Mesa version check for version with suffix containing . #4959

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions wgpu-hal/src/vulkan/instance.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{
ffi::{c_void, CStr, CString},
slice,
str::FromStr,
sync::Arc,
thread,
};
Expand Down Expand Up @@ -855,11 +856,16 @@ impl crate::Instance<super::Api> for super::Instance {
{
// 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()
let mut components = s.1.split('.');
let major = components.next().and_then(|s| u8::from_str(s).ok());
let minor = components.next().and_then(|s| u8::from_str(s).ok());
if let (Some(major), Some(minor)) = (major, minor) {
(major, minor)
} else {
(0, 0)
}
}) {
if version < 21.2 {
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",
Expand Down
Loading