Nameless Engine
Loading...
Searching...
No Matches
ne::VulkanPipeline::InternalResources Struct Reference

#include <VulkanPipeline.h>

Public Attributes

VkPipelineLayout pPipelineLayout = nullptr
 
VkPipeline pPipeline = nullptr
 
VkDescriptorSetLayout pDescriptorSetLayout = nullptr
 
VkDescriptorPool pDescriptorPool = nullptr
 
std::array< VkDescriptorSet, FrameResourceManager::getFrameResourceCount()> vDescriptorSets
 
std::unordered_map< std::string, uint32_t, StdStringHash, std::equal_to<> > resourceBindings
 
std::unordered_map< std::string, std::unique_ptr< ShaderArrayIndexManager > > shaderArrayIndexManagers
 
bool bIsReadyForUsage = false
 

Detailed Description

Stores internal resources.

Member Data Documentation

◆ bIsReadyForUsage

bool ne::VulkanPipeline::InternalResources::bIsReadyForUsage = false

Whether resources were created or not.

◆ pDescriptorPool

VkDescriptorPool ne::VulkanPipeline::InternalResources::pDescriptorPool = nullptr

Created descriptor pool.

◆ pDescriptorSetLayout

VkDescriptorSetLayout ne::VulkanPipeline::InternalResources::pDescriptorSetLayout = nullptr

Created descriptor set layout.

◆ pPipeline

VkPipeline ne::VulkanPipeline::InternalResources::pPipeline = nullptr

Created pipeline.

◆ pPipelineLayout

VkPipelineLayout ne::VulkanPipeline::InternalResources::pPipelineLayout = nullptr

Created pipeline layout.

◆ resourceBindings

std::unordered_map<std::string, uint32_t, StdStringHash, std::equal_to<> > ne::VulkanPipeline::InternalResources::resourceBindings

Map of pairs "shader resource name" (from GLSL code) - "layout binding index".

Remarks
Binding index in the map reference descriptor sets from vDescriptorSets.
Generally used to bind/update data of some GLSL resource to a specific descriptor in a descriptor set.

◆ shaderArrayIndexManagers

std::unordered_map<std::string, std::unique_ptr<ShaderArrayIndexManager> > ne::VulkanPipeline::InternalResources::shaderArrayIndexManagers

Stores pairs of "shader resource name" - "shader array index manager".

Warning
Do not clear this map (and thus destroy index managers) when releasing internal resources to restore them later because there might be shader resources that reference indices of some index manager and if the index manager will be destroyed it will show an error that there are some active (used) indices that reference the index manager.
Remarks
Refers to shader arrays from GLSL.
Since pipeline does not care which resources are shader arrays and which are not, shader resources that reference shader arrays must create new entries in this map when no index manager for a requested shader resource is found. All descriptors for a shader array are allocated per pipeline so shader resources that reference a shader array in some pipeline can have just one index manager per shader array.

◆ vDescriptorSets

std::array<VkDescriptorSet, FrameResourceManager::getFrameResourceCount()> ne::VulkanPipeline::InternalResources::vDescriptorSets

Created descriptor set per each frame resource.

Remarks
Initial motivation for 1 set per frame resource is for shader resources with CPU write access. For example we have 1 uniform buffer with frame constant data per frame resource, so if we have 3 frame resources we have 3 buffers with frame data and each descriptor set will point to a different buffer. Just like with other CPU write shader resources when we want to update such a resource we mark it as "needs update" but we don't update it immediately because it may be currently used by the GPU and so in order to not wait for the GPU and not halt the rendering we update all shader resources with CPU access marked as "needs update" in the beginning of the draw function and we only update shader resources of the current (next) frame resource (that is no longer being used). This way we don't need to halt the rendering when we want to update some shader resource with CPU write access, thus we have 1 descriptor set per frame resource.

The documentation for this struct was generated from the following file: