// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - Renderer module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_VULKANRENDERER_VULKANRENDERPIPELINELAYOUT_HPP #define NAZARA_VULKANRENDERER_VULKANRENDERPIPELINELAYOUT_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Nz { class NAZARA_VULKANRENDERER_API VulkanRenderPipelineLayout : public RenderPipelineLayout { friend VulkanShaderBinding; public: VulkanRenderPipelineLayout() = default; ~VulkanRenderPipelineLayout(); ShaderBindingPtr AllocateShaderBinding(UInt32 setIndex) override; bool Create(Vk::Device& device, RenderPipelineLayoutInfo layoutInfo); inline Vk::Device* GetDevice() const; inline const Vk::PipelineLayout& GetPipelineLayout() const; private: struct DescriptorPool; DescriptorPool& AllocatePool(); ShaderBindingPtr AllocateFromPool(std::size_t poolIndex, UInt32 setIndex); void Release(ShaderBinding& binding); inline void TryToShrink(); struct DescriptorPool { using BindingStorage = std::aligned_storage_t; Bitset freeBindings; std::unique_ptr descriptorPool; std::unique_ptr storage; }; MovablePtr m_device; std::vector m_descriptorPools; std::vector m_descriptorSetLayouts; Vk::PipelineLayout m_pipelineLayout; RenderPipelineLayoutInfo m_layoutInfo; }; } #include #endif // NAZARA_VULKANRENDERER_VULKANRENDERPIPELINE_HPP