// Copyright 2022 Simon Boyé #pragma once #include #include #include namespace vk { class DescriptorSet: public Wrapper { public: DescriptorSet() noexcept; DescriptorSet( Context& context, VkDescriptorPool descriptor_pool, const VkDescriptorSetLayout& set_layout ); DescriptorSet(const DescriptorSet&) = delete; DescriptorSet(DescriptorSet&& other) noexcept; ~DescriptorSet() noexcept; DescriptorSet& operator=(const DescriptorSet&) = delete; DescriptorSet& operator=(DescriptorSet&& other) noexcept; explicit inline operator bool() const noexcept { return !is_null(); } inline bool is_null() const noexcept { return m_descriptor_set == VK_NULL_HANDLE; } inline const Context* context() const noexcept { return m_context; } inline Context* context() noexcept { return m_context; } inline const VkDescriptorPool descriptor_pool() const noexcept { return m_descriptor_pool; } inline VkDescriptorPool descriptor_pool() noexcept { return m_descriptor_pool; } inline operator VkDescriptorSet() noexcept { return m_descriptor_set; } inline VkDescriptorSet descriptor_set() noexcept { return m_descriptor_set; } inline void swap(DescriptorSet& other) noexcept { using std::swap; swap(m_context, other.m_context); swap(m_descriptor_pool, other.m_descriptor_pool); swap(m_descriptor_set, other.m_descriptor_set); } friend inline void swap(DescriptorSet& descriptor_set_0, DescriptorSet& descriptor_set_1) noexcept { descriptor_set_0.swap(descriptor_set_1); } void destroy() noexcept; private: VkDescriptorPool m_descriptor_pool = VK_NULL_HANDLE; VkDescriptorSet m_descriptor_set = VK_NULL_HANDLE; }; }