/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* DescriptorSet.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/01/23 18:39:36 by maldavid #+# #+# */ /* Updated: 2024/04/23 22:14:48 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __VK_DESCRIPTOR_SET__ #define __VK_DESCRIPTOR_SET__ #include #include namespace mlx { class DescriptorSet { public: DescriptorSet() = default; void Init(NonOwningPtr renderer, NonOwningPtr pool, DescriptorSetLayout layout); void WriteDescriptor(int binding, NonOwningPtr ubo) const noexcept; void WriteDescriptor(int binding, const class Image& image) const noexcept; inline bool IsInit() const noexcept { return m_pool != nullptr && m_renderer != nullptr; } void Bind() noexcept; DescriptorSet Duplicate(); VkDescriptorSet& operator()() noexcept; VkDescriptorSet& Get() noexcept; inline const DescriptorSetLayout& GetLayout() const noexcept { return m_layout; } inline const std::array& GetAllFramesDescriptorSets() const { return m_desc_set; } void Destroy() noexcept; ~DescriptorSet() = default; private: DescriptorSetLayout m_layout; std::array m_desc_set; NonOwningPtr p_pool; NonOwningPtr p_renderer; }; } #endif