Make Vk::Device store a reference to Vk::PhysicalDevice info
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/PhysicalDevice.hpp>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
@@ -36,7 +37,7 @@ namespace Nz
|
||||
Device(Device&&) = delete;
|
||||
inline ~Device();
|
||||
|
||||
bool Create(VkPhysicalDevice device, const VkDeviceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||
bool Create(const Vk::PhysicalDevice& deviceInfo, const VkDeviceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline void Destroy();
|
||||
|
||||
inline const std::vector<QueueFamilyInfo>& GetEnabledQueues() const;
|
||||
@@ -47,6 +48,7 @@ namespace Nz
|
||||
inline const Instance& GetInstance() const;
|
||||
inline VkResult GetLastErrorCode() const;
|
||||
inline VkPhysicalDevice GetPhysicalDevice() const;
|
||||
inline const Vk::PhysicalDevice& GetPhysicalDeviceInfo() const;
|
||||
|
||||
inline bool IsExtensionLoaded(const std::string& extensionName);
|
||||
inline bool IsLayerLoaded(const std::string& layerName);
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace Nz
|
||||
{
|
||||
inline Device::Device(Instance& instance) :
|
||||
m_instance(instance),
|
||||
m_device(VK_NULL_HANDLE),
|
||||
m_physicalDevice(VK_NULL_HANDLE)
|
||||
m_physicalDevice(nullptr),
|
||||
m_device(VK_NULL_HANDLE)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Nz
|
||||
vkDestroyDevice(m_device, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
||||
|
||||
m_device = VK_NULL_HANDLE;
|
||||
m_physicalDevice = VK_NULL_HANDLE;
|
||||
m_physicalDevice = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,12 @@ namespace Nz
|
||||
|
||||
inline VkPhysicalDevice Device::GetPhysicalDevice() const
|
||||
{
|
||||
return m_physicalDevice;
|
||||
return m_physicalDevice->device;
|
||||
}
|
||||
|
||||
inline const Vk::PhysicalDevice& Device::GetPhysicalDeviceInfo() const
|
||||
{
|
||||
return *m_physicalDevice;
|
||||
}
|
||||
|
||||
inline bool Device::IsExtensionLoaded(const std::string& extensionName)
|
||||
|
||||
Reference in New Issue
Block a user