#ifndef SH_VK_PIPELINE_LAYOUT_H #define SH_VK_PIPELINE_LAYOUT_H #include "SHPipelineLayoutParams.h" #include "SHPushConstantInterface.h" namespace SHADE { class SHVkLogicalDevice; class SHVkPipelineLayout { private: /*-----------------------------------------------------------------------*/ /* PRIVATE MEMBER VARIABLES */ /*-----------------------------------------------------------------------*/ //! Logical device used for creation and destruction. Handle logicalDeviceHdl; //! The Vulkan handle to a pipeline layout vk::PipelineLayout vkPipelineLayout; //! Shader modules used by the pipeline. Note that these modules themselves //! are not used in pipeline layout creation. We mainly have it here so that //! pipelines can simply take in this class and the shader modules would //! be included. std::vector> shaderModules; //! Push constant interface SHPushConstantInterface pushConstantInterface; //! Push constant ranges std::vector vkPcRanges; //! List of global set layouts std::vector> descriptorSetLayoutsGlobal; //! List of set layouts to allocate descriptor sets for. Set indices here should //! also be smaller than the global ones passed in. std::vector> descriptorSetLayoutsAllocate; //! We want to store this also because we need to allocate later std::vector vkDescriptorSetLayoutsAllocate; //! Store for pipeline layout recreation std::vector vkDescriptorSetLayoutsPipeline; /*-----------------------------------------------------------------------*/ /* PRIVATE MEMBER FUNCTIONS */ /*-----------------------------------------------------------------------*/ void PreparePushConstantInterface (void) noexcept; void PrepareDescriptorLayout (void) noexcept; void PrepareVkDescriptorSetLayouts(void) noexcept; void Destroy (void) noexcept; public: /*-----------------------------------------------------------------------*/ /* CTORS AND DTORS */ /*-----------------------------------------------------------------------*/ SHVkPipelineLayout (Handle const& inLogicalDeviceHdl, SHPipelineLayoutParams& pipelineLayoutParams) noexcept; SHVkPipelineLayout (SHVkPipelineLayout&& rhs) noexcept; ~SHVkPipelineLayout (void) noexcept; SHVkPipelineLayout& operator= (SHVkPipelineLayout&& rhs) noexcept; /*-----------------------------------------------------------------------*/ /* PUBLIC MEMBER FUNCTIONS */ /*-----------------------------------------------------------------------*/ void RecreateIfNeeded (void) noexcept; /*-----------------------------------------------------------------------*/ /* SETTERS AND GETTERS */ /*-----------------------------------------------------------------------*/ std::vector> const& GetShaderModules (void) const noexcept; vk::PipelineLayout GetVkPipelineLayout (void) const noexcept; SHPushConstantInterface const& GetPushConstantInterface (void) const noexcept; Handle GetShaderBlockInterface (uint32_t set, uint32_t binding, vk::ShaderStageFlagBits shaderStage) const noexcept; }; } #endif