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

Shader binding table for storing raygen, miss and callable shader groups. More...

#include <foray_generalsbt.hpp>

Inheritance diagram for foray::rtpipe::GeneralShaderBindingTable:
foray::rtpipe::ShaderBindingTableBase

Classes

struct  ShaderGroup
 General shader group. More...
 

Public Member Functions

 GeneralShaderBindingTable (RtShaderGroupType groupType, VkDeviceSize entryDataSize=0)
 
void SetGroup (GroupIndex groupIndex, core::ShaderModule *shader)
 Set shader group with shader.
 
void SetGroup (GroupIndex groupIndex, core::ShaderModule *shader, const void *data)
 Set shader group with shader and custom data.
 
virtual void WriteToShaderCollection (RtShaderCollection &collection) const override
 For any shader group defined, register it with the collection.
 
virtual VectorRange WriteToShaderGroupCiVector (std::vector< VkRayTracingShaderGroupCreateInfoKHR > &groupCis, const RtShaderCollection &shaderCollection) const override
 Write the shader groups to groupCis vector.
 
virtual void Destroy () override
 
- Public Member Functions inherited from foray::rtpipe::ShaderBindingTableBase
 ShaderBindingTableBase (VkDeviceSize entryDataSize=0)
 
virtual void Build (core::Context *context, const VkPhysicalDeviceRayTracingPipelinePropertiesKHR &pipelineProperties, const std::vector< const uint8_t * > &handles)
 Rebuilds the SBT buffer according to the pipeline properties and matching indices.
 
std::vector< uint8_t > & GroupDataAt (GroupIndex groupIndex)
 Access the custom data entry for a group.
 
const std::vector< uint8_t > & GroupDataAt (GroupIndex groupIndex) const
 Access the custom data entry for a group.
 
template<typename TData >
TData * GroupDataAt (GroupIndex groupIndex)
 Access the custom data entry for a group. May return nullptr!
 
template<typename TData >
const TData * GroupDataAt (GroupIndex groupIndex) const
 Access the custom data entry for a group. May return nullptr!
 
void SetData (GroupIndex groupIndex, const void *data)
 Set the custom data entry for a group.
 
template<typename TData >
void SetData (GroupIndex groupIndex, const TData &data)
 Set the custom data entry for a group.
 
virtual ShaderBindingTableBaseSetEntryDataSize (VkDeviceSize newSize)
 Set the custom entry data size. Any non-zero custom data is resized according to std::vector<uint8_t>::resize(newSize)!
 
virtual ~ShaderBindingTableBase ()
 

Protected Member Functions

virtual size_t GetGroupArrayCount () const override
 
- Protected Member Functions inherited from foray::rtpipe::ShaderBindingTableBase
void ArrayResized (size_t newSize)
 

Protected Attributes

RtShaderGroupType mShaderGroupType = RtShaderGroupType::Undefined
 
std::vector< ShaderGroupmGroups
 
- Protected Attributes inherited from foray::rtpipe::ShaderBindingTableBase
core::ManagedBuffer mBuffer
 
VkStridedDeviceAddressRegionKHR mAddressRegion {}
 
VkDeviceSize mEntryDataSize {}
 
std::vector< std::vector< uint8_t > > mGroupData {}
 

Detailed Description

Shader binding table for storing raygen, miss and callable shader groups.

Constructor & Destructor Documentation

◆ GeneralShaderBindingTable()

foray::rtpipe::GeneralShaderBindingTable::GeneralShaderBindingTable ( RtShaderGroupType  groupType,
VkDeviceSize  entryDataSize = 0 
)
explicit

Member Function Documentation

◆ Destroy()

virtual void foray::rtpipe::GeneralShaderBindingTable::Destroy ( )
overridevirtual

◆ GetGroupArrayCount()

virtual size_t foray::rtpipe::GeneralShaderBindingTable::GetGroupArrayCount ( ) const
inlineoverrideprotectedvirtual

◆ SetGroup() [1/2]

void foray::rtpipe::GeneralShaderBindingTable::SetGroup ( GroupIndex  groupIndex,
core::ShaderModule shader 
)

Set shader group with shader.

◆ SetGroup() [2/2]

void foray::rtpipe::GeneralShaderBindingTable::SetGroup ( GroupIndex  groupIndex,
core::ShaderModule shader,
const void *  data 
)

Set shader group with shader and custom data.

Parameters
datapointer to a memory area of mEntryDataSize size. Use SetShaderDataSize(...) before adding shaders!

◆ WriteToShaderCollection()

virtual void foray::rtpipe::GeneralShaderBindingTable::WriteToShaderCollection ( RtShaderCollection collection) const
overridevirtual

For any shader group defined, register it with the collection.

Implements foray::rtpipe::ShaderBindingTableBase.

◆ WriteToShaderGroupCiVector()

virtual VectorRange foray::rtpipe::GeneralShaderBindingTable::WriteToShaderGroupCiVector ( std::vector< VkRayTracingShaderGroupCreateInfoKHR > &  groupCis,
const RtShaderCollection shaderCollection 
) const
overridevirtual

Write the shader groups to groupCis vector.

Parameters
shaderCollectionCollection used to look up the index of shaders
Returns
the range in the groupCis vector used by this Sbts' ShaderGroups

Implements foray::rtpipe::ShaderBindingTableBase.

Member Data Documentation

◆ mGroups

std::vector<ShaderGroup> foray::rtpipe::GeneralShaderBindingTable::mGroups
protected

◆ mShaderGroupType

RtShaderGroupType foray::rtpipe::GeneralShaderBindingTable::mShaderGroupType = RtShaderGroupType::Undefined
protected

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