Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
DescriptorBuilder Class Reference

DescriptorBuilder uses PoolManager and DescriptorLayoutCache to manage and create descriptor sets. More...

#include <DescriptorBuilder.hpp>

Collaboration diagram for DescriptorBuilder:
Collaboration graph

Public Member Functions

 DescriptorBuilder (PoolManager &poolManager, DescriptorSetLayoutCache &cache)
 
 ~DescriptorBuilder ()
 
DescriptorBuilderbindBuffer (VkDescriptorBufferInfo &bufferInfo, VkDescriptorType type, VkShaderStageFlags stageFlags)
 Creates a descriptor set layout binding and a write descriptor set for a buffer. More...
 
DescriptorBuilderbindBuffers (const VkDescriptorBufferInfo *bufferInfos, VkDescriptorType type, VkShaderStageFlags stageFlags, uint32_t count)
 Creates a descriptor set layout binding and a write descriptor set for multiple buffers. More...
 
DescriptorBuilderbindImage (VkDescriptorImageInfo &imageInfo, VkDescriptorType type, VkShaderStageFlags stageFlags)
 Creates a descriptor set layout binding and a write descriptor set for an image. More...
 
DescriptorBuilderbindImages (const VkDescriptorImageInfo *imageInfos, VkDescriptorType type, VkShaderStageFlags stageFlags, uint32_t count)
 Binds multiple images to the descriptor set as an array. More...
 
bool build (VkDescriptorSet &set, VkDescriptorSetLayout &layout)
 Builds a descriptor set and sets a created layout to the supplied parameter. Also updates the descriptor sets. More...
 
bool build (VkDescriptorSet &set)
 Builds a descriptor set. More...
 
void setDescriptorSetLayout (const VkDescriptorSetLayoutBinding *bindings, uint32_t bindingCount, VkDescriptorSetLayout &layout)
 Sets a layout to the supplied parameter from the given bindings. More...
 
const PoolManagergetPoolManager () const
 

Private Attributes

uint32_t currentBindingM
 
std::vector< VkWriteDescriptorSet > writeSetsM
 
std::vector< VkDescriptorSetLayoutBinding > layoutBindingsM
 
std::unique_ptr< PoolManagerpPoolManagerM
 
std::unique_ptr< DescriptorSetLayoutCachepLayoutCacheM
 

Detailed Description

DescriptorBuilder uses PoolManager and DescriptorLayoutCache to manage and create descriptor sets.

Constructor & Destructor Documentation

◆ DescriptorBuilder()

DescriptorBuilder::DescriptorBuilder ( PoolManager poolManager,
DescriptorSetLayoutCache cache 
)

◆ ~DescriptorBuilder()

DescriptorBuilder::~DescriptorBuilder ( )

Member Function Documentation

◆ bindBuffer()

DescriptorBuilder & DescriptorBuilder::bindBuffer ( VkDescriptorBufferInfo &  bufferInfo,
VkDescriptorType  type,
VkShaderStageFlags  stageFlags 
)

Creates a descriptor set layout binding and a write descriptor set for a buffer.

Parameters
bufferInfostruct decribing the buffer data.
typeof descriptor
stageFlagsDescriptor stage
Returns
The builder itself.

◆ bindBuffers()

DescriptorBuilder & DescriptorBuilder::bindBuffers ( const VkDescriptorBufferInfo *  bufferInfos,
VkDescriptorType  type,
VkShaderStageFlags  stageFlags,
uint32_t  count 
)

Creates a descriptor set layout binding and a write descriptor set for multiple buffers.

Parameters
bufferInfosis a pointer to the list of buffer info structs.
typeis the type of resource.
stageFlagsis the shader stage.
countis the number of elements in the bufferInfos array.
Returns
The builder itself

◆ bindImage()

DescriptorBuilder & DescriptorBuilder::bindImage ( VkDescriptorImageInfo &  imageInfo,
VkDescriptorType  type,
VkShaderStageFlags  stageFlags 
)

Creates a descriptor set layout binding and a write descriptor set for an image.

Parameters
imageInfostruct decribing the image data.
typeof descriptor.
stageFlagsDescriptor stage.
Returns
The builder itself.

◆ bindImages()

DescriptorBuilder & DescriptorBuilder::bindImages ( const VkDescriptorImageInfo *  imageInfos,
VkDescriptorType  type,
VkShaderStageFlags  stageFlags,
uint32_t  count 
)

Binds multiple images to the descriptor set as an array.

Parameters
imageInfosis an array of image info structs.
typeof resource.
stageFlagsis the shader stage.
countis the number of images to bind. Must match what is in the imageInfos array.
Returns
the builder itself.

◆ build() [1/2]

bool DescriptorBuilder::build ( VkDescriptorSet &  set)

Builds a descriptor set.

Parameters
setset to be built
Returns
Boolean indicating operation status
Here is the call graph for this function:

◆ build() [2/2]

bool DescriptorBuilder::build ( VkDescriptorSet &  set,
VkDescriptorSetLayout &  layout 
)

Builds a descriptor set and sets a created layout to the supplied parameter. Also updates the descriptor sets.

Parameters
setto be created.
layoutto be filled.
Returns
Boolean indicating operation status.
Here is the caller graph for this function:

◆ getPoolManager()

const PoolManager & DescriptorBuilder::getPoolManager ( ) const

◆ setDescriptorSetLayout()

void DescriptorBuilder::setDescriptorSetLayout ( const VkDescriptorSetLayoutBinding *  bindings,
uint32_t  bindingCount,
VkDescriptorSetLayout &  layout 
)

Sets a layout to the supplied parameter from the given bindings.

Parameters
layoutto be set
bindingsto be used

Member Data Documentation

◆ currentBindingM

uint32_t DescriptorBuilder::currentBindingM
private

◆ layoutBindingsM

std::vector<VkDescriptorSetLayoutBinding> DescriptorBuilder::layoutBindingsM
private

◆ pLayoutCacheM

std::unique_ptr<DescriptorSetLayoutCache> DescriptorBuilder::pLayoutCacheM
private

◆ pPoolManagerM

std::unique_ptr<PoolManager> DescriptorBuilder::pPoolManagerM
private

◆ writeSetsM

std::vector<VkWriteDescriptorSet> DescriptorBuilder::writeSetsM
private

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