Skip to content

Commit

Permalink
Expose adapter driver version for DX12 backend (#5927)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaopengli89 authored and teoxoy committed Jul 11, 2024
1 parent 91448f1 commit 126f969
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions wgpu-hal/src/dx12/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use winapi::{
shared::{
dxgi, dxgi1_2, dxgiformat::DXGI_FORMAT_B8G8R8A8_UNORM, minwindef::DWORD, windef, winerror,
},
um::{d3d12 as d3d12_ty, d3d12sdklayers, winuser},
um::{d3d12 as d3d12_ty, d3d12sdklayers, winnt, winuser},
Interface,
};

impl Drop for super::Adapter {
Expand Down Expand Up @@ -130,7 +131,24 @@ impl super::Adapter {
} else {
wgt::DeviceType::DiscreteGpu
},
driver: String::new(),
driver: {
let mut i: winnt::LARGE_INTEGER = unsafe { mem::zeroed() };
if 0 == unsafe {
adapter.CheckInterfaceSupport(&dxgi::IDXGIDevice::uuidof(), &mut i)
} {
let quad_part = unsafe { *i.QuadPart() };
const MASK: i64 = 0xFFFF;
format!(
"{}.{}.{}.{}",
quad_part >> 48,
(quad_part >> 32) & MASK,
(quad_part >> 16) & MASK,
quad_part & MASK
)
} else {
String::new()
}
},
driver_info: String::new(),
};

Expand Down

0 comments on commit 126f969

Please sign in to comment.