VkCV Framework  0.0.1
CV Vulkan framework
vkcv::ShaderProgram Class Reference

Public Member Functions

bool addShader (ShaderStage shaderStage, const std::filesystem::path &shaderPath)
 
const ShadergetShader (ShaderStage shaderStage) const
 
bool existsShader (ShaderStage shaderStage) const
 
const std::vector< VertexAttachment > & getVertexAttachments () const
 
size_t getPushConstantSize () const
 
const std::unordered_map< uint32_t, std::unordered_map< uint32_t, DescriptorBinding > > & getReflectedDescriptors () const
 

Private Member Functions

void reflectShader (ShaderStage shaderStage)
 

Private Attributes

std::unordered_map< ShaderStage, Shaderm_Shaders
 
std::vector< VertexAttachmentm_VertexAttachments
 
std::unordered_map< uint32_t, std::unordered_map< uint32_t, DescriptorBinding > > m_DescriptorSets
 
size_t m_pushConstantSize = 0
 

Detailed Description

Member Function Documentation

◆ addShader()

bool vkcv::ShaderProgram::addShader ( ShaderStage  shaderStage,
const std::filesystem::path &  shaderPath 
)

Adds a shader into the shader program. The shader is only added if the shader program does not contain the particular shader stage already. Contains: (1) reading of the code, (2) creation of a shader module, (3) creation of a shader stage, (4) adding to the shader stage list, (5) destroying of the shader module

Parameters
[in]flagthat signals the respective shaderStage (e.g. VK_SHADER_STAGE_VERTEX_BIT)
[in]relativepath to the shader code (e.g. "../../../../../shaders/vert.spv")

◆ getReflectedDescriptors()

const std::unordered_map< uint32_t, DescriptorBindings > & vkcv::ShaderProgram::getReflectedDescriptors ( ) const

Returns the reflected descriptor sets/layouts/bindings in a map of maps. First uint32_t serves as descriptor SET id. Second uint32_t serves as the descriptor set's BINDING id.

Returns

◆ getShader()

const Shader & vkcv::ShaderProgram::getShader ( ShaderStage  shaderStage) const

Returns the shader program's shader of the specified shader. Needed for the transfer to the pipeline.

Returns
Shader object consisting of buffer with shader code and shader stage enum

◆ reflectShader()

void vkcv::ShaderProgram::reflectShader ( ShaderStage  shaderStage)
private

Called after successfully adding a shader to the program. Fills vertex input attachments and descriptor sets (if present).

Parameters
shaderStagethe stage to reflect data from

The documentation for this class was generated from the following files: