SHADE_Y3/SHADE_Engine/src/Graphics/Pipeline/SHVkPipelineLayout.h

81 lines
3.7 KiB
C
Raw Normal View History

2022-09-08 19:11:25 +08:00
#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<SHVkLogicalDevice> 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<Handle<SHVkShaderModule>> shaderModules;
//! Push constant interface
SHPushConstantInterface pushConstantInterface;
//! Push constant ranges
std::vector<vk::PushConstantRange> vkPcRanges;
//! List of global set layouts
std::vector<Handle<SHVkDescriptorSetLayout>> 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<Handle<SHVkDescriptorSetLayout>> descriptorSetLayoutsAllocate;
//! We want to store this also because we need to allocate later
std::vector<vk::DescriptorSetLayout> vkDescriptorSetLayoutsAllocate;
//! Store for pipeline layout recreation
std::vector<vk::DescriptorSetLayout> 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<SHVkLogicalDevice> 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<Handle<SHVkShaderModule>> const& GetShaderModules (void) const noexcept;
vk::PipelineLayout GetVkPipelineLayout (void) const noexcept;
SHPushConstantInterface const& GetPushConstantInterface (void) const noexcept;
Handle<SHShaderBlockInterface> GetShaderBlockInterface (uint32_t set, uint32_t binding, vk::ShaderStageFlagBits shaderStage) const noexcept;
};
}
#endif