OpenXRVkPhysicalDevice.cpp 1.1 KB

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <OpenXRVk/OpenXRVkPhysicalDevice.h>
  9. #include <OpenXRVk/OpenXRVkUtils.h>
  10. namespace OpenXRVk::PhysicalDevice
  11. {
  12. AZStd::vector<VkPhysicalDevice> EnumerateDeviceList(XrSystemId xrSystemId, XrInstance xrInstance, VkInstance vkInstance)
  13. {
  14. PFN_xrGetVulkanGraphicsDeviceKHR pfnGetVulkanGraphicsDeviceKHR = nullptr;
  15. XrResult result = xrGetInstanceProcAddr(
  16. xrInstance, "xrGetVulkanGraphicsDeviceKHR", reinterpret_cast<PFN_xrVoidFunction*>(&pfnGetVulkanGraphicsDeviceKHR));
  17. ASSERT_IF_UNSUCCESSFUL(result);
  18. //TODO::Look into api that can retreive multiple physical devices if connected
  19. VkPhysicalDevice vkPhysicalDevice = VK_NULL_HANDLE;
  20. result = pfnGetVulkanGraphicsDeviceKHR(xrInstance, xrSystemId, vkInstance, &vkPhysicalDevice);
  21. ASSERT_IF_UNSUCCESSFUL(result);
  22. return {vkPhysicalDevice};
  23. }
  24. }