diff --git a/include/Nazara/Vulkan/VkDeviceObject.hpp b/include/Nazara/Vulkan/VkDeviceObject.hpp index afa6a4c55..eaa27d1ed 100644 --- a/include/Nazara/Vulkan/VkDeviceObject.hpp +++ b/include/Nazara/Vulkan/VkDeviceObject.hpp @@ -27,6 +27,8 @@ namespace Nz inline bool Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr); inline void Destroy(); + inline bool IsValid() const; + inline const DeviceHandle& GetDevice() const; inline VkResult GetLastErrorCode() const; diff --git a/include/Nazara/Vulkan/VkDeviceObject.inl b/include/Nazara/Vulkan/VkDeviceObject.inl index ab08688bd..f59102dce 100644 --- a/include/Nazara/Vulkan/VkDeviceObject.inl +++ b/include/Nazara/Vulkan/VkDeviceObject.inl @@ -56,13 +56,19 @@ namespace Nz template inline void DeviceObject::Destroy() { - if (m_handle != VK_NULL_HANDLE) + if (IsValid()) { C::DestroyHelper(m_device, m_handle, (m_allocator.pfnAllocation) ? &m_allocator : nullptr); m_handle = VK_NULL_HANDLE; } } + template + inline bool DeviceObject::IsValid() const + { + return m_handle != VK_NULL_HANDLE; + } + template inline const DeviceHandle& DeviceObject::GetDevice() const { @@ -84,3 +90,4 @@ namespace Nz } #include +#include "VkDeviceObject.hpp"