Vulkan: Use a generic class helper for all device objects

This greatly reduce the amount of code required for wrappers around
Vulkan Objects


Former-commit-id: 885d0b39197ba41fd856c45571dbf06d8ae27d8c
This commit is contained in:
Lynix
2016-05-14 14:46:15 +02:00
parent ef66c09719
commit a8fa5e1d12
6 changed files with 133 additions and 112 deletions

View File

@@ -9,40 +9,24 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Vulkan/Config.hpp>
#include <Nazara/Vulkan/VkLoader.hpp>
#include <vulkan/vulkan.h>
#include <Nazara/Vulkan/VkDeviceObject.hpp>
namespace Nz
{
namespace Vk
{
class Device;
class NAZARA_VULKAN_API Swapchain
class Swapchain : public DeviceObject<Swapchain, VkSwapchainKHR, VkSwapchainCreateInfoKHR>
{
public:
inline Swapchain(Device& instance);
Swapchain(const Swapchain&) = delete;
Swapchain(Swapchain&&) = delete;
inline ~Swapchain();
bool Create(const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr);
inline void Destroy();
~Swapchain() = default;
inline bool IsSupported() const;
inline VkResult GetLastErrorCode() const;
Swapchain& operator=(const Swapchain&) = delete;
Swapchain& operator=(Swapchain&&) = delete;
inline operator VkSwapchainKHR();
private:
Device& m_device;
VkAllocationCallbacks m_allocator;
VkSwapchainKHR m_swapchain;
VkResult m_lastErrorCode;
};
}
}