| 91 | |
| 92 | OVR_PUBLIC_FUNCTION(ovrResult) |
| 93 | ovr_GetSessionPhysicalDeviceVk( |
| 94 | ovrSession session, |
| 95 | ovrGraphicsLuid luid, |
| 96 | VkInstance instance, |
| 97 | VkPhysicalDevice* out_physicalDevice) |
| 98 | { |
| 99 | XR_FUNCTION(session->Instance, GetVulkanGraphicsDeviceKHR); |
| 100 | |
| 101 | if (!out_physicalDevice) |
| 102 | ovrError_InvalidParameter; |
| 103 | |
| 104 | VulkanLibrary = LoadLibraryW(L"vulkan-1.dll"); |
| 105 | if (!VulkanLibrary) |
| 106 | return ovrError_InitializeVulkan; |
| 107 | |
| 108 | VK_LIBRARY_FUNCTION(VulkanLibrary, vkGetInstanceProcAddr); |
| 109 | VK_INSTANCE_FUNCTION(instance, vkGetDeviceProcAddr); |
| 110 | VK_INSTANCE_FUNCTION(instance, vkGetPhysicalDeviceProperties); |
| 111 | VK_INSTANCE_FUNCTION(instance, vkGetPhysicalDeviceQueueFamilyProperties); |
| 112 | |
| 113 | CHK_XR(GetVulkanGraphicsDeviceKHR(session->Instance, session->System, instance, &g_Binding.physicalDevice)); |
| 114 | g_Binding.instance = instance; |
| 115 | |
| 116 | VkPhysicalDeviceProperties props; |
| 117 | vkGetPhysicalDeviceProperties(g_Binding.physicalDevice, &props); |
| 118 | |
| 119 | // The extension uses the OpenXR version format instead of the Vulkan one |
| 120 | XrVersion version = XR_MAKE_VERSION( |
| 121 | VK_VERSION_MAJOR(props.apiVersion), |
| 122 | VK_VERSION_MINOR(props.apiVersion), |
| 123 | VK_VERSION_PATCH(props.apiVersion) |
| 124 | ); |
| 125 | |
| 126 | // This should always succeed, it's more of a sanity check |
| 127 | XR_FUNCTION(session->Instance, GetVulkanGraphicsRequirementsKHR); |
| 128 | XrGraphicsRequirementsVulkanKHR graphicsReq = XR_TYPE(GRAPHICS_REQUIREMENTS_VULKAN_KHR); |
| 129 | CHK_XR(GetVulkanGraphicsRequirementsKHR(session->Instance, session->System, &graphicsReq)); |
| 130 | if (version < graphicsReq.minApiVersionSupported) |
| 131 | return ovrError_IncompatibleGPU; |
| 132 | |
| 133 | *out_physicalDevice = g_Binding.physicalDevice; |
| 134 | return ovrSuccess; |
| 135 | } |
| 136 | |
| 137 | #undef ovr_SetSynchonizationQueueVk |
| 138 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_SetSynchonizationQueueVk(ovrSession session, VkQueue queue) |
nothing calls this directly
no outgoing calls
no test coverage detected