![]() |
OGRE-Next 3.0.0
Object-Oriented Graphics Rendering Engine
|
#include <OgreVulkanRootLayout.h>
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. | |
void | copyFrom (const RootLayout &rootLayout, bool bIncludeArrayBindings=true) |
Copies all our parameters from 'other' Does NOT call validate() | |
void | copyTo (RootLayout &outRootLayout, bool bIncludeArrayBindings) |
Performs outRootLayout.copyFrom( this ) This function is necessary because RootLayout is a protected base class. | |
VkPipelineLayout | createVulkanHandles () |
Creates most of our Vulkan handles required to build a PSO. | |
void | dump (String &outJson) const |
Dumps the current RootLayout to a JSON string. | |
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. | |
bool | findParamsBuffer (uint32 shaderStage, size_t &outSetIdx, size_t &outBindingIdx) const |
Retrieves the set and binding idx of the params buffer. | |
void | generateRootLayoutMacros (uint32 shaderStage, ShaderSyntax shaderType, String &inOutString) const |
Generates all the macros for compiling shaders, based on our layout. | |
const DescBindingRange * | getDescBindingRanges (size_t setIdx) const |
bool | operator< (const VulkanRootLayout &other) const |
void | parseRootLayout (const char *rootLayout, const bool bCompute, const String &filename) |
Parses a root layout definition from a JSON string The JSON string: | |
void | validateArrayBindings (const RootLayout &groundTruth, const String &filename) const |
Validates that the array bindings in groundTruth.mArrayRanges are included in this->mArrayRanges. | |
Static Public Member Functions | |
static VulkanRootLayout * | findBest (VulkanRootLayout *a, VulkanRootLayout *b) |
Two root layouts can be incompatible. | |
Ogre::VulkanRootLayout::VulkanRootLayout | ( | VulkanGpuProgramManager * | programManager | ) |
Referenced by findBest(), and operator<().
Ogre::VulkanRootLayout::~VulkanRootLayout | ( | ) |
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
device | |
vaoManager | The VaoManager so we can grab new VulkanDescriptorPools shall we need them |
table | The emulated table to bind it |
void Ogre::VulkanRootLayout::copyFrom | ( | const RootLayout & | rootLayout, |
bool | bIncludeArrayBindings = true ) |
Copies all our parameters from 'other' Does NOT call validate()
other | |
bIncludeArrayBindings | When false, mArrayRanges are not included |
References Ogre::RootLayout::RootLayout().
void Ogre::VulkanRootLayout::copyTo | ( | RootLayout & | outRootLayout, |
bool | bIncludeArrayBindings ) |
Performs outRootLayout.copyFrom( this ) This function is necessary because RootLayout is a protected base class.
References Ogre::RootLayout::RootLayout().
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.
void Ogre::RootLayout::dump | ( | String & | outJson | ) | const |
Dumps the current RootLayout to a JSON string.
|
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
References VulkanRootLayout().
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)
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 |
bool Ogre::RootLayout::findParamsBuffer | ( | uint32 | shaderStage, |
size_t & | outSetIdx, | ||
size_t & | outBindingIdx ) const |
Retrieves the set and binding idx of the params buffer.
shaderStage | See 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 |
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:
will generate the following:
shaderStage | See GpuProgramType |
inOutString | [in/out] String to output our macros |
|
inline |
References Ogre::RootLayout::mDescBindingRanges.
bool Ogre::VulkanRootLayout::operator< | ( | const VulkanRootLayout & | other | ) | const |
References VulkanRootLayout().
void Ogre::VulkanRootLayout::parseRootLayout | ( | const char * | rootLayout, |
const bool | bCompute, | ||
const String & | filename ) |
Parses a root layout definition from a JSON string The JSON string:
has_params can establish which shader stages allow parameters.
Note that for compatibility with other APIs, textures and tex_buffers cannot overlap Same with uav_buffers and uav_textures
rootLayout | JSON string containing root layout |
bCompute | True if this is meant for compute. False for graphics |
filename | Filename for logging purposes if errors are found |
void Ogre::RootLayout::validateArrayBindings | ( | const RootLayout & | groundTruth, |
const String & | filename ) const |
Validates that the array bindings in groundTruth.mArrayRanges are included in this->mArrayRanges.
Will throw otherwise
groundTruth | Root Layout to compare against. Its data should've been obtrained through reflection |
filename | Filename for logging purposes if errors are found |