Template Class LayerExtensionCollectionModifier

Class Documentation

template<typename VkCreateInfoStructureType>
class LayerExtensionCollectionModifier

Provides automated validation of layer and extension loading when populating VkInstanceCreateInfo and VkDeviceCreateInfo objects.

Param <VkCreateInfoStructureType>

The type of VkCreateInfo structure to provide validation on

Public Functions

inline LayerExtensionCollectionModifier() = default

Constructs an instance of VkCreateInfoStructureType.

inline virtual ~LayerExtensionCollectionModifier() = 0

Destroys an instance of VkCreateInfoStructureType

NOTE : This will cause the targeted VkCreateInfo structure to be reverted.

inline const std::set<std::string> &GetAvailableLayers() const

Gets this LayerExtensionCollectionModifier object's available layer names.

Returns

This LayerExtensionCollectionModifier object's available layer names

inline const std::set<std::string> &GetAvailableExtensions() const

Gets this LayerExtensionCollectionModifier object's available extension names.

Returns

This LayerExtensionCollectionModifier

object's available extension names

NOTE : Layer dependenet extensions are reported as available as long as the layer they depend on is available

inline const std::vector<const char*> &GetEnabledLayers() const

Gets this LayerExtensionCollectionModifier object's enabled layer names.

Returns

This LayerExtensionCollectionModifier object's enabled layer names

inline const std::vector<const char*> &GetEnabledExtensions() const

Gets this LayerExtensionCollectionModifier object's enabled extension names.

Returns

This LayerExtensionCollectionModifier object's enabled extension names

inline void SetCreateInfo(VkCreateInfoStructureType *pCreateInfo, bool autoRevert = true)

Sets the target VkCreateInfo structure to modify when applying custom layers or extensions

NOTE : Once set, the targeted VkCreateInfo structure's ppEnabledLayerNames and ppEnabledExtensionNames members will point to storage managed by this LayerExtensionCollectionModifier<> until

Revert() is called.

optional = true) autoRevert Whether or not to automatically revert the targeted VkCreateInfo structure when this LayerExtensionCollectionModifier<> is destroyed

Parameters

pCreateInfo -- [in] A pointer to the VkCreateInfo structure to modify when applying custom layers or extensions

Param

inline bool ApplyCustomLayer(const char *layerName)

Validates and if successful applies a given custom layer to the targeted VkCreateInfo structure.

Parameters

layerName -- [in] The name of the custom layer to apply

Returns

Whether or not the given layer name is available

NOTE : This method requires the list of available layers be populated via EnumerateInstanceLayerProperties() before use

inline bool ApplyCustomExtension(const char *extensionName)

Validates and if successful applies a given custom extension to the targeted VkCreateInfo structure.

Parameters

extensionName -- [in] The name of the custom extension to apply

Returns

Whether or not the given layer extension is available

NOTE : This method requires the list of available extenstions be populated via EnumerateInstanceExtensionProperties() or EnumerateDeviceExtensionProperties() before use

NOTE : This method does not validate whether or not dependent layers are requested

inline void Validate()

Validates all enabled layers and extensions and removes any that are unavailable.

inline void Revert()

Reverts the targeted VkCreateInfo structure to the state it had when it was first set via SetCreateInfo()

inline void Clear()

Reverts the targeted VkCreateInfo structure and clears all available and custom layers and extensions.

Protected Functions

inline void PopulateEntries(uint32_t enabledEntryCount, const char *const *ppEnabledEntryNames, std::vector<const char*> &enabledEntries)
inline bool ApplyCustomEntry(const char *entryName, const std::set<std::string> &availableEntries, std::vector<const char*> &enabledEntries)
inline void ApplyCustomEntries()
inline void ValidateEntries(const std::set<std::string> &availableEntries, std::vector<const char*> &enabledEntries)
inline void AutoRevert()
LayerExtensionCollectionModifier(const LayerExtensionCollectionModifier&) = delete
LayerExtensionCollectionModifier &operator=(const LayerExtensionCollectionModifier&) = delete
LayerExtensionCollectionModifier(LayerExtensionCollectionModifier&&) = delete
LayerExtensionCollectionModifier &operator=(LayerExtensionCollectionModifier&&) = delete

Protected Attributes

std::set<std::string> mAvailableLayers
std::vector<const char*> mEnabledLayers
std::set<std::string> mAvailableExtensions
std::vector<const char*> mEnabledExtensions
VkCreateInfoStructureType mStashedCreateInfo = {}
VkCreateInfoStructureType *mCreateInfo = {nullptr}
bool mAutoRevert = {false}