From 90826e44679b0695683418ec57b2e9d003925509 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 13 Jul 2016 12:23:35 +0200 Subject: [PATCH] Vulkan: Add GetPhysicalDeviceInfo Former-commit-id: 613eaa539d90c2480b0c20e09561a45df01e8b9e [formerly 5302439064226b00d49fa8bf2680980eaf806e7a] Former-commit-id: 62e30089bf6d93d893e86dda3d6fcd89e6a2688b --- include/Nazara/Vulkan/Vulkan.hpp | 1 + src/Nazara/Vulkan/Vulkan.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/Nazara/Vulkan/Vulkan.hpp b/include/Nazara/Vulkan/Vulkan.hpp index 289a1b225..a024d271a 100644 --- a/include/Nazara/Vulkan/Vulkan.hpp +++ b/include/Nazara/Vulkan/Vulkan.hpp @@ -31,6 +31,7 @@ namespace Nz static Vk::Instance& GetInstance(); static const std::vector& GetPhysicalDevices(); + static const Vk::PhysicalDevice& GetPhysicalDeviceInfo(VkPhysicalDevice physDevice); static bool Initialize(); diff --git a/src/Nazara/Vulkan/Vulkan.cpp b/src/Nazara/Vulkan/Vulkan.cpp index 025e9e875..6af41d9b2 100644 --- a/src/Nazara/Vulkan/Vulkan.cpp +++ b/src/Nazara/Vulkan/Vulkan.cpp @@ -24,6 +24,21 @@ namespace Nz return s_physDevices; } + const Vk::PhysicalDevice& Vulkan::GetPhysicalDeviceInfo(VkPhysicalDevice physDevice) + { + for (const Vk::PhysicalDevice& info : s_physDevices) + { + if (info.device == physDevice) + return info; + } + + // This cannot happen if physDevice is valid, as we retrieved every physical device + NazaraInternalError("Invalid physical device: " + String::Pointer(physDevice)); + + static Vk::PhysicalDevice dummy; + return dummy; + } + bool Vulkan::Initialize() { if (s_moduleReferenceCounter > 0)