Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
foray::util::PipelineLayout Class Reference

Class that holds memory ownership of a vulkan pipeline layout. More...

#include <foray_pipelinelayout.hpp>

Inheritance diagram for foray::util::PipelineLayout:
foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_PIPELINE_LAYOUT > foray::core::ManagedResource foray::NoMoveDefaults

Public Member Functions

 PipelineLayout ()=default
 
virtual bool Exists () const
 Return true, if the managed resource is allocated.
 
virtual void Destroy ()
 Destroy the resource.
 
 ~PipelineLayout ()
 
void AddDescriptorSetLayout (VkDescriptorSetLayout layout)
 Add a descriptorset layout to the pipeline layout prior to building.
 
void AddDescriptorSetLayouts (const std::vector< VkDescriptorSetLayout > &layouts)
 Add descriptorset layouts to the pipeline layout prior to building.
 
void AddPushConstantRange (VkPushConstantRange range)
 Add a push constant range to the pipeline layout prior to building.
 
void AddPushConstantRanges (const std::vector< VkPushConstantRange > &ranges)
 Add push constant ranges to the pipeline layout prior to building.
 
template<typename TPushC >
void AddPushConstantRange (VkShaderStageFlags stageFlags, uint32_t offset=PUSHC_OFFSET_AUTO)
 Add push constant ranges to the pipeline layout prior to building.
 
VkPipelineLayout Build (core::Context *context, VkPipelineLayoutCreateFlags flags=0, void *pNext=nullptr)
 Builds the pipelinelayout based on previously added descriptorset layouts and push constant ranges.
 
VkPipelineLayout Build (core::Context *context, const std::vector< VkDescriptorSetLayout > &descriptorLayouts, const std::vector< VkPushConstantRange > &pushConstantRanges, VkPipelineLayoutCreateFlags flags=0, void *pNext=nullptr)
 Builds the pipelinelayout based on previously added descriptorset layouts and push constant ranges (aswell as parameters)
 
 operator VkPipelineLayout () const
 
- Public Member Functions inherited from foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_PIPELINE_LAYOUT >
 VulkanResource ()
 
 VulkanResource (std::string_view name)
 
virtual std::string_view GetTypeName () const
 Returns <OBJECT_TYPE> stringified.
 
- Public Member Functions inherited from foray::core::ManagedResource
 ManagedResource ()
 Default constructor registers the resource.
 
 ManagedResource (std::string_view name)
 Registers the resource and sets its name.
 
virtual ~ManagedResource ()
 Unregisters the resource.
 
std::string_view GetName () const
 Return a custom name for the object.
 
virtual void SetName (std::string_view name)
 Set a custom name for the object.
 
std::string Print () const
 Print name and type in one string.
 
- Public Member Functions inherited from foray::NoMoveDefaults
 NoMoveDefaults ()=default
 
 NoMoveDefaults (const NoMoveDefaults &other)=delete
 
 NoMoveDefaults (NoMoveDefaults &&other)=default
 
NoMoveDefaultsoperator= (const NoMoveDefaults &other)=delete
 

Static Public Attributes

static const uint32_t PUSHC_OFFSET_AUTO = ~0U
 

Protected Attributes

core::ContextmContext {}
 
VkPipelineLayout mPipelineLayout {}
 
std::vector< VkDescriptorSetLayout > mDescriptorSetLayouts
 
std::vector< VkPushConstantRange > mPushConstantRanges
 
uint32_t mPushConstantOffset = 0U
 
- Protected Attributes inherited from foray::core::ManagedResource
std::string mName
 This objects custom name.
 

Additional Inherited Members

- Static Public Member Functions inherited from foray::core::ManagedResource
static void sPrintAllocatedResources (bool printAsWarning)
 Print a list of all registered existing resources.
 
static const std::unordered_set< ManagedResource * > * GetTotalAllocatedResources ()
 
- Protected Member Functions inherited from foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_PIPELINE_LAYOUT >
virtual void SetObjectName (core::Context *context, const void *handle, std::string_view name, bool updateResourceName=true)
 Set the object name. Sets both ManagedResource::mName aswell as vulkan debug object name.
 

Detailed Description

Class that holds memory ownership of a vulkan pipeline layout.

Constructor & Destructor Documentation

◆ PipelineLayout()

foray::util::PipelineLayout::PipelineLayout ( )
default

◆ ~PipelineLayout()

foray::util::PipelineLayout::~PipelineLayout ( )
inline

Member Function Documentation

◆ AddDescriptorSetLayout()

void foray::util::PipelineLayout::AddDescriptorSetLayout ( VkDescriptorSetLayout  layout)

Add a descriptorset layout to the pipeline layout prior to building.

◆ AddDescriptorSetLayouts()

void foray::util::PipelineLayout::AddDescriptorSetLayouts ( const std::vector< VkDescriptorSetLayout > &  layouts)

Add descriptorset layouts to the pipeline layout prior to building.

◆ AddPushConstantRange() [1/2]

void foray::util::PipelineLayout::AddPushConstantRange ( VkPushConstantRange  range)

Add a push constant range to the pipeline layout prior to building.

Remarks
If range.offset is set to PUSHC_OFFSET_AUTO, it is automatically set based on previously added pushconstants

◆ AddPushConstantRange() [2/2]

template<typename TPushC >
void foray::util::PipelineLayout::AddPushConstantRange ( VkShaderStageFlags  stageFlags,
uint32_t  offset = PUSHC_OFFSET_AUTO 
)
inline

Add push constant ranges to the pipeline layout prior to building.

Template Parameters
TPushCPush Constant type (determines size)
Parameters
stageFlagsShader Stage Flags
offsetOffset. If set to PUSHC_OFFSET_AUTO, it is automatically set based on previously added pushconstants

◆ AddPushConstantRanges()

void foray::util::PipelineLayout::AddPushConstantRanges ( const std::vector< VkPushConstantRange > &  ranges)

Add push constant ranges to the pipeline layout prior to building.

Remarks
If range.offset is set to PUSHC_OFFSET_AUTO, it is automatically set based on previously added pushconstants

◆ Build() [1/2]

VkPipelineLayout foray::util::PipelineLayout::Build ( core::Context context,
const std::vector< VkDescriptorSetLayout > &  descriptorLayouts,
const std::vector< VkPushConstantRange > &  pushConstantRanges,
VkPipelineLayoutCreateFlags  flags = 0,
void *  pNext = nullptr 
)

Builds the pipelinelayout based on previously added descriptorset layouts and push constant ranges (aswell as parameters)

Parameters
contextRequires DispatchTable
descriptorLayoutsAdditional DescriptorSetLayouts
pushConstantRangesAdditional PushConstantRanges
flagsVkPipelineLayoutCreateInfo::flags
pNextVkPipelineLayoutCreateInfo::pNext

◆ Build() [2/2]

VkPipelineLayout foray::util::PipelineLayout::Build ( core::Context context,
VkPipelineLayoutCreateFlags  flags = 0,
void *  pNext = nullptr 
)

Builds the pipelinelayout based on previously added descriptorset layouts and push constant ranges.

Parameters
contextRequires DispatchTable
flagsVkPipelineLayoutCreateInfo::flags
pNextVkPipelineLayoutCreateInfo::pNext

◆ Destroy()

virtual void foray::util::PipelineLayout::Destroy ( )
virtual

Destroy the resource.

Remarks
This method must be callable even if the resource has not been initialized yet. This method must call any Destroy() overloads of child objects and of base classes

Implements foray::core::ManagedResource.

◆ Exists()

virtual bool foray::util::PipelineLayout::Exists ( ) const
inlinevirtual

Return true, if the managed resource is allocated.

Example: Vulkan object stored could be nullptr or instantiated

Implements foray::core::ManagedResource.

◆ operator VkPipelineLayout()

foray::util::PipelineLayout::operator VkPipelineLayout ( ) const
inline

Member Data Documentation

◆ mContext

core::Context* foray::util::PipelineLayout::mContext {}
protected

◆ mDescriptorSetLayouts

std::vector<VkDescriptorSetLayout> foray::util::PipelineLayout::mDescriptorSetLayouts
protected

◆ mPipelineLayout

VkPipelineLayout foray::util::PipelineLayout::mPipelineLayout {}
protected

◆ mPushConstantOffset

uint32_t foray::util::PipelineLayout::mPushConstantOffset = 0U
protected

◆ mPushConstantRanges

std::vector<VkPushConstantRange> foray::util::PipelineLayout::mPushConstantRanges
protected

◆ PUSHC_OFFSET_AUTO

const uint32_t foray::util::PipelineLayout::PUSHC_OFFSET_AUTO = ~0U
static

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