How can I check the UMD driver type in Vulkan API?

update: I solved it with VkPhysicalDeviceDriverProperties in vk1.2 which support checking driver name and version in detail. But I still don’t find what the driverVersion’s value means.


I want to check which driver is currently used like mesa3d or vendor proprietary blob.

the VkPhysicalDeviceProperties part of vkspec says:

driverVersion is the vendor-specified version of the driver.

The encoding of driverVersion is implementation-defined. It may not use the same encoding as apiVersion. Applications should follow information from the vendor on extracting the version information from driverVersion.

and when I print it, it only shows a series of numbers (e.g, driverVersion = 0x5801003)

So how can I map the driverVersion to the specific driver name?

If you want driver name then there is VkPhysicalDeviceDriverProperties::driverName.

Driver version means the version of the driver, e.g. ver 1.2.3

1 Like

And the driver version might be encoded differently by different vendors. And it might even change for different GPU of the same vendor, or even different drivers for the same GPU.
For what it’s worth, this is how I identify at least a couple of versions:

std::string decodeAPIVersion( uint32_t apiVersion )
{
  return std::to_string( VK_VERSION_MAJOR( apiVersion ) ) + "." + std::to_string( VK_VERSION_MINOR( apiVersion ) ) + "." +
         std::to_string( VK_VERSION_PATCH( apiVersion ) );
}

std::string decodeDriverVersion( uint32_t driverVersion, uint32_t vendorID )
{
  switch ( vendorID )
  {
    case 0x10DE:
      return std::to_string( ( driverVersion >> 22 ) & 0x3FF ) + "." + std::to_string( ( driverVersion >> 14 ) & 0xFF ) + "." +
             std::to_string( ( driverVersion >> 6 ) & 0xFF ) + "." + std::to_string( driverVersion & 0x3F );
    case 0x8086: return std::to_string( ( driverVersion >> 14 ) & 0x3FFFF ) + "." + std::to_string( ( driverVersion & 0x3FFF ) );
    default: return decodeAPIVersion( driverVersion );
  }
}

std::string decodeVendorID( uint32_t vendorID )
{
  // below 0x10000 are the PCI vendor IDs (https://pcisig.com/membership/member-companies)
  if ( vendorID < 0x10000 )
  {
    switch ( vendorID )
    {
      case 0x1022: return "Advanced Micro Devices";
      case 0x10DE: return "NVidia Corporation";
      case 0x8086: return "Intel Corporation";
      default: return std::to_string( vendorID );
    }
  }
  else
  {
    // above 0x10000 should be vkVendorIDs
    return vk::to_string( vk::VendorId( vendorID ) );
  }
}
1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.