#ifndef GAMINGCORE_VULKAN_WRAPPER_HPP #define GAMINGCORE_VULKAN_WRAPPER_HPP #include #include namespace Core::Vulkan { bool init(); void render(); void destroy(); template struct BaseWrapper { VkDevice device = VK_NULL_HANDLE; T handle = VK_NULL_HANDLE; BaseWrapper() = default; BaseWrapper(const BaseWrapper&) = delete; BaseWrapper(BaseWrapper&& o) : BaseWrapper() { swap(o); } BaseWrapper& operator=(const BaseWrapper&) = delete; BaseWrapper& operator=(BaseWrapper&& o) { swap(o); o = BaseWrapper(); } void swap(BaseWrapper& o) { Core::swap(device, o.device); Core::swap(handle, o.handle); } operator T() { return handle; } operator T*() { return &handle; } operator const T*() const { return &handle; } }; struct ImageView : public BaseWrapper { ImageView() = default; ImageView(ImageView&&) = default; ~ImageView(); }; struct Framebuffer : public BaseWrapper { Framebuffer() = default; Framebuffer(Framebuffer&&) = default; ~Framebuffer(); }; struct Semaphore : public BaseWrapper { Semaphore() = default; Semaphore(Semaphore&&) = default; ~Semaphore(); bool init(VkDevice d); }; struct Fence : public BaseWrapper { Fence() = default; Fence(Fence&&) = default; ~Fence(); bool init(VkDevice d); }; struct Swapchain : public BaseWrapper { Swapchain() = default; Swapchain(Swapchain&&) = default; ~Swapchain(); }; struct ShaderModule : public BaseWrapper { ShaderModule() = default; ShaderModule(ShaderModule&&) = default; ~ShaderModule(); bool init(VkDevice d, const char* path); }; struct PipelineLayout : public BaseWrapper { PipelineLayout() = default; PipelineLayout(PipelineLayout&&) = default; ~PipelineLayout(); bool init(VkDevice d); }; } #endif