aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--video/out/vulkan/utils.c22
-rw-r--r--video/out/vulkan/utils.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/video/out/vulkan/utils.c b/video/out/vulkan/utils.c
index 4413fe70b1..1ad55d1275 100644
--- a/video/out/vulkan/utils.c
+++ b/video/out/vulkan/utils.c
@@ -192,6 +192,7 @@ bool mpvk_instance_init(struct mpvk_ctx *vk, struct mp_log *log,
// Enable whatever extensions were compiled in.
const char *extensions[] = {
+ VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
VK_KHR_SURFACE_EXTENSION_NAME,
surf_ext_name,
@@ -328,6 +329,27 @@ error:
return false;
}
+bool mpvk_get_phys_device_uuid(struct mpvk_ctx *vk, uint8_t uuid_out[VK_UUID_SIZE])
+{
+ assert(vk->physd);
+
+ VkPhysicalDeviceIDProperties idprops = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
+ };
+
+ VkPhysicalDeviceProperties2 props = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
+ .pNext = &idprops,
+ };
+
+ VK_LOAD_PFN(vkGetPhysicalDeviceProperties2KHR);
+ pfn_vkGetPhysicalDeviceProperties2KHR(vk->physd, &props);
+
+ memcpy(uuid_out, idprops.deviceUUID, VK_UUID_SIZE);
+
+ return true;
+}
+
bool mpvk_pick_surface_format(struct mpvk_ctx *vk)
{
assert(vk->physd);
diff --git a/video/out/vulkan/utils.h b/video/out/vulkan/utils.h
index 97d1c24489..9af59e4b50 100644
--- a/video/out/vulkan/utils.h
+++ b/video/out/vulkan/utils.h
@@ -56,6 +56,9 @@ bool mpvk_surface_init(struct vo *vo, struct mpvk_ctx *vk);
// sw: also allow software/virtual devices
bool mpvk_find_phys_device(struct mpvk_ctx *vk, const char *name, bool sw);
+// Get the UUID for the selected physical device
+bool mpvk_get_phys_device_uuid(struct mpvk_ctx *vk, uint8_t uuid_out[VK_UUID_SIZE]);
+
// Pick a suitable surface format that's supported by this physical device.
bool mpvk_pick_surface_format(struct mpvk_ctx *vk);