OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::VulkanRootLayout Class Referencefinal

#include <OgreVulkanRootLayout.h>

+ Inheritance diagram for Ogre::VulkanRootLayout:

Public Member Functions

 VulkanRootLayout (VulkanGpuProgramManager *programManager)
 
 ~VulkanRootLayout ()
 
void bind (VulkanDevice *device, VulkanVaoManager *vaoManager, const VulkanGlobalBindingTable &table)
 Takes an emulated D3D11/Metal-style table and binds it according to this layout's rules. More...
 
void copyFrom (const RootLayout &rootLayout, bool bIncludeArrayBindings=true)
 
void copyTo (RootLayout &outRootLayout, bool bIncludeArrayBindings)
 Performs outRootLayout.copyFrom( this ) This function is necessary because RootLayout is a protected base class. More...
 
VkPipelineLayout createVulkanHandles ()
 Creates most of our Vulkan handles required to build a PSO. More...
 
void dump (String &outJson) const
 Dumps the current RootLayout to a JSON string. More...
 
bool findBindingIndex (const uint32 setIdx, const uint32 targetBindingIdx, DescBindingTypes::DescBindingTypes &outType, size_t &outRelativeSlotIndex) const
 O( N ) search to find DescBindingRange via its flattened vulkan binding idx (i.e. More...
 
bool findParamsBuffer (uint32 shaderStage, size_t &outSetIdx, size_t &outBindingIdx) const
 Retrieves the set and binding idx of the params buffer. More...
 
void generateRootLayoutMacros (uint32 shaderStage, ShaderSyntax shaderType, String &inOutString) const
 Generates all the macros for compiling shaders, based on our layout. More...
 
const DescBindingRangegetDescBindingRanges (size_t setIdx) const
 
const DescBindingRangegetDescBindingRanges (size_t setIdx) const
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
bool operator< (const VulkanRootLayout &other) const
 
void parseRootLayout (const char *rootLayout, const bool bCompute, const String &filename)
 
void validateArrayBindings (const RootLayout &groundTruth, const String &filename) const
 Validates that the array bindings in groundTruth.mArrayRanges are included in this->mArrayRanges. More...
 

Static Public Member Functions

static VulkanRootLayoutfindBest (VulkanRootLayout *a, VulkanRootLayout *b)
 Two root layouts can be incompatible. More...
 

Private Member Functions

void dump (String &outJson) const
 Dumps the current RootLayout to a JSON string. More...
 
bool findParamsBuffer (uint32 shaderStage, size_t &outSetIdx, size_t &outBindingIdx) const
 Retrieves the set and binding idx of the params buffer. More...
 
void validateArrayBindings (const RootLayout &groundTruth, const String &filename) const
 Validates that the array bindings in groundTruth.mArrayRanges are included in this->mArrayRanges. More...
 

Constructor & Destructor Documentation

◆ VulkanRootLayout()

Ogre::VulkanRootLayout::VulkanRootLayout ( VulkanGpuProgramManager programManager)

◆ ~VulkanRootLayout()

Ogre::VulkanRootLayout::~VulkanRootLayout ( )

Member Function Documentation

◆ bind()

void Ogre::VulkanRootLayout::bind ( VulkanDevice device,
VulkanVaoManager vaoManager,
const VulkanGlobalBindingTable table 
)

Takes an emulated D3D11/Metal-style table and binds it according to this layout's rules.

This updates N descriptors (1 for each set) and binds them

Parameters
device
vaoManagerThe VaoManager so we can grab new VulkanDescriptorPools shall we need them
tableThe emulated table to bind it

◆ copyFrom()

void Ogre::VulkanRootLayout::copyFrom ( const RootLayout rootLayout,
bool  bIncludeArrayBindings = true 
)

◆ copyTo()

void Ogre::VulkanRootLayout::copyTo ( RootLayout outRootLayout,
bool  bIncludeArrayBindings 
)

Performs outRootLayout.copyFrom( this ) This function is necessary because RootLayout is a protected base class.

◆ createVulkanHandles()

VkPipelineLayout Ogre::VulkanRootLayout::createVulkanHandles ( )

Creates most of our Vulkan handles required to build a PSO.

This function is not called by parseRootLayout because if two Root Layouts are identical, then after calling a->parseRootLayout(), instead of calling a->createVulkanHandles() we first must look for an already existing VulkanRootLayout and reuse it.

Returns
VkPipelineLayout handle for building the PSO.

◆ dump()

void Ogre::RootLayout::dump

Dumps the current RootLayout to a JSON string.

◆ findBest()

static VulkanRootLayout* Ogre::VulkanRootLayout::findBest ( VulkanRootLayout a,
VulkanRootLayout b 
)
static

Two root layouts can be incompatible.

If so, we return nullptr

If a and b are compatible, we return the best one (one that can satisfy both a and b).

a or b can be nullptr

◆ findBindingIndex()

bool Ogre::VulkanRootLayout::findBindingIndex ( const uint32  setIdx,
const uint32  targetBindingIdx,
DescBindingTypes::DescBindingTypes outType,
size_t &  outRelativeSlotIndex 
) const

O( N ) search to find DescBindingRange via its flattened vulkan binding idx (i.e.

reverse search)

Parameters
setIdx
targetBindingIdx
outType[out] The type located. Not touched if not found
outRelativeSlotIndex[out] The slot index expressed in the respective DescBindingTypes. Not touched if not found
Returns
False if not found

◆ findParamsBuffer()

bool Ogre::RootLayout::findParamsBuffer

Retrieves the set and binding idx of the params buffer.

Parameters
shaderStageSee GpuProgramType
outSetIdx[out] Set in which it is located Value will not be modified if we return false
outBindingIdx[out] Binding index in which it is located Value will not be modified if we return false
Returns
True if there is a params buffer False otherwise and output params won't be modified

◆ generateRootLayoutMacros()

void Ogre::VulkanRootLayout::generateRootLayoutMacros ( uint32  shaderStage,
ShaderSyntax  shaderType,
String inOutString 
) const

Generates all the macros for compiling shaders, based on our layout.

e.g. a layout like this:

## ROOT LAYOUT BEGIN
{
"0" :
{
"has_params" : true
"const_buffers" : [2, 4]
"tex_buffers" : [0, 1]
"samplers" : [1, 2],
"textures" : [1, 2]
}
}
## ROOT LAYOUT END

will generate the following:

#define ogre_P0 set = 0, binding = 0 // Params buffer
#define ogre_B2 set = 0, binding = 1 // Const buffer at slot 2
#define ogre_B3 set = 0, binding = 2
#define ogre_T0 set = 0, binding = 3 // Tex buffer at slot 0
#define ogre_t1 set = 0, binding = 4 // Texture at slot 1
// (other APIs share tex buffer & texture slots)
#define ogre_s1 set = 0, binding = 5 // Sampler at slot 1
Parameters
shaderStageSee GpuProgramType
inOutString[in/out] String to output our macros

◆ getDescBindingRanges() [1/2]

const DescBindingRange* Ogre::RootLayout::getDescBindingRanges
inline

◆ getDescBindingRanges() [2/2]

const DescBindingRange* Ogre::VulkanRootLayout::getDescBindingRanges ( size_t  setIdx) const
inline

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator<()

bool Ogre::VulkanRootLayout::operator< ( const VulkanRootLayout other) const

◆ parseRootLayout()

void Ogre::VulkanRootLayout::parseRootLayout ( const char *  rootLayout,
const bool  bCompute,
const String filename 
)

◆ validateArrayBindings()

void Ogre::RootLayout::validateArrayBindings

Validates that the array bindings in groundTruth.mArrayRanges are included in this->mArrayRanges.

Will throw otherwise

Parameters
groundTruthRoot Layout to compare against. Its data should've been obtrained through reflection
filenameFilename for logging purposes if errors are found

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