Let's say I have more physical devices supporting Vulkan (dedicated + integrated GPU, or 2 dedicated, or other possibilities). The user can choose the device to use in the options screen. I need to be able to persist his choice on disk.
What field can I use to uniquely identify a physical device across different executions?
vendorID
+deviceID
is not enough: I could have 2 identical GPUs connecteddeviceName
is not enough for the same reasondeviceLUID
is not guaranteed to be present, and may have the same problems asdeviceUUID
(below)deviceUUID
looks like the correct choice, but the spec says:While
VkPhysicalDeviceIDPropertiesKHR::deviceUUID
is specified to remain consistent across driver versions and system reboots, it is not intended to be usable as a serializable persistent identifier for a device. It may change when a device is physically added to, removed from, or moved to a different connector in a system while that system is powered down.
So... what should I use?
deviceUUID
is the best you're going to get.Think it like this. If the
deviceUUID
matches a cached copy, then you are certain that it's the same device. And if the cached ID doesn't match any existing device, then either that hardware was removed or something radical happened. Either way, you need to pop up that dialog again to let the user decide what to do.