Correct driver version disassembly

This commit is contained in:
hodasemi 2023-03-24 14:33:29 +01:00
parent 1976af0166
commit a18eb38c70
2 changed files with 19 additions and 1 deletions

View file

@ -128,7 +128,7 @@ impl PhysicalDevice {
println!(
"\nVulkan Device ({}, Driver: {}, {}.{}.{})",
properties.device_name(),
properties.driverVersion,
properties.driver_version(),
major,
minor,
patch

View file

@ -23,6 +23,24 @@ impl VkPhysicalDeviceProperties {
let device_name_cstr = unsafe { CStr::from_ptr(self.deviceName.as_ptr()) };
device_name_cstr.to_str().unwrap().to_string()
}
pub fn driver_version(&self) -> String {
if self.vendorID == 4318 {
let major = (self.driverVersion >> 22) & 0x3ff;
let minor = (self.driverVersion >> 14) & 0x0ff;
let secondary_branch = (self.driverVersion >> 6) & 0x0ff;
let tertiary_branch = self.driverVersion & 0x003f;
format!(
"{}.{}.{}.{}",
major, minor, secondary_branch, tertiary_branch
)
} else {
let (major, minor, patch) = VK_GET_VERSION(self.driverVersion);
format!("{}.{}.{}", major, minor, patch)
}
}
}
impl Default for VkPhysicalDeviceProperties {