Vulkan/DeviceObject: Add IsValid()
Former-commit-id: 5ac734d6444206e36570f9b85d01920442913618 [formerly 677ce9e18ce84afae896bb98b0a4bbbf9eea8132] Former-commit-id: 2fc3167fba652add5a39860cbc95a7094671a6c7
This commit is contained in:
parent
f1c5f8d0b7
commit
992cd303a7
|
|
@ -27,6 +27,8 @@ namespace Nz
|
||||||
inline bool Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
inline bool Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||||
inline void Destroy();
|
inline void Destroy();
|
||||||
|
|
||||||
|
inline bool IsValid() const;
|
||||||
|
|
||||||
inline const DeviceHandle& GetDevice() const;
|
inline const DeviceHandle& GetDevice() const;
|
||||||
inline VkResult GetLastErrorCode() const;
|
inline VkResult GetLastErrorCode() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,19 @@ namespace Nz
|
||||||
template<typename C, typename VkType, typename CreateInfo>
|
template<typename C, typename VkType, typename CreateInfo>
|
||||||
inline void DeviceObject<C, VkType, CreateInfo>::Destroy()
|
inline void DeviceObject<C, VkType, CreateInfo>::Destroy()
|
||||||
{
|
{
|
||||||
if (m_handle != VK_NULL_HANDLE)
|
if (IsValid())
|
||||||
{
|
{
|
||||||
C::DestroyHelper(m_device, m_handle, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
C::DestroyHelper(m_device, m_handle, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
||||||
m_handle = VK_NULL_HANDLE;
|
m_handle = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename C, typename VkType, typename CreateInfo>
|
||||||
|
inline bool DeviceObject<C, VkType, CreateInfo>::IsValid() const
|
||||||
|
{
|
||||||
|
return m_handle != VK_NULL_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename C, typename VkType, typename CreateInfo>
|
template<typename C, typename VkType, typename CreateInfo>
|
||||||
inline const DeviceHandle& DeviceObject<C, VkType, CreateInfo>::GetDevice() const
|
inline const DeviceHandle& DeviceObject<C, VkType, CreateInfo>::GetDevice() const
|
||||||
{
|
{
|
||||||
|
|
@ -84,3 +90,4 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Vulkan/DebugOff.hpp>
|
#include <Nazara/Vulkan/DebugOff.hpp>
|
||||||
|
#include "VkDeviceObject.hpp"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue