From e48f8f99a3f2f94b41d5bfcc0feb3866e8136eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Mon, 17 Sep 2018 14:56:50 +0200 Subject: [PATCH 1/8] Correct dependency handling of aliased structures; generalized usage of first argument in member function calls. (#249) --- VulkanHppGenerator.cpp | 47 ++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index dbbabd1..20518f5 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1387,7 +1387,7 @@ bool VulkanHppGenerator::containsUnion(std::string const& type, std::map VulkanHppGenerator::createDefaults() { std::map defaultValues; - for (auto dependency : m_dependencies) + for (auto const& dependency : m_dependencies) { assert(defaultValues.find(dependency.name) == defaultValues.end()); switch (dependency.category) @@ -2184,6 +2184,7 @@ void VulkanHppGenerator::readExtensionsExtension(tinyxml2::XMLElement const* ele { "obsoletedby", {} }, { "platform",{} }, { "promotedto", {} }, + { "provisional", {} }, { "protect",{} }, { "requires",{} }, { "requiresCore",{} }, @@ -2577,7 +2578,7 @@ void VulkanHppGenerator::readTypeDefine(tinyxml2::XMLElement const* element, std std::string text = trim(child->GetText()); if (text == "VK_HEADER_VERSION") { - m_version = element->LastChild()->ToText()->Value(); + m_version = trimEnd(element->LastChild()->ToText()->Value()); } // ignore all the other defines assert(!child->NextSiblingElement() || (child->NextSiblingElement() && !child->NextSiblingElement()->FirstAttribute() && (strcmp(child->NextSiblingElement()->Value(), "type") == 0) && !child->NextSiblingElement()->NextSiblingElement())); @@ -2874,10 +2875,24 @@ void VulkanHppGenerator::sortDependencies() bool found = false; for (std::list::iterator it = m_dependencies.begin(); it != m_dependencies.end(); ++it) { + // check if all dependencies of it are already listed if (std::find_if(it->dependencies.begin(), it->dependencies.end(), [&listedTypes](std::string const& d) { return listedTypes.find(d) == listedTypes.end(); }) == it->dependencies.end()) { + // add it to the end of the sorted list and the set of listed types, remove it from the list of dependencies to handle and start over with the next dependency sortedDependencies.push_back(*it); listedTypes.insert(it->name); + + // if it is a struct, add any alias of it to the list of encountered types + if (it->category == DependencyData::Category::STRUCT) + { + std::map::const_iterator sit = m_structs.find(it->name); + assert(sit != m_structs.end()); + if (!sit->second.alias.empty()) + { + assert(listedTypes.find(sit->second.alias) == listedTypes.end()); + listedTypes.insert(sit->second.alias); + } + } m_dependencies.erase(it); found = true; break; @@ -2885,7 +2900,7 @@ void VulkanHppGenerator::sortDependencies() } if (!found) { - // resolve direct circular dependencies + // at least one dependency of it is not yet listed -> resolve direct circular dependencies for (std::list::iterator it = m_dependencies.begin(); !found && it != m_dependencies.end(); ++it) { for (std::set::const_iterator dit = it->dependencies.begin(); dit != it->dependencies.end(); ++dit) @@ -2895,9 +2910,9 @@ void VulkanHppGenerator::sortDependencies() { if (depIt->dependencies.find(it->name) != depIt->dependencies.end()) { - // we only have just one case, for now! + // we only have two cases, for now! assert((it->category == DependencyData::Category::HANDLE) && (depIt->category == DependencyData::Category::STRUCT) - || (it->category == DependencyData::Category::STRUCT) && (depIt->category == DependencyData::Category::STRUCT)); + || (it->category == DependencyData::Category::STRUCT) && (depIt->category == DependencyData::Category::STRUCT)); it->forwardDependencies.insert(*dit); it->dependencies.erase(*dit); found = true; @@ -2907,7 +2922,14 @@ void VulkanHppGenerator::sortDependencies() #if !defined(NDEBUG) else { - assert(std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [&dit](DependencyData const& dd) { return(dd.name == *dit); }) != sortedDependencies.end()); + // here, only already sorted dependencies should occur, or structs that are aliased and sorted + std::list::const_iterator sdit = std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [&dit](DependencyData const& dd) { return(dd.name == *dit); }); + if (sdit == sortedDependencies.end()) + { + std::map::const_iterator sit = std::find_if(m_structs.begin(), m_structs.end(), [&dit](std::pair const& sd) { return sd.second.alias == *dit; }); + assert(sit != m_structs.end()); + assert(std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [name = sit->first](DependencyData const& dd) { return dd.name == name; }) != sortedDependencies.end()); + } } #endif } @@ -2995,8 +3017,9 @@ void VulkanHppGenerator::writeCall(std::ostream & os, CommandData const& command if (!commandData.className.empty()) { - // if it's member of a class -> add the first parameter with "m_" as prefix - os << "m_" << commandData.params[0].name; + // if it's member of a class -> the first argument is the member variable, starting with "m_" + assert(commandData.className == commandData.params[0].type); + os << "m_" << startLowerCase(commandData.className); if (1 < commandData.params.size()) { os << ", "; @@ -3654,7 +3677,8 @@ void VulkanHppGenerator::writeFunctionBodyStandard(std::ostream & os, std::strin if (!commandData.className.empty()) { // the command is part of a class -> the first argument is the member variable, starting with "m_" - os << "m_" << commandData.params[0].name; + assert(commandData.className == commandData.params[0].type); + os << "m_" << startLowerCase(commandData.className); } // list all the arguments @@ -4227,7 +4251,8 @@ void VulkanHppGenerator::writeStructureChainValidation(std::ostream & os, Depend std::map::const_iterator it = m_structs.find(dependencyData.name); assert(it != m_structs.end()); - if (!it->second.structExtends.empty()) { + if (!it->second.structExtends.empty()) + { enterProtect(os, it->second.protect); // write out allowed structure chains @@ -4679,7 +4704,7 @@ void VulkanHppGenerator::writeTypeStruct(std::ostream & os, DependencyData const // create the setters if (!it->second.returnedOnly) { - for (size_t i = 0; isecond.members.size(); i++) + for (size_t i = 0; i < it->second.members.size(); i++) { writeStructSetter(os, dependencyData.name, it->second.members[i]); } From 77ff84f711ff91290b5fa56ad8084d5baf0b7d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 18 Sep 2018 15:03:17 +0200 Subject: [PATCH 2/8] Introduce missing non-const cast-operator on structs and unions. (#250) --- VulkanHppGenerator.cpp | 18 +- vulkan/vulkan.hpp | 2401 ++++++++++++++++++++++++++++++++++------ 2 files changed, 2072 insertions(+), 347 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 20518f5..879f56f 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -4710,11 +4710,16 @@ void VulkanHppGenerator::writeTypeStruct(std::ostream & os, DependencyData const } } - // the cast-operator to the wrapped struct - os << " operator const Vk" << dependencyData.name << "&() const" << std::endl + // the implicit cast-operators to the native type + os << " operator Vk" << dependencyData.name << " const&() const" << std::endl << " {" << std::endl << " return *reinterpret_cast(this);" << std::endl << " }" << std::endl + << std::endl + << " operator Vk" << dependencyData.name << " &()" << std::endl + << " {" << std::endl + << " return *reinterpret_cast(this);" << std::endl + << " }" << std::endl << std::endl; // operator==() and operator!=() @@ -4879,11 +4884,16 @@ void VulkanHppGenerator::writeTypeUnion(std::ostream & os, DependencyData const& writeStructSetter(os, dependencyData.name, it->second.members[i]); } - // the implicit cast operator to the native type - os << " operator Vk" << dependencyData.name << " const& () const" << std::endl + // the implicit cast operators to the native type + os << " operator Vk" << dependencyData.name << " const&() const" << std::endl << " {" << std::endl << " return *reinterpret_cast(this);" << std::endl << " }" << std::endl + << std::endl + << " operator Vk" << dependencyData.name << " &()" << std::endl + << " {" << std::endl + << " return *reinterpret_cast(this);" << std::endl + << " }" << std::endl << std::endl; // the union member variables diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 3216aa4..680e0ee 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -4901,11 +4901,16 @@ public: return *this; } - operator const VkOffset2D&() const + operator VkOffset2D const&() const { return *reinterpret_cast(this); } + operator VkOffset2D &() + { + return *reinterpret_cast(this); + } + bool operator==( Offset2D const& rhs ) const { return ( x == rhs.x ) @@ -4968,11 +4973,16 @@ public: return *this; } - operator const VkOffset3D&() const + operator VkOffset3D const&() const { return *reinterpret_cast(this); } + operator VkOffset3D &() + { + return *reinterpret_cast(this); + } + bool operator==( Offset3D const& rhs ) const { return ( x == rhs.x ) @@ -5022,11 +5032,16 @@ public: return *this; } - operator const VkExtent2D&() const + operator VkExtent2D const&() const { return *reinterpret_cast(this); } + operator VkExtent2D &() + { + return *reinterpret_cast(this); + } + bool operator==( Extent2D const& rhs ) const { return ( width == rhs.width ) @@ -5089,11 +5104,16 @@ public: return *this; } - operator const VkExtent3D&() const + operator VkExtent3D const&() const { return *reinterpret_cast(this); } + operator VkExtent3D &() + { + return *reinterpret_cast(this); + } + bool operator==( Extent3D const& rhs ) const { return ( width == rhs.width ) @@ -5175,11 +5195,16 @@ public: return *this; } - operator const VkViewport&() const + operator VkViewport const&() const { return *reinterpret_cast(this); } + operator VkViewport &() + { + return *reinterpret_cast(this); + } + bool operator==( Viewport const& rhs ) const { return ( x == rhs.x ) @@ -5235,11 +5260,16 @@ public: return *this; } - operator const VkRect2D&() const + operator VkRect2D const&() const { return *reinterpret_cast(this); } + operator VkRect2D &() + { + return *reinterpret_cast(this); + } + bool operator==( Rect2D const& rhs ) const { return ( offset == rhs.offset ) @@ -5295,11 +5325,16 @@ public: return *this; } - operator const VkClearRect&() const + operator VkClearRect const&() const { return *reinterpret_cast(this); } + operator VkClearRect &() + { + return *reinterpret_cast(this); + } + bool operator==( ClearRect const& rhs ) const { return ( rect == rhs.rect ) @@ -5320,11 +5355,16 @@ public: struct ExtensionProperties { - operator const VkExtensionProperties&() const + operator VkExtensionProperties const&() const { return *reinterpret_cast(this); } + operator VkExtensionProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ExtensionProperties const& rhs ) const { return ( memcmp( extensionName, rhs.extensionName, VK_MAX_EXTENSION_NAME_SIZE * sizeof( char ) ) == 0 ) @@ -5343,11 +5383,16 @@ public: struct LayerProperties { - operator const VkLayerProperties&() const + operator VkLayerProperties const&() const { return *reinterpret_cast(this); } + operator VkLayerProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( LayerProperties const& rhs ) const { return ( memcmp( layerName, rhs.layerName, VK_MAX_EXTENSION_NAME_SIZE * sizeof( char ) ) == 0 ) @@ -5431,11 +5476,16 @@ public: return *this; } - operator const VkAllocationCallbacks&() const + operator VkAllocationCallbacks const&() const { return *reinterpret_cast(this); } + operator VkAllocationCallbacks &() + { + return *reinterpret_cast(this); + } + bool operator==( AllocationCallbacks const& rhs ) const { return ( pUserData == rhs.pUserData ) @@ -5462,11 +5512,16 @@ public: struct MemoryRequirements { - operator const VkMemoryRequirements&() const + operator VkMemoryRequirements const&() const { return *reinterpret_cast(this); } + operator VkMemoryRequirements &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryRequirements const& rhs ) const { return ( size == rhs.size ) @@ -5524,11 +5579,16 @@ public: return *this; } - operator const VkDescriptorBufferInfo&() const + operator VkDescriptorBufferInfo const&() const { return *reinterpret_cast(this); } + operator VkDescriptorBufferInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorBufferInfo const& rhs ) const { return ( buffer == rhs.buffer ) @@ -5549,11 +5609,16 @@ public: struct SubresourceLayout { - operator const VkSubresourceLayout&() const + operator VkSubresourceLayout const&() const { return *reinterpret_cast(this); } + operator VkSubresourceLayout &() + { + return *reinterpret_cast(this); + } + bool operator==( SubresourceLayout const& rhs ) const { return ( offset == rhs.offset ) @@ -5615,11 +5680,16 @@ public: return *this; } - operator const VkBufferCopy&() const + operator VkBufferCopy const&() const { return *reinterpret_cast(this); } + operator VkBufferCopy &() + { + return *reinterpret_cast(this); + } + bool operator==( BufferCopy const& rhs ) const { return ( srcOffset == rhs.srcOffset ) @@ -5677,11 +5747,16 @@ public: return *this; } - operator const VkSpecializationMapEntry&() const + operator VkSpecializationMapEntry const&() const { return *reinterpret_cast(this); } + operator VkSpecializationMapEntry &() + { + return *reinterpret_cast(this); + } + bool operator==( SpecializationMapEntry const& rhs ) const { return ( constantID == rhs.constantID ) @@ -5747,11 +5822,16 @@ public: return *this; } - operator const VkSpecializationInfo&() const + operator VkSpecializationInfo const&() const { return *reinterpret_cast(this); } + operator VkSpecializationInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SpecializationInfo const& rhs ) const { return ( mapEntryCount == rhs.mapEntryCount ) @@ -5807,11 +5887,16 @@ public: return *this; } - operator VkClearColorValue const& () const + operator VkClearColorValue const&() const { return *reinterpret_cast(this); } + operator VkClearColorValue &() + { + return *reinterpret_cast(this); + } + float float32[4]; int32_t int32[4]; uint32_t uint32[4]; @@ -5848,11 +5933,16 @@ public: return *this; } - operator const VkClearDepthStencilValue&() const + operator VkClearDepthStencilValue const&() const { return *reinterpret_cast(this); } + operator VkClearDepthStencilValue &() + { + return *reinterpret_cast(this); + } + bool operator==( ClearDepthStencilValue const& rhs ) const { return ( depth == rhs.depth ) @@ -5893,11 +5983,16 @@ public: return *this; } - operator VkClearValue const& () const + operator VkClearValue const&() const { return *reinterpret_cast(this); } + operator VkClearValue &() + { + return *reinterpret_cast(this); + } + #ifdef VULKAN_HPP_HAS_UNRESTRICTED_UNIONS ClearColorValue color; ClearDepthStencilValue depthStencil; @@ -6362,11 +6457,16 @@ public: return *this; } - operator const VkPhysicalDeviceFeatures&() const + operator VkPhysicalDeviceFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceFeatures const& rhs ) const { return ( robustBufferAccess == rhs.robustBufferAccess ) @@ -6491,11 +6591,16 @@ public: struct PhysicalDeviceSparseProperties { - operator const VkPhysicalDeviceSparseProperties&() const + operator VkPhysicalDeviceSparseProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSparseProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSparseProperties const& rhs ) const { return ( residencyStandard2DBlockShape == rhs.residencyStandard2DBlockShape ) @@ -6565,11 +6670,16 @@ public: return *this; } - operator const VkDrawIndirectCommand&() const + operator VkDrawIndirectCommand const&() const { return *reinterpret_cast(this); } + operator VkDrawIndirectCommand &() + { + return *reinterpret_cast(this); + } + bool operator==( DrawIndirectCommand const& rhs ) const { return ( vertexCount == rhs.vertexCount ) @@ -6645,11 +6755,16 @@ public: return *this; } - operator const VkDrawIndexedIndirectCommand&() const + operator VkDrawIndexedIndirectCommand const&() const { return *reinterpret_cast(this); } + operator VkDrawIndexedIndirectCommand &() + { + return *reinterpret_cast(this); + } + bool operator==( DrawIndexedIndirectCommand const& rhs ) const { return ( indexCount == rhs.indexCount ) @@ -6711,11 +6826,16 @@ public: return *this; } - operator const VkDispatchIndirectCommand&() const + operator VkDispatchIndirectCommand const&() const { return *reinterpret_cast(this); } + operator VkDispatchIndirectCommand &() + { + return *reinterpret_cast(this); + } + bool operator==( DispatchIndirectCommand const& rhs ) const { return ( x == rhs.x ) @@ -6736,11 +6856,16 @@ public: struct DisplayPlanePropertiesKHR { - operator const VkDisplayPlanePropertiesKHR&() const + operator VkDisplayPlanePropertiesKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPlanePropertiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPlanePropertiesKHR const& rhs ) const { return ( currentDisplay == rhs.currentDisplay ) @@ -6788,11 +6913,16 @@ public: return *this; } - operator const VkDisplayModeParametersKHR&() const + operator VkDisplayModeParametersKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayModeParametersKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayModeParametersKHR const& rhs ) const { return ( visibleRegion == rhs.visibleRegion ) @@ -6811,11 +6941,16 @@ public: struct DisplayModePropertiesKHR { - operator const VkDisplayModePropertiesKHR&() const + operator VkDisplayModePropertiesKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayModePropertiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayModePropertiesKHR const& rhs ) const { return ( displayMode == rhs.displayMode ) @@ -6878,11 +7013,16 @@ public: return *this; } - operator const VkRectLayerKHR&() const + operator VkRectLayerKHR const&() const { return *reinterpret_cast(this); } + operator VkRectLayerKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( RectLayerKHR const& rhs ) const { return ( offset == rhs.offset ) @@ -6932,11 +7072,16 @@ public: return *this; } - operator const VkPresentRegionKHR&() const + operator VkPresentRegionKHR const&() const { return *reinterpret_cast(this); } + operator VkPresentRegionKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( PresentRegionKHR const& rhs ) const { return ( rectangleCount == rhs.rectangleCount ) @@ -6984,11 +7129,16 @@ public: return *this; } - operator const VkXYColorEXT&() const + operator VkXYColorEXT const&() const { return *reinterpret_cast(this); } + operator VkXYColorEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( XYColorEXT const& rhs ) const { return ( x == rhs.x ) @@ -7007,11 +7157,16 @@ public: struct RefreshCycleDurationGOOGLE { - operator const VkRefreshCycleDurationGOOGLE&() const + operator VkRefreshCycleDurationGOOGLE const&() const { return *reinterpret_cast(this); } + operator VkRefreshCycleDurationGOOGLE &() + { + return *reinterpret_cast(this); + } + bool operator==( RefreshCycleDurationGOOGLE const& rhs ) const { return ( refreshDuration == rhs.refreshDuration ); @@ -7028,11 +7183,16 @@ public: struct PastPresentationTimingGOOGLE { - operator const VkPastPresentationTimingGOOGLE&() const + operator VkPastPresentationTimingGOOGLE const&() const { return *reinterpret_cast(this); } + operator VkPastPresentationTimingGOOGLE &() + { + return *reinterpret_cast(this); + } + bool operator==( PastPresentationTimingGOOGLE const& rhs ) const { return ( presentID == rhs.presentID ) @@ -7086,11 +7246,16 @@ public: return *this; } - operator const VkPresentTimeGOOGLE&() const + operator VkPresentTimeGOOGLE const&() const { return *reinterpret_cast(this); } + operator VkPresentTimeGOOGLE &() + { + return *reinterpret_cast(this); + } + bool operator==( PresentTimeGOOGLE const& rhs ) const { return ( presentID == rhs.presentID ) @@ -7138,11 +7303,16 @@ public: return *this; } - operator const VkViewportWScalingNV&() const + operator VkViewportWScalingNV const&() const { return *reinterpret_cast(this); } + operator VkViewportWScalingNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ViewportWScalingNV const& rhs ) const { return ( xcoeff == rhs.xcoeff ) @@ -7190,11 +7360,16 @@ public: return *this; } - operator const VkSampleLocationEXT&() const + operator VkSampleLocationEXT const&() const { return *reinterpret_cast(this); } + operator VkSampleLocationEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( SampleLocationEXT const& rhs ) const { return ( x == rhs.x ) @@ -7213,11 +7388,16 @@ public: struct ShaderResourceUsageAMD { - operator const VkShaderResourceUsageAMD&() const + operator VkShaderResourceUsageAMD const&() const { return *reinterpret_cast(this); } + operator VkShaderResourceUsageAMD &() + { + return *reinterpret_cast(this); + } + bool operator==( ShaderResourceUsageAMD const& rhs ) const { return ( numUsedVgprs == rhs.numUsedVgprs ) @@ -7271,11 +7451,16 @@ public: return *this; } - operator const VkVertexInputBindingDivisorDescriptionEXT&() const + operator VkVertexInputBindingDivisorDescriptionEXT const&() const { return *reinterpret_cast(this); } + operator VkVertexInputBindingDivisorDescriptionEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( VertexInputBindingDivisorDescriptionEXT const& rhs ) const { return ( binding == rhs.binding ) @@ -7350,11 +7535,16 @@ public: return *this; } - operator const VkDescriptorImageInfo&() const + operator VkDescriptorImageInfo const&() const { return *reinterpret_cast(this); } + operator VkDescriptorImageInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorImageInfo const& rhs ) const { return ( sampler == rhs.sampler ) @@ -7404,11 +7594,16 @@ public: return *this; } - operator const VkAttachmentReference&() const + operator VkAttachmentReference const&() const { return *reinterpret_cast(this); } + operator VkAttachmentReference &() + { + return *reinterpret_cast(this); + } + bool operator==( AttachmentReference const& rhs ) const { return ( attachment == rhs.attachment ) @@ -7526,11 +7721,16 @@ public: return *this; } - operator const VkComponentMapping&() const + operator VkComponentMapping const&() const { return *reinterpret_cast(this); } + operator VkComponentMapping &() + { + return *reinterpret_cast(this); + } + bool operator==( ComponentMapping const& rhs ) const { return ( r == rhs.r ) @@ -7597,11 +7797,16 @@ public: return *this; } - operator const VkDescriptorPoolSize&() const + operator VkDescriptorPoolSize const&() const { return *reinterpret_cast(this); } + operator VkDescriptorPoolSize &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorPoolSize const& rhs ) const { return ( type == rhs.type ) @@ -7681,11 +7886,16 @@ public: return *this; } - operator const VkDescriptorUpdateTemplateEntry&() const + operator VkDescriptorUpdateTemplateEntry const&() const { return *reinterpret_cast(this); } + operator VkDescriptorUpdateTemplateEntry &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorUpdateTemplateEntry const& rhs ) const { return ( dstBinding == rhs.dstBinding ) @@ -8004,11 +8214,16 @@ public: return *this; } - operator const VkStencilOpState&() const + operator VkStencilOpState const&() const { return *reinterpret_cast(this); } + operator VkStencilOpState &() + { + return *reinterpret_cast(this); + } + bool operator==( StencilOpState const& rhs ) const { return ( failOp == rhs.failOp ) @@ -8123,11 +8338,16 @@ public: return *this; } - operator const VkVertexInputBindingDescription&() const + operator VkVertexInputBindingDescription const&() const { return *reinterpret_cast(this); } + operator VkVertexInputBindingDescription &() + { + return *reinterpret_cast(this); + } + bool operator==( VertexInputBindingDescription const& rhs ) const { return ( binding == rhs.binding ) @@ -8458,11 +8678,16 @@ public: return *this; } - operator const VkVertexInputAttributeDescription&() const + operator VkVertexInputAttributeDescription const&() const { return *reinterpret_cast(this); } + operator VkVertexInputAttributeDescription &() + { + return *reinterpret_cast(this); + } + bool operator==( VertexInputAttributeDescription const& rhs ) const { return ( location == rhs.location ) @@ -8858,11 +9083,16 @@ public: return *this; } - operator const VkApplicationInfo&() const + operator VkApplicationInfo const&() const { return *reinterpret_cast(this); } + operator VkApplicationInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ApplicationInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -8961,11 +9191,16 @@ public: return *this; } - operator const VkInstanceCreateInfo&() const + operator VkInstanceCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkInstanceCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( InstanceCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9034,11 +9269,16 @@ public: return *this; } - operator const VkMemoryAllocateInfo&() const + operator VkMemoryAllocateInfo const&() const { return *reinterpret_cast(this); } + operator VkMemoryAllocateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryAllocateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9107,11 +9347,16 @@ public: return *this; } - operator const VkMappedMemoryRange&() const + operator VkMappedMemoryRange const&() const { return *reinterpret_cast(this); } + operator VkMappedMemoryRange &() + { + return *reinterpret_cast(this); + } + bool operator==( MappedMemoryRange const& rhs ) const { return ( sType == rhs.sType ) @@ -9222,11 +9467,16 @@ public: return *this; } - operator const VkWriteDescriptorSet&() const + operator VkWriteDescriptorSet const&() const { return *reinterpret_cast(this); } + operator VkWriteDescriptorSet &() + { + return *reinterpret_cast(this); + } + bool operator==( WriteDescriptorSet const& rhs ) const { return ( sType == rhs.sType ) @@ -9339,11 +9589,16 @@ public: return *this; } - operator const VkCopyDescriptorSet&() const + operator VkCopyDescriptorSet const&() const { return *reinterpret_cast(this); } + operator VkCopyDescriptorSet &() + { + return *reinterpret_cast(this); + } + bool operator==( CopyDescriptorSet const& rhs ) const { return ( sType == rhs.sType ) @@ -9438,11 +9693,16 @@ public: return *this; } - operator const VkBufferViewCreateInfo&() const + operator VkBufferViewCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkBufferViewCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BufferViewCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9517,11 +9777,16 @@ public: return *this; } - operator const VkShaderModuleCreateInfo&() const + operator VkShaderModuleCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkShaderModuleCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ShaderModuleCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9592,11 +9857,16 @@ public: return *this; } - operator const VkDescriptorSetAllocateInfo&() const + operator VkDescriptorSetAllocateInfo const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetAllocateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetAllocateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9683,11 +9953,16 @@ public: return *this; } - operator const VkPipelineVertexInputStateCreateInfo&() const + operator VkPipelineVertexInputStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineVertexInputStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineVertexInputStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9762,11 +10037,16 @@ public: return *this; } - operator const VkPipelineInputAssemblyStateCreateInfo&() const + operator VkPipelineInputAssemblyStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineInputAssemblyStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineInputAssemblyStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9829,11 +10109,16 @@ public: return *this; } - operator const VkPipelineTessellationStateCreateInfo&() const + operator VkPipelineTessellationStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineTessellationStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineTessellationStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -9918,11 +10203,16 @@ public: return *this; } - operator const VkPipelineViewportStateCreateInfo&() const + operator VkPipelineViewportStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineViewportStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineViewportStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10061,11 +10351,16 @@ public: return *this; } - operator const VkPipelineRasterizationStateCreateInfo&() const + operator VkPipelineRasterizationStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineRasterizationStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineRasterizationStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10208,11 +10503,16 @@ public: return *this; } - operator const VkPipelineDepthStencilStateCreateInfo&() const + operator VkPipelineDepthStencilStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineDepthStencilStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineDepthStencilStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10297,11 +10597,16 @@ public: return *this; } - operator const VkPipelineCacheCreateInfo&() const + operator VkPipelineCacheCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineCacheCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineCacheCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10476,11 +10781,16 @@ public: return *this; } - operator const VkSamplerCreateInfo&() const + operator VkSamplerCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkSamplerCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SamplerCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10577,11 +10887,16 @@ public: return *this; } - operator const VkCommandBufferAllocateInfo&() const + operator VkCommandBufferAllocateInfo const&() const { return *reinterpret_cast(this); } + operator VkCommandBufferAllocateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( CommandBufferAllocateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10668,11 +10983,16 @@ public: return *this; } - operator const VkRenderPassBeginInfo&() const + operator VkRenderPassBeginInfo const&() const { return *reinterpret_cast(this); } + operator VkRenderPassBeginInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( RenderPassBeginInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10731,11 +11051,16 @@ public: return *this; } - operator const VkEventCreateInfo&() const + operator VkEventCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkEventCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( EventCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10786,11 +11111,16 @@ public: return *this; } - operator const VkSemaphoreCreateInfo&() const + operator VkSemaphoreCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkSemaphoreCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SemaphoreCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10889,11 +11219,16 @@ public: return *this; } - operator const VkFramebufferCreateInfo&() const + operator VkFramebufferCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkFramebufferCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( FramebufferCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -10964,11 +11299,16 @@ public: return *this; } - operator const VkDisplayModeCreateInfoKHR&() const + operator VkDisplayModeCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayModeCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayModeCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11037,11 +11377,16 @@ public: return *this; } - operator const VkDisplayPresentInfoKHR&() const + operator VkDisplayPresentInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPresentInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPresentInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11105,11 +11450,16 @@ public: return *this; } - operator const VkAndroidSurfaceCreateInfoKHR&() const + operator VkAndroidSurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkAndroidSurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( AndroidSurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11180,11 +11530,16 @@ public: return *this; } - operator const VkMirSurfaceCreateInfoKHR&() const + operator VkMirSurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkMirSurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( MirSurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11249,11 +11604,16 @@ public: return *this; } - operator const VkViSurfaceCreateInfoNN&() const + operator VkViSurfaceCreateInfoNN const&() const { return *reinterpret_cast(this); } + operator VkViSurfaceCreateInfoNN &() + { + return *reinterpret_cast(this); + } + bool operator==( ViSurfaceCreateInfoNN const& rhs ) const { return ( sType == rhs.sType ) @@ -11324,11 +11684,16 @@ public: return *this; } - operator const VkWaylandSurfaceCreateInfoKHR&() const + operator VkWaylandSurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkWaylandSurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( WaylandSurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11401,11 +11766,16 @@ public: return *this; } - operator const VkWin32SurfaceCreateInfoKHR&() const + operator VkWin32SurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkWin32SurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( Win32SurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11478,11 +11848,16 @@ public: return *this; } - operator const VkXlibSurfaceCreateInfoKHR&() const + operator VkXlibSurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkXlibSurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( XlibSurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11555,11 +11930,16 @@ public: return *this; } - operator const VkXcbSurfaceCreateInfoKHR&() const + operator VkXcbSurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkXcbSurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( XcbSurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -11623,11 +12003,16 @@ public: return *this; } - operator const VkDebugMarkerMarkerInfoEXT&() const + operator VkDebugMarkerMarkerInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugMarkerMarkerInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugMarkerMarkerInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -11680,11 +12065,16 @@ public: return *this; } - operator const VkDedicatedAllocationImageCreateInfoNV&() const + operator VkDedicatedAllocationImageCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkDedicatedAllocationImageCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( DedicatedAllocationImageCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -11735,11 +12125,16 @@ public: return *this; } - operator const VkDedicatedAllocationBufferCreateInfoNV&() const + operator VkDedicatedAllocationBufferCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkDedicatedAllocationBufferCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( DedicatedAllocationBufferCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -11798,11 +12193,16 @@ public: return *this; } - operator const VkDedicatedAllocationMemoryAllocateInfoNV&() const + operator VkDedicatedAllocationMemoryAllocateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkDedicatedAllocationMemoryAllocateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( DedicatedAllocationMemoryAllocateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -11864,11 +12264,16 @@ public: return *this; } - operator const VkExportMemoryWin32HandleInfoNV&() const + operator VkExportMemoryWin32HandleInfoNV const&() const { return *reinterpret_cast(this); } + operator VkExportMemoryWin32HandleInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportMemoryWin32HandleInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -11971,11 +12376,16 @@ public: return *this; } - operator const VkWin32KeyedMutexAcquireReleaseInfoNV&() const + operator VkWin32KeyedMutexAcquireReleaseInfoNV const&() const { return *reinterpret_cast(this); } + operator VkWin32KeyedMutexAcquireReleaseInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( Win32KeyedMutexAcquireReleaseInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -12039,11 +12449,16 @@ public: return *this; } - operator const VkDeviceGeneratedCommandsFeaturesNVX&() const + operator VkDeviceGeneratedCommandsFeaturesNVX const&() const { return *reinterpret_cast(this); } + operator VkDeviceGeneratedCommandsFeaturesNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGeneratedCommandsFeaturesNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -12126,11 +12541,16 @@ public: return *this; } - operator const VkDeviceGeneratedCommandsLimitsNVX&() const + operator VkDeviceGeneratedCommandsLimitsNVX const&() const { return *reinterpret_cast(this); } + operator VkDeviceGeneratedCommandsLimitsNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGeneratedCommandsLimitsNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -12205,11 +12625,16 @@ public: return *this; } - operator const VkCmdReserveSpaceForCommandsInfoNVX&() const + operator VkCmdReserveSpaceForCommandsInfoNVX const&() const { return *reinterpret_cast(this); } + operator VkCmdReserveSpaceForCommandsInfoNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( CmdReserveSpaceForCommandsInfoNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -12264,11 +12689,16 @@ public: return *this; } - operator const VkPhysicalDeviceFeatures2&() const + operator VkPhysicalDeviceFeatures2 const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceFeatures2 &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceFeatures2 const& rhs ) const { return ( sType == rhs.sType ) @@ -12321,11 +12751,16 @@ public: return *this; } - operator const VkPhysicalDevicePushDescriptorPropertiesKHR&() const + operator VkPhysicalDevicePushDescriptorPropertiesKHR const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDevicePushDescriptorPropertiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDevicePushDescriptorPropertiesKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12384,11 +12819,16 @@ public: return *this; } - operator const VkPresentRegionsKHR&() const + operator VkPresentRegionsKHR const&() const { return *reinterpret_cast(this); } + operator VkPresentRegionsKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( PresentRegionsKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12449,11 +12889,16 @@ public: return *this; } - operator const VkPhysicalDeviceVariablePointerFeatures&() const + operator VkPhysicalDeviceVariablePointerFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceVariablePointerFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceVariablePointerFeatures const& rhs ) const { return ( sType == rhs.sType ) @@ -12481,11 +12926,16 @@ public: struct PhysicalDeviceIDProperties { - operator const VkPhysicalDeviceIDProperties&() const + operator VkPhysicalDeviceIDProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceIDProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceIDProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -12563,11 +13013,16 @@ public: return *this; } - operator const VkExportMemoryWin32HandleInfoKHR&() const + operator VkExportMemoryWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkExportMemoryWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportMemoryWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12597,11 +13052,16 @@ public: #ifdef VK_USE_PLATFORM_WIN32_KHR struct MemoryWin32HandlePropertiesKHR { - operator const VkMemoryWin32HandlePropertiesKHR&() const + operator VkMemoryWin32HandlePropertiesKHR const&() const { return *reinterpret_cast(this); } + operator VkMemoryWin32HandlePropertiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryWin32HandlePropertiesKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12626,11 +13086,16 @@ public: struct MemoryFdPropertiesKHR { - operator const VkMemoryFdPropertiesKHR&() const + operator VkMemoryFdPropertiesKHR const&() const { return *reinterpret_cast(this); } + operator VkMemoryFdPropertiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryFdPropertiesKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12730,11 +13195,16 @@ public: return *this; } - operator const VkWin32KeyedMutexAcquireReleaseInfoKHR&() const + operator VkWin32KeyedMutexAcquireReleaseInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkWin32KeyedMutexAcquireReleaseInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( Win32KeyedMutexAcquireReleaseInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12815,11 +13285,16 @@ public: return *this; } - operator const VkExportSemaphoreWin32HandleInfoKHR&() const + operator VkExportSemaphoreWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkExportSemaphoreWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportSemaphoreWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12900,11 +13375,16 @@ public: return *this; } - operator const VkD3D12FenceSubmitInfoKHR&() const + operator VkD3D12FenceSubmitInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkD3D12FenceSubmitInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( D3D12FenceSubmitInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -12979,11 +13459,16 @@ public: return *this; } - operator const VkExportFenceWin32HandleInfoKHR&() const + operator VkExportFenceWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkExportFenceWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportFenceWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -13055,11 +13540,16 @@ public: return *this; } - operator const VkPhysicalDeviceMultiviewFeatures&() const + operator VkPhysicalDeviceMultiviewFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceMultiviewFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceMultiviewFeatures const& rhs ) const { return ( sType == rhs.sType ) @@ -13089,11 +13579,16 @@ public: struct PhysicalDeviceMultiviewProperties { - operator const VkPhysicalDeviceMultiviewProperties&() const + operator VkPhysicalDeviceMultiviewProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceMultiviewProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceMultiviewProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -13188,11 +13683,16 @@ public: return *this; } - operator const VkRenderPassMultiviewCreateInfo&() const + operator VkRenderPassMultiviewCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkRenderPassMultiviewCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( RenderPassMultiviewCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13271,11 +13771,16 @@ public: return *this; } - operator const VkBindBufferMemoryInfo&() const + operator VkBindBufferMemoryInfo const&() const { return *reinterpret_cast(this); } + operator VkBindBufferMemoryInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BindBufferMemoryInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13340,11 +13845,16 @@ public: return *this; } - operator const VkBindBufferMemoryDeviceGroupInfo&() const + operator VkBindBufferMemoryDeviceGroupInfo const&() const { return *reinterpret_cast(this); } + operator VkBindBufferMemoryDeviceGroupInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BindBufferMemoryDeviceGroupInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13415,11 +13925,16 @@ public: return *this; } - operator const VkBindImageMemoryInfo&() const + operator VkBindImageMemoryInfo const&() const { return *reinterpret_cast(this); } + operator VkBindImageMemoryInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BindImageMemoryInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13500,11 +14015,16 @@ public: return *this; } - operator const VkBindImageMemoryDeviceGroupInfo&() const + operator VkBindImageMemoryDeviceGroupInfo const&() const { return *reinterpret_cast(this); } + operator VkBindImageMemoryDeviceGroupInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BindImageMemoryDeviceGroupInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13579,11 +14099,16 @@ public: return *this; } - operator const VkDeviceGroupRenderPassBeginInfo&() const + operator VkDeviceGroupRenderPassBeginInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupRenderPassBeginInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupRenderPassBeginInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13640,11 +14165,16 @@ public: return *this; } - operator const VkDeviceGroupCommandBufferBeginInfo&() const + operator VkDeviceGroupCommandBufferBeginInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupCommandBufferBeginInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupCommandBufferBeginInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13737,11 +14267,16 @@ public: return *this; } - operator const VkDeviceGroupSubmitInfo&() const + operator VkDeviceGroupSubmitInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupSubmitInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupSubmitInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13812,11 +14347,16 @@ public: return *this; } - operator const VkDeviceGroupBindSparseInfo&() const + operator VkDeviceGroupBindSparseInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupBindSparseInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupBindSparseInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -13871,11 +14411,16 @@ public: return *this; } - operator const VkImageSwapchainCreateInfoKHR&() const + operator VkImageSwapchainCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImageSwapchainCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageSwapchainCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -13934,11 +14479,16 @@ public: return *this; } - operator const VkBindImageMemorySwapchainInfoKHR&() const + operator VkBindImageMemorySwapchainInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkBindImageMemorySwapchainInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( BindImageMemorySwapchainInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -14023,11 +14573,16 @@ public: return *this; } - operator const VkAcquireNextImageInfoKHR&() const + operator VkAcquireNextImageInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkAcquireNextImageInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( AcquireNextImageInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -14142,11 +14697,16 @@ public: return *this; } - operator const VkHdrMetadataEXT&() const + operator VkHdrMetadataEXT const&() const { return *reinterpret_cast(this); } + operator VkHdrMetadataEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( HdrMetadataEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -14219,11 +14779,16 @@ public: return *this; } - operator const VkPresentTimesInfoGOOGLE&() const + operator VkPresentTimesInfoGOOGLE const&() const { return *reinterpret_cast(this); } + operator VkPresentTimesInfoGOOGLE &() + { + return *reinterpret_cast(this); + } + bool operator==( PresentTimesInfoGOOGLE const& rhs ) const { return ( sType == rhs.sType ) @@ -14285,11 +14850,16 @@ public: return *this; } - operator const VkIOSSurfaceCreateInfoMVK&() const + operator VkIOSSurfaceCreateInfoMVK const&() const { return *reinterpret_cast(this); } + operator VkIOSSurfaceCreateInfoMVK &() + { + return *reinterpret_cast(this); + } + bool operator==( IOSSurfaceCreateInfoMVK const& rhs ) const { return ( sType == rhs.sType ) @@ -14352,11 +14922,16 @@ public: return *this; } - operator const VkMacOSSurfaceCreateInfoMVK&() const + operator VkMacOSSurfaceCreateInfoMVK const&() const { return *reinterpret_cast(this); } + operator VkMacOSSurfaceCreateInfoMVK &() + { + return *reinterpret_cast(this); + } + bool operator==( MacOSSurfaceCreateInfoMVK const& rhs ) const { return ( sType == rhs.sType ) @@ -14426,11 +15001,16 @@ public: return *this; } - operator const VkPipelineViewportWScalingStateCreateInfoNV&() const + operator VkPipelineViewportWScalingStateCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkPipelineViewportWScalingStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineViewportWScalingStateCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -14485,11 +15065,16 @@ public: return *this; } - operator const VkPhysicalDeviceDiscardRectanglePropertiesEXT&() const + operator VkPhysicalDeviceDiscardRectanglePropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceDiscardRectanglePropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceDiscardRectanglePropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -14513,11 +15098,16 @@ public: struct PhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { - operator const VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX&() const + operator VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceMultiviewPerViewAttributesPropertiesNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -14568,11 +15158,16 @@ public: return *this; } - operator const VkPhysicalDeviceSurfaceInfo2KHR&() const + operator VkPhysicalDeviceSurfaceInfo2KHR const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSurfaceInfo2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSurfaceInfo2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -14596,11 +15191,16 @@ public: struct DisplayPlaneProperties2KHR { - operator const VkDisplayPlaneProperties2KHR&() const + operator VkDisplayPlaneProperties2KHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPlaneProperties2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPlaneProperties2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -14624,11 +15224,16 @@ public: struct DisplayModeProperties2KHR { - operator const VkDisplayModeProperties2KHR&() const + operator VkDisplayModeProperties2KHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayModeProperties2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayModeProperties2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -14687,11 +15292,16 @@ public: return *this; } - operator const VkDisplayPlaneInfo2KHR&() const + operator VkDisplayPlaneInfo2KHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPlaneInfo2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPlaneInfo2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -14768,11 +15378,16 @@ public: return *this; } - operator const VkPhysicalDevice16BitStorageFeatures&() const + operator VkPhysicalDevice16BitStorageFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDevice16BitStorageFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDevice16BitStorageFeatures const& rhs ) const { return ( sType == rhs.sType ) @@ -14831,11 +15446,16 @@ public: return *this; } - operator const VkBufferMemoryRequirementsInfo2&() const + operator VkBufferMemoryRequirementsInfo2 const&() const { return *reinterpret_cast(this); } + operator VkBufferMemoryRequirementsInfo2 &() + { + return *reinterpret_cast(this); + } + bool operator==( BufferMemoryRequirementsInfo2 const& rhs ) const { return ( sType == rhs.sType ) @@ -14888,11 +15508,16 @@ public: return *this; } - operator const VkImageMemoryRequirementsInfo2&() const + operator VkImageMemoryRequirementsInfo2 const&() const { return *reinterpret_cast(this); } + operator VkImageMemoryRequirementsInfo2 &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageMemoryRequirementsInfo2 const& rhs ) const { return ( sType == rhs.sType ) @@ -14945,11 +15570,16 @@ public: return *this; } - operator const VkImageSparseMemoryRequirementsInfo2&() const + operator VkImageSparseMemoryRequirementsInfo2 const&() const { return *reinterpret_cast(this); } + operator VkImageSparseMemoryRequirementsInfo2 &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageSparseMemoryRequirementsInfo2 const& rhs ) const { return ( sType == rhs.sType ) @@ -14975,11 +15605,16 @@ public: struct MemoryRequirements2 { - operator const VkMemoryRequirements2&() const + operator VkMemoryRequirements2 const&() const { return *reinterpret_cast(this); } + operator VkMemoryRequirements2 &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryRequirements2 const& rhs ) const { return ( sType == rhs.sType ) @@ -15005,11 +15640,16 @@ public: struct MemoryDedicatedRequirements { - operator const VkMemoryDedicatedRequirements&() const + operator VkMemoryDedicatedRequirements const&() const { return *reinterpret_cast(this); } + operator VkMemoryDedicatedRequirements &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryDedicatedRequirements const& rhs ) const { return ( sType == rhs.sType ) @@ -15072,11 +15712,16 @@ public: return *this; } - operator const VkMemoryDedicatedAllocateInfo&() const + operator VkMemoryDedicatedAllocateInfo const&() const { return *reinterpret_cast(this); } + operator VkMemoryDedicatedAllocateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryDedicatedAllocateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -15131,11 +15776,16 @@ public: return *this; } - operator const VkSamplerYcbcrConversionInfo&() const + operator VkSamplerYcbcrConversionInfo const&() const { return *reinterpret_cast(this); } + operator VkSamplerYcbcrConversionInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SamplerYcbcrConversionInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -15188,11 +15838,16 @@ public: return *this; } - operator const VkPhysicalDeviceSamplerYcbcrConversionFeatures&() const + operator VkPhysicalDeviceSamplerYcbcrConversionFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSamplerYcbcrConversionFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSamplerYcbcrConversionFeatures const& rhs ) const { return ( sType == rhs.sType ) @@ -15218,11 +15873,16 @@ public: struct SamplerYcbcrConversionImageFormatProperties { - operator const VkSamplerYcbcrConversionImageFormatProperties&() const + operator VkSamplerYcbcrConversionImageFormatProperties const&() const { return *reinterpret_cast(this); } + operator VkSamplerYcbcrConversionImageFormatProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( SamplerYcbcrConversionImageFormatProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -15248,11 +15908,16 @@ public: struct TextureLODGatherFormatPropertiesAMD { - operator const VkTextureLODGatherFormatPropertiesAMD&() const + operator VkTextureLODGatherFormatPropertiesAMD const&() const { return *reinterpret_cast(this); } + operator VkTextureLODGatherFormatPropertiesAMD &() + { + return *reinterpret_cast(this); + } + bool operator==( TextureLODGatherFormatPropertiesAMD const& rhs ) const { return ( sType == rhs.sType ) @@ -15303,11 +15968,16 @@ public: return *this; } - operator const VkProtectedSubmitInfo&() const + operator VkProtectedSubmitInfo const&() const { return *reinterpret_cast(this); } + operator VkProtectedSubmitInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ProtectedSubmitInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -15358,11 +16028,16 @@ public: return *this; } - operator const VkPhysicalDeviceProtectedMemoryFeatures&() const + operator VkPhysicalDeviceProtectedMemoryFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceProtectedMemoryFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceProtectedMemoryFeatures const& rhs ) const { return ( sType == rhs.sType ) @@ -15413,11 +16088,16 @@ public: return *this; } - operator const VkPhysicalDeviceProtectedMemoryProperties&() const + operator VkPhysicalDeviceProtectedMemoryProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceProtectedMemoryProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceProtectedMemoryProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -15484,11 +16164,16 @@ public: return *this; } - operator const VkPipelineCoverageToColorStateCreateInfoNV&() const + operator VkPipelineCoverageToColorStateCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkPipelineCoverageToColorStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineCoverageToColorStateCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -15516,11 +16201,16 @@ public: struct PhysicalDeviceSamplerFilterMinmaxPropertiesEXT { - operator const VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT&() const + operator VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSamplerFilterMinmaxPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -15546,11 +16236,16 @@ public: struct MultisamplePropertiesEXT { - operator const VkMultisamplePropertiesEXT&() const + operator VkMultisamplePropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkMultisamplePropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( MultisamplePropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -15601,11 +16296,16 @@ public: return *this; } - operator const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT&() const + operator VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceBlendOperationAdvancedFeaturesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -15629,11 +16329,16 @@ public: struct PhysicalDeviceBlendOperationAdvancedPropertiesEXT { - operator const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT&() const + operator VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceBlendOperationAdvancedPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -15702,11 +16407,16 @@ public: return *this; } - operator const VkImageFormatListCreateInfoKHR&() const + operator VkImageFormatListCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImageFormatListCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageFormatListCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -15775,11 +16485,16 @@ public: return *this; } - operator const VkValidationCacheCreateInfoEXT&() const + operator VkValidationCacheCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkValidationCacheCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( ValidationCacheCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -15834,11 +16549,16 @@ public: return *this; } - operator const VkShaderModuleValidationCacheCreateInfoEXT&() const + operator VkShaderModuleValidationCacheCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkShaderModuleValidationCacheCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( ShaderModuleValidationCacheCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -15862,11 +16582,16 @@ public: struct PhysicalDeviceMaintenance3Properties { - operator const VkPhysicalDeviceMaintenance3Properties&() const + operator VkPhysicalDeviceMaintenance3Properties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceMaintenance3Properties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceMaintenance3Properties const& rhs ) const { return ( sType == rhs.sType ) @@ -15894,11 +16619,16 @@ public: struct DescriptorSetLayoutSupport { - operator const VkDescriptorSetLayoutSupport&() const + operator VkDescriptorSetLayoutSupport const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetLayoutSupport &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetLayoutSupport const& rhs ) const { return ( sType == rhs.sType ) @@ -15951,11 +16681,16 @@ public: return *this; } - operator const VkPhysicalDeviceShaderDrawParameterFeatures&() const + operator VkPhysicalDeviceShaderDrawParameterFeatures const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceShaderDrawParameterFeatures &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceShaderDrawParameterFeatures const& rhs ) const { return ( sType == rhs.sType ) @@ -16014,11 +16749,16 @@ public: return *this; } - operator const VkDebugUtilsLabelEXT&() const + operator VkDebugUtilsLabelEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugUtilsLabelEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugUtilsLabelEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16071,11 +16811,16 @@ public: return *this; } - operator const VkMemoryHostPointerPropertiesEXT&() const + operator VkMemoryHostPointerPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkMemoryHostPointerPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryHostPointerPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16126,11 +16871,16 @@ public: return *this; } - operator const VkPhysicalDeviceExternalMemoryHostPropertiesEXT&() const + operator VkPhysicalDeviceExternalMemoryHostPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceExternalMemoryHostPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceExternalMemoryHostPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16245,11 +16995,16 @@ public: return *this; } - operator const VkPhysicalDeviceConservativeRasterizationPropertiesEXT&() const + operator VkPhysicalDeviceConservativeRasterizationPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceConservativeRasterizationPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceConservativeRasterizationPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16289,11 +17044,16 @@ public: struct PhysicalDeviceShaderCorePropertiesAMD { - operator const VkPhysicalDeviceShaderCorePropertiesAMD&() const + operator VkPhysicalDeviceShaderCorePropertiesAMD const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceShaderCorePropertiesAMD &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceShaderCorePropertiesAMD const& rhs ) const { return ( sType == rhs.sType ) @@ -16522,11 +17282,16 @@ public: return *this; } - operator const VkPhysicalDeviceDescriptorIndexingFeaturesEXT&() const + operator VkPhysicalDeviceDescriptorIndexingFeaturesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceDescriptorIndexingFeaturesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceDescriptorIndexingFeaturesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16588,11 +17353,16 @@ public: struct PhysicalDeviceDescriptorIndexingPropertiesEXT { - operator const VkPhysicalDeviceDescriptorIndexingPropertiesEXT&() const + operator VkPhysicalDeviceDescriptorIndexingPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceDescriptorIndexingPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceDescriptorIndexingPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16695,11 +17465,16 @@ public: return *this; } - operator const VkDescriptorSetVariableDescriptorCountAllocateInfoEXT&() const + operator VkDescriptorSetVariableDescriptorCountAllocateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetVariableDescriptorCountAllocateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetVariableDescriptorCountAllocateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16725,11 +17500,16 @@ public: struct DescriptorSetVariableDescriptorCountLayoutSupportEXT { - operator const VkDescriptorSetVariableDescriptorCountLayoutSupportEXT&() const + operator VkDescriptorSetVariableDescriptorCountLayoutSupportEXT const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetVariableDescriptorCountLayoutSupportEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetVariableDescriptorCountLayoutSupportEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16773,11 +17553,16 @@ public: return *this; } - operator const VkSubpassEndInfoKHR&() const + operator VkSubpassEndInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkSubpassEndInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassEndInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -16834,11 +17619,16 @@ public: return *this; } - operator const VkPipelineVertexInputDivisorStateCreateInfoEXT&() const + operator VkPipelineVertexInputDivisorStateCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkPipelineVertexInputDivisorStateCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineVertexInputDivisorStateCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16891,11 +17681,16 @@ public: return *this; } - operator const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT&() const + operator VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceVertexAttributeDivisorPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -16947,11 +17742,16 @@ public: return *this; } - operator const VkImportAndroidHardwareBufferInfoANDROID&() const + operator VkImportAndroidHardwareBufferInfoANDROID const&() const { return *reinterpret_cast(this); } + operator VkImportAndroidHardwareBufferInfoANDROID &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportAndroidHardwareBufferInfoANDROID const& rhs ) const { return ( sType == rhs.sType ) @@ -16977,11 +17777,16 @@ public: #ifdef VK_USE_PLATFORM_ANDROID_ANDROID struct AndroidHardwareBufferUsageANDROID { - operator const VkAndroidHardwareBufferUsageANDROID&() const + operator VkAndroidHardwareBufferUsageANDROID const&() const { return *reinterpret_cast(this); } + operator VkAndroidHardwareBufferUsageANDROID &() + { + return *reinterpret_cast(this); + } + bool operator==( AndroidHardwareBufferUsageANDROID const& rhs ) const { return ( sType == rhs.sType ) @@ -17007,11 +17812,16 @@ public: #ifdef VK_USE_PLATFORM_ANDROID_ANDROID struct AndroidHardwareBufferPropertiesANDROID { - operator const VkAndroidHardwareBufferPropertiesANDROID&() const + operator VkAndroidHardwareBufferPropertiesANDROID const&() const { return *reinterpret_cast(this); } + operator VkAndroidHardwareBufferPropertiesANDROID &() + { + return *reinterpret_cast(this); + } + bool operator==( AndroidHardwareBufferPropertiesANDROID const& rhs ) const { return ( sType == rhs.sType ) @@ -17066,11 +17876,16 @@ public: return *this; } - operator const VkMemoryGetAndroidHardwareBufferInfoANDROID&() const + operator VkMemoryGetAndroidHardwareBufferInfoANDROID const&() const { return *reinterpret_cast(this); } + operator VkMemoryGetAndroidHardwareBufferInfoANDROID &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryGetAndroidHardwareBufferInfoANDROID const& rhs ) const { return ( sType == rhs.sType ) @@ -17122,11 +17937,16 @@ public: return *this; } - operator const VkCommandBufferInheritanceConditionalRenderingInfoEXT&() const + operator VkCommandBufferInheritanceConditionalRenderingInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkCommandBufferInheritanceConditionalRenderingInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( CommandBufferInheritanceConditionalRenderingInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -17178,11 +17998,16 @@ public: return *this; } - operator const VkExternalFormatANDROID&() const + operator VkExternalFormatANDROID const&() const { return *reinterpret_cast(this); } + operator VkExternalFormatANDROID &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalFormatANDROID const& rhs ) const { return ( sType == rhs.sType ) @@ -17250,11 +18075,16 @@ public: return *this; } - operator const VkPhysicalDevice8BitStorageFeaturesKHR&() const + operator VkPhysicalDevice8BitStorageFeaturesKHR const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDevice8BitStorageFeaturesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDevice8BitStorageFeaturesKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -17317,11 +18147,16 @@ public: return *this; } - operator const VkPhysicalDeviceConditionalRenderingFeaturesEXT&() const + operator VkPhysicalDeviceConditionalRenderingFeaturesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceConditionalRenderingFeaturesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceConditionalRenderingFeaturesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -17380,11 +18215,16 @@ public: return *this; } - operator const VkSubpassBeginInfoKHR&() const + operator VkSubpassBeginInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkSubpassBeginInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassBeginInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -17475,11 +18315,16 @@ public: return *this; } - operator const VkPresentInfoKHR&() const + operator VkPresentInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkPresentInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( PresentInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -17572,11 +18417,16 @@ public: return *this; } - operator const VkPipelineDynamicStateCreateInfo&() const + operator VkPipelineDynamicStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineDynamicStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineDynamicStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -17694,11 +18544,16 @@ public: return *this; } - operator const VkDescriptorUpdateTemplateCreateInfo&() const + operator VkDescriptorUpdateTemplateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkDescriptorUpdateTemplateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorUpdateTemplateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -17824,11 +18679,16 @@ public: return *this; } - operator const VkDebugUtilsObjectNameInfoEXT&() const + operator VkDebugUtilsObjectNameInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugUtilsObjectNameInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugUtilsObjectNameInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -17915,11 +18775,16 @@ public: return *this; } - operator const VkDebugUtilsObjectTagInfoEXT&() const + operator VkDebugUtilsObjectTagInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugUtilsObjectTagInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugUtilsObjectTagInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -18050,11 +18915,16 @@ public: return *this; } - operator const VkDebugUtilsMessengerCallbackDataEXT&() const + operator VkDebugUtilsMessengerCallbackDataEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugUtilsMessengerCallbackDataEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugUtilsMessengerCallbackDataEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -18125,11 +18995,16 @@ public: struct QueueFamilyProperties { - operator const VkQueueFamilyProperties&() const + operator VkQueueFamilyProperties const&() const { return *reinterpret_cast(this); } + operator VkQueueFamilyProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( QueueFamilyProperties const& rhs ) const { return ( queueFlags == rhs.queueFlags ) @@ -18152,11 +19027,16 @@ public: struct QueueFamilyProperties2 { - operator const VkQueueFamilyProperties2&() const + operator VkQueueFamilyProperties2 const&() const { return *reinterpret_cast(this); } + operator VkQueueFamilyProperties2 &() + { + return *reinterpret_cast(this); + } + bool operator==( QueueFamilyProperties2 const& rhs ) const { return ( sType == rhs.sType ) @@ -18258,11 +19138,16 @@ public: return *this; } - operator const VkDeviceQueueCreateInfo&() const + operator VkDeviceQueueCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceQueueCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceQueueCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -18375,11 +19260,16 @@ public: return *this; } - operator const VkDeviceCreateInfo&() const + operator VkDeviceCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -18460,11 +19350,16 @@ public: return *this; } - operator const VkDeviceQueueInfo2&() const + operator VkDeviceQueueInfo2 const&() const { return *reinterpret_cast(this); } + operator VkDeviceQueueInfo2 &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceQueueInfo2 const& rhs ) const { return ( sType == rhs.sType ) @@ -18522,11 +19417,16 @@ public: struct MemoryType { - operator const VkMemoryType&() const + operator VkMemoryType const&() const { return *reinterpret_cast(this); } + operator VkMemoryType &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryType const& rhs ) const { return ( propertyFlags == rhs.propertyFlags ) @@ -18572,11 +19472,16 @@ public: struct MemoryHeap { - operator const VkMemoryHeap&() const + operator VkMemoryHeap const&() const { return *reinterpret_cast(this); } + operator VkMemoryHeap &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryHeap const& rhs ) const { return ( size == rhs.size ) @@ -18595,11 +19500,16 @@ public: struct PhysicalDeviceMemoryProperties { - operator const VkPhysicalDeviceMemoryProperties&() const + operator VkPhysicalDeviceMemoryProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceMemoryProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceMemoryProperties const& rhs ) const { return ( memoryTypeCount == rhs.memoryTypeCount ) @@ -18622,11 +19532,16 @@ public: struct PhysicalDeviceMemoryProperties2 { - operator const VkPhysicalDeviceMemoryProperties2&() const + operator VkPhysicalDeviceMemoryProperties2 const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceMemoryProperties2 &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceMemoryProperties2 const& rhs ) const { return ( sType == rhs.sType ) @@ -18732,11 +19647,16 @@ public: return *this; } - operator const VkMemoryBarrier&() const + operator VkMemoryBarrier const&() const { return *reinterpret_cast(this); } + operator VkMemoryBarrier &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryBarrier const& rhs ) const { return ( sType == rhs.sType ) @@ -18837,11 +19757,16 @@ public: return *this; } - operator const VkBufferMemoryBarrier&() const + operator VkBufferMemoryBarrier const&() const { return *reinterpret_cast(this); } + operator VkBufferMemoryBarrier &() + { + return *reinterpret_cast(this); + } + bool operator==( BufferMemoryBarrier const& rhs ) const { return ( sType == rhs.sType ) @@ -19006,11 +19931,16 @@ public: return *this; } - operator const VkBufferCreateInfo&() const + operator VkBufferCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkBufferCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BufferCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -19129,11 +20059,16 @@ public: return *this; } - operator const VkDescriptorSetLayoutBinding&() const + operator VkDescriptorSetLayoutBinding const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetLayoutBinding &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetLayoutBinding const& rhs ) const { return ( binding == rhs.binding ) @@ -19217,11 +20152,16 @@ public: return *this; } - operator const VkPipelineShaderStageCreateInfo&() const + operator VkPipelineShaderStageCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineShaderStageCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineShaderStageCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -19290,11 +20230,16 @@ public: return *this; } - operator const VkPushConstantRange&() const + operator VkPushConstantRange const&() const { return *reinterpret_cast(this); } + operator VkPushConstantRange &() + { + return *reinterpret_cast(this); + } + bool operator==( PushConstantRange const& rhs ) const { return ( stageFlags == rhs.stageFlags ) @@ -19374,11 +20319,16 @@ public: return *this; } - operator const VkPipelineLayoutCreateInfo&() const + operator VkPipelineLayoutCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineLayoutCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineLayoutCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -19410,11 +20360,16 @@ public: struct ShaderStatisticsInfoAMD { - operator const VkShaderStatisticsInfoAMD&() const + operator VkShaderStatisticsInfoAMD const&() const { return *reinterpret_cast(this); } + operator VkShaderStatisticsInfoAMD &() + { + return *reinterpret_cast(this); + } + bool operator==( ShaderStatisticsInfoAMD const& rhs ) const { return ( shaderStageMask == rhs.shaderStageMask ) @@ -19475,11 +20430,16 @@ public: struct SharedPresentSurfaceCapabilitiesKHR { - operator const VkSharedPresentSurfaceCapabilitiesKHR&() const + operator VkSharedPresentSurfaceCapabilitiesKHR const&() const { return *reinterpret_cast(this); } + operator VkSharedPresentSurfaceCapabilitiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SharedPresentSurfaceCapabilitiesKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -19530,11 +20490,16 @@ public: return *this; } - operator const VkImageViewUsageCreateInfo&() const + operator VkImageViewUsageCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkImageViewUsageCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageViewUsageCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -19662,11 +20627,16 @@ public: return *this; } - operator const VkPhysicalDeviceImageFormatInfo2&() const + operator VkPhysicalDeviceImageFormatInfo2 const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceImageFormatInfo2 &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceImageFormatInfo2 const& rhs ) const { return ( sType == rhs.sType ) @@ -19790,11 +20760,16 @@ public: return *this; } - operator const VkComputePipelineCreateInfo&() const + operator VkComputePipelineCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkComputePipelineCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ComputePipelineCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -19931,11 +20906,16 @@ public: return *this; } - operator const VkPipelineColorBlendAttachmentState&() const + operator VkPipelineColorBlendAttachmentState const&() const { return *reinterpret_cast(this); } + operator VkPipelineColorBlendAttachmentState &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineColorBlendAttachmentState const& rhs ) const { return ( blendEnable == rhs.blendEnable ) @@ -20033,11 +21013,16 @@ public: return *this; } - operator const VkPipelineColorBlendStateCreateInfo&() const + operator VkPipelineColorBlendStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineColorBlendStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineColorBlendStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -20123,11 +21108,16 @@ public: return *this; } - operator const VkFenceCreateInfo&() const + operator VkFenceCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkFenceCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( FenceCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -20208,11 +21198,16 @@ public: struct FormatProperties { - operator const VkFormatProperties&() const + operator VkFormatProperties const&() const { return *reinterpret_cast(this); } + operator VkFormatProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( FormatProperties const& rhs ) const { return ( linearTilingFeatures == rhs.linearTilingFeatures ) @@ -20233,11 +21228,16 @@ public: struct FormatProperties2 { - operator const VkFormatProperties2&() const + operator VkFormatProperties2 const&() const { return *reinterpret_cast(this); } + operator VkFormatProperties2 &() + { + return *reinterpret_cast(this); + } + bool operator==( FormatProperties2 const& rhs ) const { return ( sType == rhs.sType ) @@ -20445,11 +21445,16 @@ public: return *this; } - operator const VkCommandBufferInheritanceInfo&() const + operator VkCommandBufferInheritanceInfo const&() const { return *reinterpret_cast(this); } + operator VkCommandBufferInheritanceInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( CommandBufferInheritanceInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -20518,11 +21523,16 @@ public: return *this; } - operator const VkCommandBufferBeginInfo&() const + operator VkCommandBufferBeginInfo const&() const { return *reinterpret_cast(this); } + operator VkCommandBufferBeginInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( CommandBufferBeginInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -20599,11 +21609,16 @@ public: return *this; } - operator const VkQueryPoolCreateInfo&() const + operator VkQueryPoolCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkQueryPoolCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( QueryPoolCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -20704,11 +21719,16 @@ public: return *this; } - operator const VkImageSubresource&() const + operator VkImageSubresource const&() const { return *reinterpret_cast(this); } + operator VkImageSubresource &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageSubresource const& rhs ) const { return ( aspectMask == rhs.aspectMask ) @@ -20774,11 +21794,16 @@ public: return *this; } - operator const VkImageSubresourceLayers&() const + operator VkImageSubresourceLayers const&() const { return *reinterpret_cast(this); } + operator VkImageSubresourceLayers &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageSubresourceLayers const& rhs ) const { return ( aspectMask == rhs.aspectMask ) @@ -20854,11 +21879,16 @@ public: return *this; } - operator const VkImageSubresourceRange&() const + operator VkImageSubresourceRange const&() const { return *reinterpret_cast(this); } + operator VkImageSubresourceRange &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageSubresourceRange const& rhs ) const { return ( aspectMask == rhs.aspectMask ) @@ -20966,11 +21996,16 @@ public: return *this; } - operator const VkImageMemoryBarrier&() const + operator VkImageMemoryBarrier const&() const { return *reinterpret_cast(this); } + operator VkImageMemoryBarrier &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageMemoryBarrier const& rhs ) const { return ( sType == rhs.sType ) @@ -21075,11 +22110,16 @@ public: return *this; } - operator const VkImageViewCreateInfo&() const + operator VkImageViewCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkImageViewCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageViewCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -21166,11 +22206,16 @@ public: return *this; } - operator const VkImageCopy&() const + operator VkImageCopy const&() const { return *reinterpret_cast(this); } + operator VkImageCopy &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageCopy const& rhs ) const { return ( srcSubresource == rhs.srcSubresource ) @@ -21240,11 +22285,16 @@ public: return *this; } - operator const VkImageBlit&() const + operator VkImageBlit const&() const { return *reinterpret_cast(this); } + operator VkImageBlit &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageBlit const& rhs ) const { return ( srcSubresource == rhs.srcSubresource ) @@ -21328,11 +22378,16 @@ public: return *this; } - operator const VkBufferImageCopy&() const + operator VkBufferImageCopy const&() const { return *reinterpret_cast(this); } + operator VkBufferImageCopy &() + { + return *reinterpret_cast(this); + } + bool operator==( BufferImageCopy const& rhs ) const { return ( bufferOffset == rhs.bufferOffset ) @@ -21412,11 +22467,16 @@ public: return *this; } - operator const VkImageResolve&() const + operator VkImageResolve const&() const { return *reinterpret_cast(this); } + operator VkImageResolve &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageResolve const& rhs ) const { return ( srcSubresource == rhs.srcSubresource ) @@ -21478,11 +22538,16 @@ public: return *this; } - operator const VkClearAttachment&() const + operator VkClearAttachment const&() const { return *reinterpret_cast(this); } + operator VkClearAttachment &() + { + return *reinterpret_cast(this); + } + ImageAspectFlags aspectMask; uint32_t colorAttachment; ClearValue clearValue; @@ -21528,11 +22593,16 @@ public: return *this; } - operator const VkInputAttachmentAspectReference&() const + operator VkInputAttachmentAspectReference const&() const { return *reinterpret_cast(this); } + operator VkInputAttachmentAspectReference &() + { + return *reinterpret_cast(this); + } + bool operator==( InputAttachmentAspectReference const& rhs ) const { return ( subpass == rhs.subpass ) @@ -21590,11 +22660,16 @@ public: return *this; } - operator const VkRenderPassInputAttachmentAspectCreateInfo&() const + operator VkRenderPassInputAttachmentAspectCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkRenderPassInputAttachmentAspectCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( RenderPassInputAttachmentAspectCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -21649,11 +22724,16 @@ public: return *this; } - operator const VkBindImagePlaneMemoryInfo&() const + operator VkBindImagePlaneMemoryInfo const&() const { return *reinterpret_cast(this); } + operator VkBindImagePlaneMemoryInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BindImagePlaneMemoryInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -21706,11 +22786,16 @@ public: return *this; } - operator const VkImagePlaneMemoryRequirementsInfo&() const + operator VkImagePlaneMemoryRequirementsInfo const&() const { return *reinterpret_cast(this); } + operator VkImagePlaneMemoryRequirementsInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ImagePlaneMemoryRequirementsInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -21779,11 +22864,16 @@ public: return *this; } - operator const VkAttachmentReference2KHR&() const + operator VkAttachmentReference2KHR const&() const { return *reinterpret_cast(this); } + operator VkAttachmentReference2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( AttachmentReference2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -21838,11 +22928,16 @@ public: struct SparseImageFormatProperties { - operator const VkSparseImageFormatProperties&() const + operator VkSparseImageFormatProperties const&() const { return *reinterpret_cast(this); } + operator VkSparseImageFormatProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageFormatProperties const& rhs ) const { return ( aspectMask == rhs.aspectMask ) @@ -21863,11 +22958,16 @@ public: struct SparseImageMemoryRequirements { - operator const VkSparseImageMemoryRequirements&() const + operator VkSparseImageMemoryRequirements const&() const { return *reinterpret_cast(this); } + operator VkSparseImageMemoryRequirements &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageMemoryRequirements const& rhs ) const { return ( formatProperties == rhs.formatProperties ) @@ -21892,11 +22992,16 @@ public: struct SparseImageFormatProperties2 { - operator const VkSparseImageFormatProperties2&() const + operator VkSparseImageFormatProperties2 const&() const { return *reinterpret_cast(this); } + operator VkSparseImageFormatProperties2 &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageFormatProperties2 const& rhs ) const { return ( sType == rhs.sType ) @@ -21922,11 +23027,16 @@ public: struct SparseImageMemoryRequirements2 { - operator const VkSparseImageMemoryRequirements2&() const + operator VkSparseImageMemoryRequirements2 const&() const { return *reinterpret_cast(this); } + operator VkSparseImageMemoryRequirements2 &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageMemoryRequirements2 const& rhs ) const { return ( sType == rhs.sType ) @@ -22030,11 +23140,16 @@ public: return *this; } - operator const VkSparseMemoryBind&() const + operator VkSparseMemoryBind const&() const { return *reinterpret_cast(this); } + operator VkSparseMemoryBind &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseMemoryBind const& rhs ) const { return ( resourceOffset == rhs.resourceOffset ) @@ -22120,11 +23235,16 @@ public: return *this; } - operator const VkSparseImageMemoryBind&() const + operator VkSparseImageMemoryBind const&() const { return *reinterpret_cast(this); } + operator VkSparseImageMemoryBind &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageMemoryBind const& rhs ) const { return ( subresource == rhs.subresource ) @@ -22188,11 +23308,16 @@ public: return *this; } - operator const VkSparseBufferMemoryBindInfo&() const + operator VkSparseBufferMemoryBindInfo const&() const { return *reinterpret_cast(this); } + operator VkSparseBufferMemoryBindInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseBufferMemoryBindInfo const& rhs ) const { return ( buffer == rhs.buffer ) @@ -22250,11 +23375,16 @@ public: return *this; } - operator const VkSparseImageOpaqueMemoryBindInfo&() const + operator VkSparseImageOpaqueMemoryBindInfo const&() const { return *reinterpret_cast(this); } + operator VkSparseImageOpaqueMemoryBindInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageOpaqueMemoryBindInfo const& rhs ) const { return ( image == rhs.image ) @@ -22312,11 +23442,16 @@ public: return *this; } - operator const VkSparseImageMemoryBindInfo&() const + operator VkSparseImageMemoryBindInfo const&() const { return *reinterpret_cast(this); } + operator VkSparseImageMemoryBindInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SparseImageMemoryBindInfo const& rhs ) const { return ( image == rhs.image ) @@ -22436,11 +23571,16 @@ public: return *this; } - operator const VkBindSparseInfo&() const + operator VkBindSparseInfo const&() const { return *reinterpret_cast(this); } + operator VkBindSparseInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( BindSparseInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -22525,11 +23665,16 @@ public: struct QueueFamilyCheckpointPropertiesNV { - operator const VkQueueFamilyCheckpointPropertiesNV&() const + operator VkQueueFamilyCheckpointPropertiesNV const&() const { return *reinterpret_cast(this); } + operator VkQueueFamilyCheckpointPropertiesNV &() + { + return *reinterpret_cast(this); + } + bool operator==( QueueFamilyCheckpointPropertiesNV const& rhs ) const { return ( sType == rhs.sType ) @@ -22553,11 +23698,16 @@ public: struct CheckpointDataNV { - operator const VkCheckpointDataNV&() const + operator VkCheckpointDataNV const&() const { return *reinterpret_cast(this); } + operator VkCheckpointDataNV &() + { + return *reinterpret_cast(this); + } + bool operator==( CheckpointDataNV const& rhs ) const { return ( sType == rhs.sType ) @@ -22645,11 +23795,16 @@ public: return *this; } - operator const VkCommandPoolCreateInfo&() const + operator VkCommandPoolCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkCommandPoolCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( CommandPoolCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -22756,11 +23911,16 @@ public: struct ImageFormatProperties { - operator const VkImageFormatProperties&() const + operator VkImageFormatProperties const&() const { return *reinterpret_cast(this); } + operator VkImageFormatProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageFormatProperties const& rhs ) const { return ( maxExtent == rhs.maxExtent ) @@ -22908,11 +24068,16 @@ public: return *this; } - operator const VkImageCreateInfo&() const + operator VkImageCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkImageCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -23035,11 +24200,16 @@ public: return *this; } - operator const VkPipelineMultisampleStateCreateInfo&() const + operator VkPipelineMultisampleStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineMultisampleStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineMultisampleStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -23230,11 +24400,16 @@ public: return *this; } - operator const VkGraphicsPipelineCreateInfo&() const + operator VkGraphicsPipelineCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkGraphicsPipelineCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( GraphicsPipelineCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -23290,11 +24465,16 @@ public: struct PhysicalDeviceLimits { - operator const VkPhysicalDeviceLimits&() const + operator VkPhysicalDeviceLimits const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceLimits &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceLimits const& rhs ) const { return ( maxImageDimension1D == rhs.maxImageDimension1D ) @@ -23521,11 +24701,16 @@ public: struct PhysicalDeviceProperties { - operator const VkPhysicalDeviceProperties&() const + operator VkPhysicalDeviceProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceProperties const& rhs ) const { return ( apiVersion == rhs.apiVersion ) @@ -23558,11 +24743,16 @@ public: struct PhysicalDeviceProperties2 { - operator const VkPhysicalDeviceProperties2&() const + operator VkPhysicalDeviceProperties2 const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceProperties2 &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceProperties2 const& rhs ) const { return ( sType == rhs.sType ) @@ -23588,11 +24778,16 @@ public: struct ImageFormatProperties2 { - operator const VkImageFormatProperties2&() const + operator VkImageFormatProperties2 const&() const { return *reinterpret_cast(this); } + operator VkImageFormatProperties2 &() + { + return *reinterpret_cast(this); + } + bool operator==( ImageFormatProperties2 const& rhs ) const { return ( sType == rhs.sType ) @@ -23677,11 +24872,16 @@ public: return *this; } - operator const VkPhysicalDeviceSparseImageFormatInfo2&() const + operator VkPhysicalDeviceSparseImageFormatInfo2 const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSparseImageFormatInfo2 &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSparseImageFormatInfo2 const& rhs ) const { return ( sType == rhs.sType ) @@ -23766,11 +24966,16 @@ public: return *this; } - operator const VkSampleLocationsInfoEXT&() const + operator VkSampleLocationsInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkSampleLocationsInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( SampleLocationsInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -23829,11 +25034,16 @@ public: return *this; } - operator const VkAttachmentSampleLocationsEXT&() const + operator VkAttachmentSampleLocationsEXT const&() const { return *reinterpret_cast(this); } + operator VkAttachmentSampleLocationsEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( AttachmentSampleLocationsEXT const& rhs ) const { return ( attachmentIndex == rhs.attachmentIndex ) @@ -23881,11 +25091,16 @@ public: return *this; } - operator const VkSubpassSampleLocationsEXT&() const + operator VkSubpassSampleLocationsEXT const&() const { return *reinterpret_cast(this); } + operator VkSubpassSampleLocationsEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassSampleLocationsEXT const& rhs ) const { return ( subpassIndex == rhs.subpassIndex ) @@ -23955,11 +25170,16 @@ public: return *this; } - operator const VkRenderPassSampleLocationsBeginInfoEXT&() const + operator VkRenderPassSampleLocationsBeginInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkRenderPassSampleLocationsBeginInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( RenderPassSampleLocationsBeginInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -24024,11 +25244,16 @@ public: return *this; } - operator const VkPipelineSampleLocationsStateCreateInfoEXT&() const + operator VkPipelineSampleLocationsStateCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkPipelineSampleLocationsStateCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineSampleLocationsStateCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -24054,11 +25279,16 @@ public: struct PhysicalDeviceSampleLocationsPropertiesEXT { - operator const VkPhysicalDeviceSampleLocationsPropertiesEXT&() const + operator VkPhysicalDeviceSampleLocationsPropertiesEXT const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSampleLocationsPropertiesEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSampleLocationsPropertiesEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -24200,11 +25430,16 @@ public: return *this; } - operator const VkAttachmentDescription&() const + operator VkAttachmentDescription const&() const { return *reinterpret_cast(this); } + operator VkAttachmentDescription &() + { + return *reinterpret_cast(this); + } + bool operator==( AttachmentDescription const& rhs ) const { return ( flags == rhs.flags ) @@ -24328,11 +25563,16 @@ public: return *this; } - operator const VkAttachmentDescription2KHR&() const + operator VkAttachmentDescription2KHR const&() const { return *reinterpret_cast(this); } + operator VkAttachmentDescription2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( AttachmentDescription2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -24476,11 +25716,16 @@ public: return *this; } - operator const VkDescriptorPoolCreateInfo&() const + operator VkDescriptorPoolCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkDescriptorPoolCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorPoolCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -24608,11 +25853,16 @@ public: return *this; } - operator const VkSubpassDependency&() const + operator VkSubpassDependency const&() const { return *reinterpret_cast(this); } + operator VkSubpassDependency &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassDependency const& rhs ) const { return ( srcSubpass == rhs.srcSubpass ) @@ -24724,11 +25974,16 @@ public: return *this; } - operator const VkSubpassDependency2KHR&() const + operator VkSubpassDependency2KHR const&() const { return *reinterpret_cast(this); } + operator VkSubpassDependency2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassDependency2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -24796,11 +26051,16 @@ public: struct SurfaceFormatKHR { - operator const VkSurfaceFormatKHR&() const + operator VkSurfaceFormatKHR const&() const { return *reinterpret_cast(this); } + operator VkSurfaceFormatKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SurfaceFormatKHR const& rhs ) const { return ( format == rhs.format ) @@ -24819,11 +26079,16 @@ public: struct SurfaceFormat2KHR { - operator const VkSurfaceFormat2KHR&() const + operator VkSurfaceFormat2KHR const&() const { return *reinterpret_cast(this); } + operator VkSurfaceFormat2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SurfaceFormat2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -24875,11 +26140,16 @@ public: struct DisplayPlaneCapabilitiesKHR { - operator const VkDisplayPlaneCapabilitiesKHR&() const + operator VkDisplayPlaneCapabilitiesKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPlaneCapabilitiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPlaneCapabilitiesKHR const& rhs ) const { return ( supportedAlpha == rhs.supportedAlpha ) @@ -24912,11 +26182,16 @@ public: struct DisplayPlaneCapabilities2KHR { - operator const VkDisplayPlaneCapabilities2KHR&() const + operator VkDisplayPlaneCapabilities2KHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPlaneCapabilities2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPlaneCapabilities2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -25001,11 +26276,16 @@ public: struct DisplayPropertiesKHR { - operator const VkDisplayPropertiesKHR&() const + operator VkDisplayPropertiesKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayPropertiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPropertiesKHR const& rhs ) const { return ( display == rhs.display ) @@ -25117,11 +26397,16 @@ public: return *this; } - operator const VkDisplaySurfaceCreateInfoKHR&() const + operator VkDisplaySurfaceCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkDisplaySurfaceCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplaySurfaceCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -25159,11 +26444,16 @@ public: struct SurfaceCapabilitiesKHR { - operator const VkSurfaceCapabilitiesKHR&() const + operator VkSurfaceCapabilitiesKHR const&() const { return *reinterpret_cast(this); } + operator VkSurfaceCapabilitiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SurfaceCapabilitiesKHR const& rhs ) const { return ( minImageCount == rhs.minImageCount ) @@ -25198,11 +26488,16 @@ public: struct SurfaceCapabilities2KHR { - operator const VkSurfaceCapabilities2KHR&() const + operator VkSurfaceCapabilities2KHR const&() const { return *reinterpret_cast(this); } + operator VkSurfaceCapabilities2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SurfaceCapabilities2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -25226,11 +26521,16 @@ public: struct DisplayProperties2KHR { - operator const VkDisplayProperties2KHR&() const + operator VkDisplayProperties2KHR const&() const { return *reinterpret_cast(this); } + operator VkDisplayProperties2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayProperties2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -25326,11 +26626,16 @@ public: return *this; } - operator const VkDebugReportCallbackCreateInfoEXT&() const + operator VkDebugReportCallbackCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugReportCallbackCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugReportCallbackCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -25445,11 +26750,16 @@ public: return *this; } - operator const VkDebugMarkerObjectNameInfoEXT&() const + operator VkDebugMarkerObjectNameInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugMarkerObjectNameInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugMarkerObjectNameInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -25536,11 +26846,16 @@ public: return *this; } - operator const VkDebugMarkerObjectTagInfoEXT&() const + operator VkDebugMarkerObjectTagInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugMarkerObjectTagInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugMarkerObjectTagInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -25605,11 +26920,16 @@ public: return *this; } - operator const VkPipelineRasterizationStateRasterizationOrderAMD&() const + operator VkPipelineRasterizationStateRasterizationOrderAMD const&() const { return *reinterpret_cast(this); } + operator VkPipelineRasterizationStateRasterizationOrderAMD &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineRasterizationStateRasterizationOrderAMD const& rhs ) const { return ( sType == rhs.sType ) @@ -25688,11 +27008,16 @@ public: return *this; } - operator const VkExternalMemoryImageCreateInfoNV&() const + operator VkExternalMemoryImageCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkExternalMemoryImageCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalMemoryImageCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -25743,11 +27068,16 @@ public: return *this; } - operator const VkExportMemoryAllocateInfoNV&() const + operator VkExportMemoryAllocateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkExportMemoryAllocateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportMemoryAllocateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -25807,11 +27137,16 @@ public: return *this; } - operator const VkImportMemoryWin32HandleInfoNV&() const + operator VkImportMemoryWin32HandleInfoNV const&() const { return *reinterpret_cast(this); } + operator VkImportMemoryWin32HandleInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportMemoryWin32HandleInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -25865,11 +27200,16 @@ public: struct ExternalImageFormatPropertiesNV { - operator const VkExternalImageFormatPropertiesNV&() const + operator VkExternalImageFormatPropertiesNV const&() const { return *reinterpret_cast(this); } + operator VkExternalImageFormatPropertiesNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalImageFormatPropertiesNV const& rhs ) const { return ( imageFormatProperties == rhs.imageFormatProperties ) @@ -25933,11 +27273,16 @@ public: return *this; } - operator const VkValidationFlagsEXT&() const + operator VkValidationFlagsEXT const&() const { return *reinterpret_cast(this); } + operator VkValidationFlagsEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( ValidationFlagsEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -25996,11 +27341,16 @@ public: struct PhysicalDeviceSubgroupProperties { - operator const VkPhysicalDeviceSubgroupProperties&() const + operator VkPhysicalDeviceSubgroupProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceSubgroupProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceSubgroupProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -26133,11 +27483,16 @@ public: return *this; } - operator const VkIndirectCommandsTokenNVX&() const + operator VkIndirectCommandsTokenNVX const&() const { return *reinterpret_cast(this); } + operator VkIndirectCommandsTokenNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( IndirectCommandsTokenNVX const& rhs ) const { return ( tokenType == rhs.tokenType ) @@ -26203,11 +27558,16 @@ public: return *this; } - operator const VkIndirectCommandsLayoutTokenNVX&() const + operator VkIndirectCommandsLayoutTokenNVX const&() const { return *reinterpret_cast(this); } + operator VkIndirectCommandsLayoutTokenNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( IndirectCommandsLayoutTokenNVX const& rhs ) const { return ( tokenType == rhs.tokenType ) @@ -26281,11 +27641,16 @@ public: return *this; } - operator const VkIndirectCommandsLayoutCreateInfoNVX&() const + operator VkIndirectCommandsLayoutCreateInfoNVX const&() const { return *reinterpret_cast(this); } + operator VkIndirectCommandsLayoutCreateInfoNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( IndirectCommandsLayoutCreateInfoNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -26415,11 +27780,16 @@ public: return *this; } - operator const VkObjectTableCreateInfoNVX&() const + operator VkObjectTableCreateInfoNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTableCreateInfoNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTableCreateInfoNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -26488,11 +27858,16 @@ public: return *this; } - operator const VkObjectTableEntryNVX&() const + operator VkObjectTableEntryNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTableEntryNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTableEntryNVX const& rhs ) const { return ( type == rhs.type ) @@ -26555,11 +27930,16 @@ public: return *this; } - operator const VkObjectTablePipelineEntryNVX&() const + operator VkObjectTablePipelineEntryNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTablePipelineEntryNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTablePipelineEntryNVX const& rhs ) const { return ( type == rhs.type ) @@ -26634,11 +28014,16 @@ public: return *this; } - operator const VkObjectTableDescriptorSetEntryNVX&() const + operator VkObjectTableDescriptorSetEntryNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTableDescriptorSetEntryNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTableDescriptorSetEntryNVX const& rhs ) const { return ( type == rhs.type ) @@ -26705,11 +28090,16 @@ public: return *this; } - operator const VkObjectTableVertexBufferEntryNVX&() const + operator VkObjectTableVertexBufferEntryNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTableVertexBufferEntryNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTableVertexBufferEntryNVX const& rhs ) const { return ( type == rhs.type ) @@ -26784,11 +28174,16 @@ public: return *this; } - operator const VkObjectTableIndexBufferEntryNVX&() const + operator VkObjectTableIndexBufferEntryNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTableIndexBufferEntryNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTableIndexBufferEntryNVX const& rhs ) const { return ( type == rhs.type ) @@ -26865,11 +28260,16 @@ public: return *this; } - operator const VkObjectTablePushConstantEntryNVX&() const + operator VkObjectTablePushConstantEntryNVX const&() const { return *reinterpret_cast(this); } + operator VkObjectTablePushConstantEntryNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( ObjectTablePushConstantEntryNVX const& rhs ) const { return ( type == rhs.type ) @@ -26961,11 +28361,16 @@ public: return *this; } - operator const VkDescriptorSetLayoutCreateInfo&() const + operator VkDescriptorSetLayoutCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetLayoutCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetLayoutCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27064,11 +28469,16 @@ public: return *this; } - operator const VkPhysicalDeviceExternalImageFormatInfo&() const + operator VkPhysicalDeviceExternalImageFormatInfo const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceExternalImageFormatInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceExternalImageFormatInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27137,11 +28547,16 @@ public: return *this; } - operator const VkPhysicalDeviceExternalBufferInfo&() const + operator VkPhysicalDeviceExternalBufferInfo const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceExternalBufferInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceExternalBufferInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27198,11 +28613,16 @@ public: return *this; } - operator const VkExternalMemoryImageCreateInfo&() const + operator VkExternalMemoryImageCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkExternalMemoryImageCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalMemoryImageCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27255,11 +28675,16 @@ public: return *this; } - operator const VkExternalMemoryBufferCreateInfo&() const + operator VkExternalMemoryBufferCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkExternalMemoryBufferCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalMemoryBufferCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27312,11 +28737,16 @@ public: return *this; } - operator const VkExportMemoryAllocateInfo&() const + operator VkExportMemoryAllocateInfo const&() const { return *reinterpret_cast(this); } + operator VkExportMemoryAllocateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportMemoryAllocateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27386,11 +28816,16 @@ public: return *this; } - operator const VkImportMemoryWin32HandleInfoKHR&() const + operator VkImportMemoryWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImportMemoryWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportMemoryWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -27455,11 +28890,16 @@ public: return *this; } - operator const VkMemoryGetWin32HandleInfoKHR&() const + operator VkMemoryGetWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkMemoryGetWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryGetWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -27521,11 +28961,16 @@ public: return *this; } - operator const VkImportMemoryFdInfoKHR&() const + operator VkImportMemoryFdInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImportMemoryFdInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportMemoryFdInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -27586,11 +29031,16 @@ public: return *this; } - operator const VkMemoryGetFdInfoKHR&() const + operator VkMemoryGetFdInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkMemoryGetFdInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryGetFdInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -27651,11 +29101,16 @@ public: return *this; } - operator const VkImportMemoryHostPointerInfoEXT&() const + operator VkImportMemoryHostPointerInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkImportMemoryHostPointerInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportMemoryHostPointerInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -27713,11 +29168,16 @@ public: struct ExternalMemoryProperties { - operator const VkExternalMemoryProperties&() const + operator VkExternalMemoryProperties const&() const { return *reinterpret_cast(this); } + operator VkExternalMemoryProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalMemoryProperties const& rhs ) const { return ( externalMemoryFeatures == rhs.externalMemoryFeatures ) @@ -27740,11 +29200,16 @@ public: struct ExternalImageFormatProperties { - operator const VkExternalImageFormatProperties&() const + operator VkExternalImageFormatProperties const&() const { return *reinterpret_cast(this); } + operator VkExternalImageFormatProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalImageFormatProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -27770,11 +29235,16 @@ public: struct ExternalBufferProperties { - operator const VkExternalBufferProperties&() const + operator VkExternalBufferProperties const&() const { return *reinterpret_cast(this); } + operator VkExternalBufferProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalBufferProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -27863,11 +29333,16 @@ public: return *this; } - operator const VkPhysicalDeviceExternalSemaphoreInfo&() const + operator VkPhysicalDeviceExternalSemaphoreInfo const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceExternalSemaphoreInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceExternalSemaphoreInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27920,11 +29395,16 @@ public: return *this; } - operator const VkExportSemaphoreCreateInfo&() const + operator VkExportSemaphoreCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkExportSemaphoreCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportSemaphoreCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -27986,11 +29466,16 @@ public: return *this; } - operator const VkSemaphoreGetWin32HandleInfoKHR&() const + operator VkSemaphoreGetWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkSemaphoreGetWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SemaphoreGetWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28052,11 +29537,16 @@ public: return *this; } - operator const VkSemaphoreGetFdInfoKHR&() const + operator VkSemaphoreGetFdInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkSemaphoreGetFdInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SemaphoreGetFdInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28112,11 +29602,16 @@ public: struct ExternalSemaphoreProperties { - operator const VkExternalSemaphoreProperties&() const + operator VkExternalSemaphoreProperties const&() const { return *reinterpret_cast(this); } + operator VkExternalSemaphoreProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalSemaphoreProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -28234,11 +29729,16 @@ public: return *this; } - operator const VkImportSemaphoreWin32HandleInfoKHR&() const + operator VkImportSemaphoreWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImportSemaphoreWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportSemaphoreWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28322,11 +29822,16 @@ public: return *this; } - operator const VkImportSemaphoreFdInfoKHR&() const + operator VkImportSemaphoreFdInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImportSemaphoreFdInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportSemaphoreFdInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28417,11 +29922,16 @@ public: return *this; } - operator const VkPhysicalDeviceExternalFenceInfo&() const + operator VkPhysicalDeviceExternalFenceInfo const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceExternalFenceInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceExternalFenceInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -28474,11 +29984,16 @@ public: return *this; } - operator const VkExportFenceCreateInfo&() const + operator VkExportFenceCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkExportFenceCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( ExportFenceCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -28540,11 +30055,16 @@ public: return *this; } - operator const VkFenceGetWin32HandleInfoKHR&() const + operator VkFenceGetWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkFenceGetWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( FenceGetWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28606,11 +30126,16 @@ public: return *this; } - operator const VkFenceGetFdInfoKHR&() const + operator VkFenceGetFdInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkFenceGetFdInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( FenceGetFdInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28666,11 +30191,16 @@ public: struct ExternalFenceProperties { - operator const VkExternalFenceProperties&() const + operator VkExternalFenceProperties const&() const { return *reinterpret_cast(this); } + operator VkExternalFenceProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( ExternalFenceProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -28788,11 +30318,16 @@ public: return *this; } - operator const VkImportFenceWin32HandleInfoKHR&() const + operator VkImportFenceWin32HandleInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImportFenceWin32HandleInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportFenceWin32HandleInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28876,11 +30411,16 @@ public: return *this; } - operator const VkImportFenceFdInfoKHR&() const + operator VkImportFenceFdInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkImportFenceFdInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( ImportFenceFdInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -28935,11 +30475,16 @@ public: struct SurfaceCapabilities2EXT { - operator const VkSurfaceCapabilities2EXT&() const + operator VkSurfaceCapabilities2EXT const&() const { return *reinterpret_cast(this); } + operator VkSurfaceCapabilities2EXT &() + { + return *reinterpret_cast(this); + } + bool operator==( SurfaceCapabilities2EXT const& rhs ) const { return ( sType == rhs.sType ) @@ -29010,11 +30555,16 @@ public: return *this; } - operator const VkSwapchainCounterCreateInfoEXT&() const + operator VkSwapchainCounterCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkSwapchainCounterCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( SwapchainCounterCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -29072,11 +30622,16 @@ public: return *this; } - operator const VkDisplayPowerInfoEXT&() const + operator VkDisplayPowerInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDisplayPowerInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayPowerInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -29132,11 +30687,16 @@ public: return *this; } - operator const VkDeviceEventInfoEXT&() const + operator VkDeviceEventInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDeviceEventInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceEventInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -29192,11 +30752,16 @@ public: return *this; } - operator const VkDisplayEventInfoEXT&() const + operator VkDisplayEventInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDisplayEventInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DisplayEventInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -29317,11 +30882,16 @@ public: return *this; } - operator const VkMemoryAllocateFlagsInfo&() const + operator VkMemoryAllocateFlagsInfo const&() const { return *reinterpret_cast(this); } + operator VkMemoryAllocateFlagsInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( MemoryAllocateFlagsInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -29377,11 +30947,16 @@ public: struct DeviceGroupPresentCapabilitiesKHR { - operator const VkDeviceGroupPresentCapabilitiesKHR&() const + operator VkDeviceGroupPresentCapabilitiesKHR const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupPresentCapabilitiesKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupPresentCapabilitiesKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -29450,11 +31025,16 @@ public: return *this; } - operator const VkDeviceGroupPresentInfoKHR&() const + operator VkDeviceGroupPresentInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupPresentInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupPresentInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -29509,11 +31089,16 @@ public: return *this; } - operator const VkDeviceGroupSwapchainCreateInfoKHR&() const + operator VkDeviceGroupSwapchainCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupSwapchainCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupSwapchainCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -29710,11 +31295,16 @@ public: return *this; } - operator const VkSwapchainCreateInfoKHR&() const + operator VkSwapchainCreateInfoKHR const&() const { return *reinterpret_cast(this); } + operator VkSwapchainCreateInfoKHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SwapchainCreateInfoKHR const& rhs ) const { return ( sType == rhs.sType ) @@ -29825,11 +31415,16 @@ public: return *this; } - operator const VkViewportSwizzleNV&() const + operator VkViewportSwizzleNV const&() const { return *reinterpret_cast(this); } + operator VkViewportSwizzleNV &() + { + return *reinterpret_cast(this); + } + bool operator==( ViewportSwizzleNV const& rhs ) const { return ( x == rhs.x ) @@ -29895,11 +31490,16 @@ public: return *this; } - operator const VkPipelineViewportSwizzleStateCreateInfoNV&() const + operator VkPipelineViewportSwizzleStateCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkPipelineViewportSwizzleStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineViewportSwizzleStateCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -29984,11 +31584,16 @@ public: return *this; } - operator const VkPipelineDiscardRectangleStateCreateInfoEXT&() const + operator VkPipelineDiscardRectangleStateCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkPipelineDiscardRectangleStateCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineDiscardRectangleStateCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -30137,11 +31742,16 @@ public: return *this; } - operator const VkSubpassDescription&() const + operator VkSubpassDescription const&() const { return *reinterpret_cast(this); } + operator VkSubpassDescription &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassDescription const& rhs ) const { return ( flags == rhs.flags ) @@ -30251,11 +31861,16 @@ public: return *this; } - operator const VkRenderPassCreateInfo&() const + operator VkRenderPassCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkRenderPassCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( RenderPassCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -30398,11 +32013,16 @@ public: return *this; } - operator const VkSubpassDescription2KHR&() const + operator VkSubpassDescription2KHR const&() const { return *reinterpret_cast(this); } + operator VkSubpassDescription2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( SubpassDescription2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -30537,11 +32157,16 @@ public: return *this; } - operator const VkRenderPassCreateInfo2KHR&() const + operator VkRenderPassCreateInfo2KHR const&() const { return *reinterpret_cast(this); } + operator VkRenderPassCreateInfo2KHR &() + { + return *reinterpret_cast(this); + } + bool operator==( RenderPassCreateInfo2KHR const& rhs ) const { return ( sType == rhs.sType ) @@ -30589,11 +32214,16 @@ public: struct PhysicalDevicePointClippingProperties { - operator const VkPhysicalDevicePointClippingProperties&() const + operator VkPhysicalDevicePointClippingProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDevicePointClippingProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDevicePointClippingProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -30653,11 +32283,16 @@ public: return *this; } - operator const VkSamplerReductionModeCreateInfoEXT&() const + operator VkSamplerReductionModeCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkSamplerReductionModeCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( SamplerReductionModeCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -30716,11 +32351,16 @@ public: return *this; } - operator const VkPipelineTessellationDomainOriginStateCreateInfo&() const + operator VkPipelineTessellationDomainOriginStateCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkPipelineTessellationDomainOriginStateCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineTessellationDomainOriginStateCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -30859,11 +32499,16 @@ public: return *this; } - operator const VkSamplerYcbcrConversionCreateInfo&() const + operator VkSamplerYcbcrConversionCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkSamplerYcbcrConversionCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SamplerYcbcrConversionCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -30904,11 +32549,16 @@ public: #ifdef VK_USE_PLATFORM_ANDROID_ANDROID struct AndroidHardwareBufferFormatPropertiesANDROID { - operator const VkAndroidHardwareBufferFormatPropertiesANDROID&() const + operator VkAndroidHardwareBufferFormatPropertiesANDROID const&() const { return *reinterpret_cast(this); } + operator VkAndroidHardwareBufferFormatPropertiesANDROID &() + { + return *reinterpret_cast(this); + } + bool operator==( AndroidHardwareBufferFormatPropertiesANDROID const& rhs ) const { return ( sType == rhs.sType ) @@ -30997,11 +32647,16 @@ public: return *this; } - operator const VkPipelineColorBlendAdvancedStateCreateInfoEXT&() const + operator VkPipelineColorBlendAdvancedStateCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkPipelineColorBlendAdvancedStateCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineColorBlendAdvancedStateCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -31096,11 +32751,16 @@ public: return *this; } - operator const VkPipelineCoverageModulationStateCreateInfoNV&() const + operator VkPipelineCoverageModulationStateCreateInfoNV const&() const { return *reinterpret_cast(this); } + operator VkPipelineCoverageModulationStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineCoverageModulationStateCreateInfoNV const& rhs ) const { return ( sType == rhs.sType ) @@ -31179,11 +32839,16 @@ public: return *this; } - operator const VkDeviceQueueGlobalPriorityCreateInfoEXT&() const + operator VkDeviceQueueGlobalPriorityCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDeviceQueueGlobalPriorityCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceQueueGlobalPriorityCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -31321,11 +32986,16 @@ public: return *this; } - operator const VkDebugUtilsMessengerCreateInfoEXT&() const + operator VkDebugUtilsMessengerCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDebugUtilsMessengerCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DebugUtilsMessengerCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -31407,11 +33077,16 @@ public: return *this; } - operator const VkPipelineRasterizationConservativeStateCreateInfoEXT&() const + operator VkPipelineRasterizationConservativeStateCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkPipelineRasterizationConservativeStateCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( PipelineRasterizationConservativeStateCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -31502,11 +33177,16 @@ public: return *this; } - operator const VkDescriptorSetLayoutBindingFlagsCreateInfoEXT&() const + operator VkDescriptorSetLayoutBindingFlagsCreateInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkDescriptorSetLayoutBindingFlagsCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( DescriptorSetLayoutBindingFlagsCreateInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -31607,11 +33287,16 @@ public: return *this; } - operator const VkConditionalRenderingBeginInfoEXT&() const + operator VkConditionalRenderingBeginInfoEXT const&() const { return *reinterpret_cast(this); } + operator VkConditionalRenderingBeginInfoEXT &() + { + return *reinterpret_cast(this); + } + bool operator==( ConditionalRenderingBeginInfoEXT const& rhs ) const { return ( sType == rhs.sType ) @@ -33275,11 +34960,16 @@ public: return *this; } - operator const VkSubmitInfo&() const + operator VkSubmitInfo const&() const { return *reinterpret_cast(this); } + operator VkSubmitInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( SubmitInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -39836,11 +41526,16 @@ public: return *this; } - operator const VkCmdProcessCommandsInfoNVX&() const + operator VkCmdProcessCommandsInfoNVX const&() const { return *reinterpret_cast(this); } + operator VkCmdProcessCommandsInfoNVX &() + { + return *reinterpret_cast(this); + } + bool operator==( CmdProcessCommandsInfoNVX const& rhs ) const { return ( sType == rhs.sType ) @@ -39882,11 +41577,16 @@ public: struct PhysicalDeviceGroupProperties { - operator const VkPhysicalDeviceGroupProperties&() const + operator VkPhysicalDeviceGroupProperties const&() const { return *reinterpret_cast(this); } + operator VkPhysicalDeviceGroupProperties &() + { + return *reinterpret_cast(this); + } + bool operator==( PhysicalDeviceGroupProperties const& rhs ) const { return ( sType == rhs.sType ) @@ -40819,11 +42519,16 @@ public: return *this; } - operator const VkDeviceGroupDeviceCreateInfo&() const + operator VkDeviceGroupDeviceCreateInfo const&() const { return *reinterpret_cast(this); } + operator VkDeviceGroupDeviceCreateInfo &() + { + return *reinterpret_cast(this); + } + bool operator==( DeviceGroupDeviceCreateInfo const& rhs ) const { return ( sType == rhs.sType ) @@ -40915,11 +42620,16 @@ public: return *this; } - operator const VkBaseOutStructure&() const + operator VkBaseOutStructure const&() const { return *reinterpret_cast(this); } + operator VkBaseOutStructure &() + { + return *reinterpret_cast(this); + } + bool operator==( BaseOutStructure const& rhs ) const { return ( sType == rhs.sType ) @@ -40958,11 +42668,16 @@ public: return *this; } - operator const VkBaseInStructure&() const + operator VkBaseInStructure const&() const { return *reinterpret_cast(this); } + operator VkBaseInStructure &() + { + return *reinterpret_cast(this); + } + bool operator==( BaseInStructure const& rhs ) const { return ( sType == rhs.sType ) From 1944b56b9fc7579829cda957a60f7020f747667b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 18 Sep 2018 16:56:44 +0200 Subject: [PATCH 3/8] Corrected handling of aliased structure types; (#251) Improved checking in enum/bitmask handling. --- VulkanHppGenerator.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 879f56f..2048ffa 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1947,11 +1947,19 @@ void VulkanHppGenerator::readEnums(tinyxml2::XMLElement const* element) { checkAttributes(attributes, element->GetLineNum(), { { "name",{} },{ "type",{ "bitmask", "enum" } } }, { { "comment",{} } }); // re-check with type as required - // add an empty DependencyData on this name into the dependencies list - m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, name)); + if (std::find_if(m_dependencies.begin(), m_dependencies.end(), [&name](DependencyData const& dd) { return dd.name == name; }) == m_dependencies.end()) + { + // add an empty DependencyData on this name into the dependencies list + m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, name)); + + // add this enum to the set of Vulkan data types + assert(m_vkTypes.find(name) == m_vkTypes.end()); + m_vkTypes.insert(name); + } // ad an empty EnumData on this name into the enums map std::map::iterator it = m_enums.insert(std::make_pair(name, EnumData(name))).first; + assert(it->second.postfix.empty() && it->second.prefix.empty() && it->second.protect.empty() && it->second.values.empty()); if (name == "Result") { @@ -2008,10 +2016,6 @@ void VulkanHppGenerator::readEnums(tinyxml2::XMLElement const* element) } #endif } - - // add this enum to the set of Vulkan data types - assert(m_vkTypes.find(name) == m_vkTypes.end()); - m_vkTypes.insert(name); } } @@ -2532,8 +2536,11 @@ void VulkanHppGenerator::readTypeBitmask(tinyxml2::XMLElement const* element, st { // Generate FlagBits name, add a DependencyData for that name, and add it to the list of enums and vulkan types requires = generateEnumNameForFlags(name); + assert(std::find_if(m_dependencies.begin(), m_dependencies.end(), [&requires](DependencyData const& dd) { return dd.name == requires; }) == m_dependencies.end()); m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, requires)); + assert(m_enums.find(requires) == m_enums.end()); m_enums.insert(std::make_pair(requires, EnumData(requires, true))); + assert(m_vkTypes.find(requires) == m_vkTypes.end()); m_vkTypes.insert(requires); } @@ -2695,6 +2702,8 @@ void VulkanHppGenerator::readTypeStruct(tinyxml2::XMLElement const* element, boo std::vector children = getChildElements(element); checkElements(children, { "comment", "member" }); + std::string name = strip(attributes.find("name")->second, "Vk"); + auto aliasIt = attributes.find("alias"); if (aliasIt != attributes.end()) { @@ -2703,16 +2712,12 @@ void VulkanHppGenerator::readTypeStruct(tinyxml2::XMLElement const* element, boo std::string alias = strip(aliasIt->second, "Vk"); checkAlias(m_structs, alias, element->GetLineNum()); - std::string name = strip(attributes.find("name")->second, "Vk"); - auto structsIt = m_structs.find(alias); assert((structsIt != m_structs.end()) && structsIt->second.alias.empty()); structsIt->second.alias = name; } else { - std::string name = strip(attributes.find("name")->second, "Vk"); - m_dependencies.push_back(DependencyData(isUnion ? DependencyData::Category::UNION : DependencyData::Category::STRUCT, name)); assert(m_structs.find(name) == m_structs.end()); @@ -2751,9 +2756,6 @@ void VulkanHppGenerator::readTypeStruct(tinyxml2::XMLElement const* element, boo #endif } - assert(m_vkTypes.find(name) == m_vkTypes.end()); - m_vkTypes.insert(name); - for (auto const& s : m_structs) { if (isSubStruct(s, name, it->second)) @@ -2763,6 +2765,9 @@ void VulkanHppGenerator::readTypeStruct(tinyxml2::XMLElement const* element, boo } } } + + assert(m_vkTypes.find(name) == m_vkTypes.end()); + m_vkTypes.insert(name); } void VulkanHppGenerator::readTypeStructMember(tinyxml2::XMLElement const* element, StructData & structData) From 1ddafc1c56c93739fa4a0ec2ddf7413c70054703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Wed, 19 Sep 2018 13:49:43 +0200 Subject: [PATCH 4/8] Corrected functions dealing with StructureChains. (#253) + adjusted readme.md accordingly + added (a first!) test project --- CMakeLists.txt | 8 +- README.md | 11 +- VulkanHppGenerator.cpp | 14 +-- tests/CMakeLists.txt | 45 ++++++++ tests/StructureChain/CMakeLists.txt | 35 ++++++ tests/StructureChain/StructureChain.cpp | 72 ++++++++++++ vulkan/vulkan.hpp | 140 ++++++++++++------------ 7 files changed, 244 insertions(+), 81 deletions(-) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/StructureChain/CMakeLists.txt create mode 100644 tests/StructureChain/StructureChain.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 520536b..2d9f4aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,11 @@ set_property(TARGET VulkanHppGenerator PROPERTY CXX_STANDARD 11) target_include_directories(VulkanHppGenerator PRIVATE "${CMAKE_SOURCE_DIR}/tinyxml2") option (SAMPLES_BUILD OFF) - if (SAMPLES_BUILD) add_subdirectory(samples) -endif (SAMPLES_BUILD) \ No newline at end of file +endif (SAMPLES_BUILD) + +option (TESTS_BUILD OFF) +if (TESTS_BUILD) + add_subdirectory(tests) +endif (TESTS_BUILD) \ No newline at end of file diff --git a/README.md b/README.md index 6dabff4..20d1242 100644 --- a/README.md +++ b/README.md @@ -191,15 +191,22 @@ vk::StructureChain c = }; ``` -Sometimes the user has to pass a preallocated structure chain to query information. In those cases the corresponding query functions are variadic templates and do accept a structure chain to construct the return value: +Sometimes the user has to pass a preallocated structure chain to query information. For those cases there are two corresponding getter functions. One with a variadic template generating a structure chain of at least two elements to construct the return value: ``` -// Query vk::MemoryRequirements2KHR and vk::MemoryDedicatedRequirementsKHR when calling Device::getBufferMemoryRequirements2KHR: +// Query vk::MemoryRequirements2HR and vk::MemoryDedicatedRequirementsKHR when calling Device::getBufferMemoryRequirements2KHR: auto result = device.getBufferMemoryRequirements2KHR({}); vk::MemoryRequirements2KHR &memReqs = result.get(); vk::MemoryDedicatedRequirementsKHR &dedMemReqs = result.get(); ``` +To get just the base structure, without chaining, the other getter function provided does not need a template argument for the structure to get: + +``` +// Query just vk::MemoryRequirements2KHR +vk::MemoryRequirements2KHR memoryRequirements = device.getBufferMemoryRequirements2KHR({}); +``` + ### Return values, Error Codes & Exceptions By default Vulkan-Hpp has exceptions enabled. This means that Vulkan-Hpp checks the return code of each function call which returns a Vk::Result. If Vk::Result is a failure a std::runtime_error will be thrown. Since there is no need to return the error code anymore the C++ bindings can now return the actual desired return value, i.e. a vulkan handle. In those cases ResultValue ::type is defined as the returned type. diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 2048ffa..9608f52 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -3425,7 +3425,7 @@ std::string VulkanHppGenerator::writeFunctionBodyEnhancedLocalReturnVariable(std { std::string const &pureType = commandData.params[commandData.returnParam].pureType; // For StructureChains use the template parameters - os << "StructureChain structureChain;" << std::endl; + os << "StructureChain structureChain;" << std::endl; returnName = stripPluralS(returnName); os << indentation << " " << pureType << "& " << returnName << " = structureChain.template get<" << pureType << ">()"; returnName = "structureChain"; @@ -3444,7 +3444,7 @@ std::string VulkanHppGenerator::writeFunctionBodyEnhancedLocalReturnVariable(std { std::string const &returnType = commandData.enhancedReturnType; // For StructureChains use the template parameters - os << "StructureChain structureChain;" << std::endl; + os << "StructureChain structureChain;" << std::endl; os << indentation << " " << returnType << "& " << returnName << " = structureChain.template get<" << returnType << ">()"; returnName = "structureChain"; } @@ -3963,7 +3963,7 @@ void VulkanHppGenerator::writeFunctionHeaderReturnType(std::ostream & os, Comman bool returnsVector = !singular && (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end()); templateString += returnsVector ? "ResultValueType,Allocator>>::type " : "typename ResultValueType>::type "; - returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; + returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; } else if ((commandData.enhancedReturnType != commandData.returnType) && (commandData.returnType != "void")) { @@ -3974,7 +3974,7 @@ void VulkanHppGenerator::writeFunctionHeaderReturnType(std::ostream & os, Comman // in singular case, we create the ResultValueType from the pure return type, otherwise from the enhanced return type if (isStructureChain) { - returnType = "StructureChain"; + returnType = "StructureChain"; } else { @@ -3986,13 +3986,13 @@ void VulkanHppGenerator::writeFunctionHeaderReturnType(std::ostream & os, Comman // if there is a return parameter at all, and there are multiple success codes, we return a ResultValue<...> with the pure return type assert(commandData.returnType == "Result"); templateString = "ResultValue<${returnType}> "; - returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; + returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; } else { // and in every other case, we just return the enhanced return type. templateString = "${returnType} "; - returnType = isStructureChain ? "StructureChain" : commandData.enhancedReturnType; + returnType = isStructureChain ? "StructureChain" : commandData.enhancedReturnType; } } else @@ -4009,7 +4009,7 @@ void VulkanHppGenerator::writeFunctionHeaderTemplate(std::ostream & os, std::str std::string dispatch = withDefault ? std::string("typename Dispatch = DispatchLoaderStatic") : std::string("typename Dispatch"); if (enhanced && isStructureChain) { - os << indentation << "template " << std::endl; + os << indentation << "template " << std::endl; } else if (enhanced && (commandData.templateParam != ~0) && ((commandData.templateParam != commandData.returnParam) || (commandData.enhancedReturnType == "Result"))) { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..c74563d --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.2) + +project(Vulkan-Hpp_Tests) + +option (TESTS_BUILD_WITH_LOCAL_VULKAN_HPP OFF) + +if (CMAKE_SYSTEM_NAME MATCHES "Windows") + add_definitions(-DNOMINMAX -DVK_USE_PLATFORM_WIN32_KHR) +else() + error("unhandled platform !") +endif() + +FILE (GLOB linkunits ${CMAKE_CURRENT_SOURCE_DIR}/*) + +if (TESTS_BUILD_WITH_LOCAL_VULKAN_HPP) + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Docs/include") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..") +else() + include_directories("$ENV{VK_SDK_PATH}/include") +endif() + +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../glm") + +FOREACH( linkunit ${linkunits} ) + if( IS_DIRECTORY ${linkunit} ) + if( EXISTS ${linkunit}/CMakeLists.txt ) + string( REGEX REPLACE "^.*/([^/]*)$" "\\1" LINK_NAME ${linkunit} ) + add_subdirectory( ${LINK_NAME} ) + endif() + endif() +ENDFOREACH( linkunit ${linkunits} ) diff --git a/tests/StructureChain/CMakeLists.txt b/tests/StructureChain/CMakeLists.txt new file mode 100644 index 0000000..46b8fa0 --- /dev/null +++ b/tests/StructureChain/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.2) + +project(StructureChain) + +set(HEADERS +) + +set(SOURCES + StructureChain.cpp +) + +source_group(headers FILES ${HEADERS}) +source_group(sources FILES ${SOURCES}) + +add_executable(StructureChain + ${HEADERS} + ${SOURCES} +) + +set_target_properties(StructureChain PROPERTIES FOLDER "Tests") +target_link_libraries(StructureChain "$ENV{VK_SDK_PATH}/Lib/vulkan-1.lib") diff --git a/tests/StructureChain/StructureChain.cpp b/tests/StructureChain/StructureChain.cpp new file mode 100644 index 0000000..dcbd32f --- /dev/null +++ b/tests/StructureChain/StructureChain.cpp @@ -0,0 +1,72 @@ +// Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// VulkanHpp Tests : StructureChain +// Compile-test for StructureChains + +#include "vulkan/vulkan.hpp" +#include + +static char const* AppName = "StructureChain"; +static char const* EngineName = "Vulkan.hpp"; + +#if defined(_MSC_VER) +#pragma warning( disable : 4189 ) +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wunused-variable" +#else +// unknow compiler... just ignore the warnings for yourselves ;) +#endif + +int main(int /*argc*/, char * /*argv[]*/) +{ + try + { + vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1); + vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo)); + std::vector physicalDevices = instance->enumeratePhysicalDevices(); + + vk::PhysicalDevice & pd = physicalDevices[0]; + + // simple call, passing structures in + vk::PhysicalDeviceFeatures2 pdf; + pd.getFeatures2(&pdf); + + vk::StructureChain z; + + // simple calls, getting structure back + vk::PhysicalDeviceFeatures2 a = pd.getFeatures2(); + vk::PhysicalDeviceFeatures2 b = pd.getFeatures2(vk::DispatchLoaderStatic()); + + // complex calls, getting StructureChain back + auto c = pd.getFeatures2(); + vk::PhysicalDeviceFeatures2 & c0 = c.get(); + vk::PhysicalDeviceVariablePointerFeatures & c1 = c.get(); + + auto d = pd.getFeatures2(vk::DispatchLoaderStatic()); + vk::PhysicalDeviceFeatures2 & d0 = d.get(); + vk::PhysicalDeviceVariablePointerFeatures & d1 = d.get(); + } + catch (vk::SystemError err) + { + std::cout << "vk::SystemError: " << err.what() << std::endl; + exit(-1); + } + catch (...) + { + std::cout << "unknown error\n"; + exit(-1); + } + return 0; +} diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 680e0ee..218499c 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -36488,8 +36488,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template MemoryRequirements2 getBufferMemoryRequirements2( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; - template - StructureChain getBufferMemoryRequirements2( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; + template + StructureChain getBufferMemoryRequirements2( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -36497,8 +36497,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template MemoryRequirements2 getBufferMemoryRequirements2KHR( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; - template - StructureChain getBufferMemoryRequirements2KHR( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; + template + StructureChain getBufferMemoryRequirements2KHR( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -36506,8 +36506,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template MemoryRequirements2 getImageMemoryRequirements2( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; - template - StructureChain getImageMemoryRequirements2( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; + template + StructureChain getImageMemoryRequirements2( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -36515,8 +36515,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template MemoryRequirements2 getImageMemoryRequirements2KHR( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; - template - StructureChain getImageMemoryRequirements2KHR( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; + template + StructureChain getImageMemoryRequirements2KHR( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -36627,8 +36627,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template DescriptorSetLayoutSupport getDescriptorSetLayoutSupport( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d = Dispatch() ) const; - template - StructureChain getDescriptorSetLayoutSupport( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d = Dispatch() ) const; + template + StructureChain getDescriptorSetLayoutSupport( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -36636,8 +36636,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template DescriptorSetLayoutSupport getDescriptorSetLayoutSupportKHR( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d = Dispatch() ) const; - template - StructureChain getDescriptorSetLayoutSupportKHR( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d = Dispatch() ) const; + template + StructureChain getDescriptorSetLayoutSupportKHR( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -36685,8 +36685,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template ResultValueType::type getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const &d = Dispatch() ) const; - template - typename ResultValueType>::type getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const &d = Dispatch() ) const; + template + typename ResultValueType>::type getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VK_USE_PLATFORM_ANDROID_ANDROID*/ @@ -39281,10 +39281,10 @@ public: d.vkGetBufferMemoryRequirements2( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return memoryRequirements; } - template - VULKAN_HPP_INLINE StructureChain Device::getBufferMemoryRequirements2( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain Device::getBufferMemoryRequirements2( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; MemoryRequirements2& memoryRequirements = structureChain.template get(); d.vkGetBufferMemoryRequirements2( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return structureChain; @@ -39304,10 +39304,10 @@ public: d.vkGetBufferMemoryRequirements2KHR( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return memoryRequirements; } - template - VULKAN_HPP_INLINE StructureChain Device::getBufferMemoryRequirements2KHR( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain Device::getBufferMemoryRequirements2KHR( const BufferMemoryRequirementsInfo2 & info, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; MemoryRequirements2& memoryRequirements = structureChain.template get(); d.vkGetBufferMemoryRequirements2KHR( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return structureChain; @@ -39327,10 +39327,10 @@ public: d.vkGetImageMemoryRequirements2( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return memoryRequirements; } - template - VULKAN_HPP_INLINE StructureChain Device::getImageMemoryRequirements2( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain Device::getImageMemoryRequirements2( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; MemoryRequirements2& memoryRequirements = structureChain.template get(); d.vkGetImageMemoryRequirements2( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return structureChain; @@ -39350,10 +39350,10 @@ public: d.vkGetImageMemoryRequirements2KHR( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return memoryRequirements; } - template - VULKAN_HPP_INLINE StructureChain Device::getImageMemoryRequirements2KHR( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain Device::getImageMemoryRequirements2KHR( const ImageMemoryRequirementsInfo2 & info, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; MemoryRequirements2& memoryRequirements = structureChain.template get(); d.vkGetImageMemoryRequirements2KHR( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); return structureChain; @@ -39608,10 +39608,10 @@ public: d.vkGetDescriptorSetLayoutSupport( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( &support ) ); return support; } - template - VULKAN_HPP_INLINE StructureChain Device::getDescriptorSetLayoutSupport( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain Device::getDescriptorSetLayoutSupport( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; DescriptorSetLayoutSupport& support = structureChain.template get(); d.vkGetDescriptorSetLayoutSupport( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( &support ) ); return structureChain; @@ -39631,10 +39631,10 @@ public: d.vkGetDescriptorSetLayoutSupportKHR( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( &support ) ); return support; } - template - VULKAN_HPP_INLINE StructureChain Device::getDescriptorSetLayoutSupportKHR( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain Device::getDescriptorSetLayoutSupportKHR( const DescriptorSetLayoutCreateInfo & createInfo, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; DescriptorSetLayoutSupport& support = structureChain.template get(); d.vkGetDescriptorSetLayoutSupportKHR( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( &support ) ); return structureChain; @@ -39751,10 +39751,10 @@ public: Result result = static_cast( d.vkGetAndroidHardwareBufferPropertiesANDROID( m_device, buffer, reinterpret_cast( &properties ) ) ); return createResultValue( result, properties, VULKAN_HPP_NAMESPACE_STRING"::Device::getAndroidHardwareBufferPropertiesANDROID" ); } - template - VULKAN_HPP_INLINE typename ResultValueType>::type Device::getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const &d ) const + template + VULKAN_HPP_INLINE typename ResultValueType>::type Device::getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; AndroidHardwareBufferPropertiesANDROID& properties = structureChain.template get(); Result result = static_cast( d.vkGetAndroidHardwareBufferPropertiesANDROID( m_device, buffer, reinterpret_cast( &properties ) ) ); return createResultValue( result, structureChain, VULKAN_HPP_NAMESPACE_STRING"::Device::getAndroidHardwareBufferPropertiesANDROID" ); @@ -40033,8 +40033,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template PhysicalDeviceFeatures2 getFeatures2(Dispatch const &d = Dispatch() ) const; - template - StructureChain getFeatures2(Dispatch const &d = Dispatch() ) const; + template + StructureChain getFeatures2(Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40042,8 +40042,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template PhysicalDeviceFeatures2 getFeatures2KHR(Dispatch const &d = Dispatch() ) const; - template - StructureChain getFeatures2KHR(Dispatch const &d = Dispatch() ) const; + template + StructureChain getFeatures2KHR(Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40051,8 +40051,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template PhysicalDeviceProperties2 getProperties2(Dispatch const &d = Dispatch() ) const; - template - StructureChain getProperties2(Dispatch const &d = Dispatch() ) const; + template + StructureChain getProperties2(Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40060,8 +40060,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template PhysicalDeviceProperties2 getProperties2KHR(Dispatch const &d = Dispatch() ) const; - template - StructureChain getProperties2KHR(Dispatch const &d = Dispatch() ) const; + template + StructureChain getProperties2KHR(Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40083,8 +40083,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template ResultValueType::type getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d = Dispatch() ) const; - template - typename ResultValueType>::type getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d = Dispatch() ) const; + template + typename ResultValueType>::type getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40092,8 +40092,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template ResultValueType::type getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d = Dispatch() ) const; - template - typename ResultValueType>::type getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d = Dispatch() ) const; + template + typename ResultValueType>::type getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40232,8 +40232,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template ResultValueType::type getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo, Dispatch const &d = Dispatch() ) const; - template - typename ResultValueType>::type getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo, Dispatch const &d = Dispatch() ) const; + template + typename ResultValueType>::type getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo, Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40826,10 +40826,10 @@ public: d.vkGetPhysicalDeviceFeatures2( m_physicalDevice, reinterpret_cast( &features ) ); return features; } - template - VULKAN_HPP_INLINE StructureChain PhysicalDevice::getFeatures2(Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain PhysicalDevice::getFeatures2(Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; PhysicalDeviceFeatures2& features = structureChain.template get(); d.vkGetPhysicalDeviceFeatures2( m_physicalDevice, reinterpret_cast( &features ) ); return structureChain; @@ -40849,10 +40849,10 @@ public: d.vkGetPhysicalDeviceFeatures2KHR( m_physicalDevice, reinterpret_cast( &features ) ); return features; } - template - VULKAN_HPP_INLINE StructureChain PhysicalDevice::getFeatures2KHR(Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain PhysicalDevice::getFeatures2KHR(Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; PhysicalDeviceFeatures2& features = structureChain.template get(); d.vkGetPhysicalDeviceFeatures2KHR( m_physicalDevice, reinterpret_cast( &features ) ); return structureChain; @@ -40872,10 +40872,10 @@ public: d.vkGetPhysicalDeviceProperties2( m_physicalDevice, reinterpret_cast( &properties ) ); return properties; } - template - VULKAN_HPP_INLINE StructureChain PhysicalDevice::getProperties2(Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain PhysicalDevice::getProperties2(Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; PhysicalDeviceProperties2& properties = structureChain.template get(); d.vkGetPhysicalDeviceProperties2( m_physicalDevice, reinterpret_cast( &properties ) ); return structureChain; @@ -40895,10 +40895,10 @@ public: d.vkGetPhysicalDeviceProperties2KHR( m_physicalDevice, reinterpret_cast( &properties ) ); return properties; } - template - VULKAN_HPP_INLINE StructureChain PhysicalDevice::getProperties2KHR(Dispatch const &d ) const + template + VULKAN_HPP_INLINE StructureChain PhysicalDevice::getProperties2KHR(Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; PhysicalDeviceProperties2& properties = structureChain.template get(); d.vkGetPhysicalDeviceProperties2KHR( m_physicalDevice, reinterpret_cast( &properties ) ); return structureChain; @@ -40948,10 +40948,10 @@ public: Result result = static_cast( d.vkGetPhysicalDeviceImageFormatProperties2( m_physicalDevice, reinterpret_cast( &imageFormatInfo ), reinterpret_cast( &imageFormatProperties ) ) ); return createResultValue( result, imageFormatProperties, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::getImageFormatProperties2" ); } - template - VULKAN_HPP_INLINE typename ResultValueType>::type PhysicalDevice::getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d ) const + template + VULKAN_HPP_INLINE typename ResultValueType>::type PhysicalDevice::getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; ImageFormatProperties2& imageFormatProperties = structureChain.template get(); Result result = static_cast( d.vkGetPhysicalDeviceImageFormatProperties2( m_physicalDevice, reinterpret_cast( &imageFormatInfo ), reinterpret_cast( &imageFormatProperties ) ) ); return createResultValue( result, structureChain, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::getImageFormatProperties2" ); @@ -40971,10 +40971,10 @@ public: Result result = static_cast( d.vkGetPhysicalDeviceImageFormatProperties2KHR( m_physicalDevice, reinterpret_cast( &imageFormatInfo ), reinterpret_cast( &imageFormatProperties ) ) ); return createResultValue( result, imageFormatProperties, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::getImageFormatProperties2KHR" ); } - template - VULKAN_HPP_INLINE typename ResultValueType>::type PhysicalDevice::getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d ) const + template + VULKAN_HPP_INLINE typename ResultValueType>::type PhysicalDevice::getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; ImageFormatProperties2& imageFormatProperties = structureChain.template get(); Result result = static_cast( d.vkGetPhysicalDeviceImageFormatProperties2KHR( m_physicalDevice, reinterpret_cast( &imageFormatInfo ), reinterpret_cast( &imageFormatProperties ) ) ); return createResultValue( result, structureChain, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::getImageFormatProperties2KHR" ); @@ -41292,10 +41292,10 @@ public: Result result = static_cast( d.vkGetPhysicalDeviceSurfaceCapabilities2KHR( m_physicalDevice, reinterpret_cast( &surfaceInfo ), reinterpret_cast( &surfaceCapabilities ) ) ); return createResultValue( result, surfaceCapabilities, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::getSurfaceCapabilities2KHR" ); } - template - VULKAN_HPP_INLINE typename ResultValueType>::type PhysicalDevice::getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo, Dispatch const &d ) const + template + VULKAN_HPP_INLINE typename ResultValueType>::type PhysicalDevice::getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo, Dispatch const &d ) const { - StructureChain structureChain; + StructureChain structureChain; SurfaceCapabilities2KHR& surfaceCapabilities = structureChain.template get(); Result result = static_cast( d.vkGetPhysicalDeviceSurfaceCapabilities2KHR( m_physicalDevice, reinterpret_cast( &surfaceInfo ), reinterpret_cast( &surfaceCapabilities ) ) ); return createResultValue( result, structureChain, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::getSurfaceCapabilities2KHR" ); From 295d5c755f84a6a5bde88d5414e0cc7c004d6678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Thu, 20 Sep 2018 15:20:00 +0200 Subject: [PATCH 5/8] Extend checking of StructureChains to allow transitive extension. (#254) --- VulkanHppGenerator.cpp | 61 ++++++++++++++++++------- tests/StructureChain/StructureChain.cpp | 18 +++++++- vulkan/vulkan.hpp | 61 ++++++++++++++++++------- 3 files changed, 106 insertions(+), 34 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 9608f52..5693707 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -372,8 +372,34 @@ const std::string arrayProxyHeader = R"( )"; const std::string structureChainHeader = R"( + template struct isStructureChainValid { enum { value = false }; }; + template + struct TypeList + { + using list = P; + using last = T; + }; + + template + struct extendCheck + { + static const bool valid = isStructureChainValid::value || extendCheck::valid; + }; + + template + struct extendCheck,X> + { + static const bool valid = isStructureChainValid::value; + }; + + template + struct extendCheck + { + static const bool valid = true; + }; + template class StructureChainElement { @@ -390,75 +416,78 @@ const std::string structureChainHeader = R"( public: StructureChain() { - link(); + link(); } StructureChain(StructureChain const &rhs) { - linkAndCopy(rhs); + linkAndCopy(rhs); } StructureChain(StructureElements const &... elems) { - linkAndCopyElements(elems...); + linkAndCopyElements(elems...); } StructureChain& operator=(StructureChain const &rhs) { - linkAndCopy(rhs); + linkAndCopy(rhs); return *this; } template ClassType& get() { return static_cast(*this);} private: - template + template void link() { + static_assert(extendCheck::valid, "The structure chain is not valid!"); } - template + template void link() { - static_assert(isStructureChainValid::value, "The structure chain is not valid!"); + static_assert(extendCheck::valid, "The structure chain is not valid!"); X& x = static_cast(*this); Y& y = static_cast(*this); x.pNext = &y; - link(); + link, Y, Z...>(); } - template + template void linkAndCopy(StructureChain const &rhs) { + static_assert(extendCheck::valid, "The structure chain is not valid!"); static_cast(*this) = static_cast(rhs); } - template + template void linkAndCopy(StructureChain const &rhs) { - static_assert(isStructureChainValid::value, "The structure chain is not valid!"); + static_assert(extendCheck::valid, "The structure chain is not valid!"); X& x = static_cast(*this); Y& y = static_cast(*this); x = static_cast(rhs); x.pNext = &y; - linkAndCopy(rhs); + linkAndCopy, Y, Z...>(rhs); } - template + template void linkAndCopyElements(X const &xelem) { + static_assert(extendCheck::valid, "The structure chain is not valid!"); static_cast(*this) = xelem; } - template + template void linkAndCopyElements(X const &xelem, Y const &yelem, Z const &... zelem) { - static_assert(isStructureChainValid::value, "The structure chain is not valid!"); + static_assert(extendCheck::valid, "The structure chain is not valid!"); X& x = static_cast(*this); Y& y = static_cast(*this); x = xelem; x.pNext = &y; - linkAndCopyElements(yelem, zelem...); + linkAndCopyElements, Y, Z...>(yelem, zelem...); } }; diff --git a/tests/StructureChain/StructureChain.cpp b/tests/StructureChain/StructureChain.cpp index dcbd32f..ea87383 100644 --- a/tests/StructureChain/StructureChain.cpp +++ b/tests/StructureChain/StructureChain.cpp @@ -37,14 +37,28 @@ int main(int /*argc*/, char * /*argv[]*/) vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo)); std::vector physicalDevices = instance->enumeratePhysicalDevices(); + // some valid StructureChains + vk::StructureChain sc0; + vk::StructureChain sc1; + vk::StructureChain sc2; + vk::StructureChain sc3; + vk::StructureChain sc4; + vk::StructureChain sc6; + vk::StructureChain sc7; + + // some not valid StructureChains + //vk::StructureChain x; + //vk::StructureChain x; + //vk::StructureChain x; + //vk::StructureChain x; + //vk::StructureChain x; + vk::PhysicalDevice & pd = physicalDevices[0]; // simple call, passing structures in vk::PhysicalDeviceFeatures2 pdf; pd.getFeatures2(&pdf); - vk::StructureChain z; - // simple calls, getting structure back vk::PhysicalDeviceFeatures2 a = pd.getFeatures2(); vk::PhysicalDeviceFeatures2 b = pd.getFeatures2(vk::DispatchLoaderStatic()); diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 218499c..4869315 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -479,8 +479,34 @@ namespace VULKAN_HPP_NAMESPACE #endif + template struct isStructureChainValid { enum { value = false }; }; + template + struct TypeList + { + using list = P; + using last = T; + }; + + template + struct extendCheck + { + static const bool valid = isStructureChainValid::value || extendCheck::valid; + }; + + template + struct extendCheck,X> + { + static const bool valid = isStructureChainValid::value; + }; + + template + struct extendCheck + { + static const bool valid = true; + }; + template class StructureChainElement { @@ -497,75 +523,78 @@ namespace VULKAN_HPP_NAMESPACE public: StructureChain() { - link(); + link(); } StructureChain(StructureChain const &rhs) { - linkAndCopy(rhs); + linkAndCopy(rhs); } StructureChain(StructureElements const &... elems) { - linkAndCopyElements(elems...); + linkAndCopyElements(elems...); } StructureChain& operator=(StructureChain const &rhs) { - linkAndCopy(rhs); + linkAndCopy(rhs); return *this; } template ClassType& get() { return static_cast(*this);} private: - template + template void link() { + static_assert(extendCheck::valid, "The structure chain is not valid!"); } - template + template void link() { - static_assert(isStructureChainValid::value, "The structure chain is not valid!"); + static_assert(extendCheck::valid, "The structure chain is not valid!"); X& x = static_cast(*this); Y& y = static_cast(*this); x.pNext = &y; - link(); + link, Y, Z...>(); } - template + template void linkAndCopy(StructureChain const &rhs) { + static_assert(extendCheck::valid, "The structure chain is not valid!"); static_cast(*this) = static_cast(rhs); } - template + template void linkAndCopy(StructureChain const &rhs) { - static_assert(isStructureChainValid::value, "The structure chain is not valid!"); + static_assert(extendCheck::valid, "The structure chain is not valid!"); X& x = static_cast(*this); Y& y = static_cast(*this); x = static_cast(rhs); x.pNext = &y; - linkAndCopy(rhs); + linkAndCopy, Y, Z...>(rhs); } - template + template void linkAndCopyElements(X const &xelem) { + static_assert(extendCheck::valid, "The structure chain is not valid!"); static_cast(*this) = xelem; } - template + template void linkAndCopyElements(X const &xelem, Y const &yelem, Z const &... zelem) { - static_assert(isStructureChainValid::value, "The structure chain is not valid!"); + static_assert(extendCheck::valid, "The structure chain is not valid!"); X& x = static_cast(*this); Y& y = static_cast(*this); x = xelem; x.pNext = &y; - linkAndCopyElements(yelem, zelem...); + linkAndCopyElements, Y, Z...>(yelem, zelem...); } }; From 127de1bf93ea426f8c2db3a93ea78e14867d4cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 25 Sep 2018 10:46:26 +0200 Subject: [PATCH 6/8] Update to Vulkan 1.1.85. (#258) --- Vulkan-Docs | 2 +- VulkanHppGenerator.cpp | 72 +- tests/DeviceFunctions/CMakeLists.txt | 35 + tests/DeviceFunctions/DeviceFunctions.cpp | 62 + vulkan/vulkan.hpp | 3792 ++++++++++++++++++++- 5 files changed, 3906 insertions(+), 57 deletions(-) create mode 100644 tests/DeviceFunctions/CMakeLists.txt create mode 100644 tests/DeviceFunctions/DeviceFunctions.cpp diff --git a/Vulkan-Docs b/Vulkan-Docs index dd99197..9858c1e 160000 --- a/Vulkan-Docs +++ b/Vulkan-Docs @@ -1 +1 @@ -Subproject commit dd9919749a56177c2eb9b6525c0979722a3c24ff +Subproject commit 9858c1e89e21246f779226d2be779fd33bb6a50d diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 5693707..215cc5e 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -375,30 +375,30 @@ const std::string structureChainHeader = R"( template struct isStructureChainValid { enum { value = false }; }; - template - struct TypeList - { - using list = P; - using last = T; - }; - - template - struct extendCheck - { - static const bool valid = isStructureChainValid::value || extendCheck::valid; - }; - - template - struct extendCheck,X> - { - static const bool valid = isStructureChainValid::value; - }; - - template - struct extendCheck - { - static const bool valid = true; - }; + template + struct TypeList + { + using list = P; + using last = T; + }; + + template + struct extendCheck + { + static const bool valid = isStructureChainValid::value || extendCheck::valid; + }; + + template + struct extendCheck,X> + { + static const bool valid = isStructureChainValid::value; + }; + + template + struct extendCheck + { + static const bool valid = true; + }; template class StructureChainElement @@ -1531,18 +1531,22 @@ void VulkanHppGenerator::determineReturnParam(CommandData & commandData) { if ((commandData.params[i].type.find('*') != std::string::npos) && (commandData.params[i].type.find("const") == std::string::npos) - && std::find_if(commandData.vectorParams.begin(), commandData.vectorParams.end(), [i](std::pair const& vp) { return vp.second == i; }) == commandData.vectorParams.end() - && ((commandData.vectorParams.find(i) == commandData.vectorParams.end()) || commandData.twoStep || (commandData.successCodes.size() == 1))) + && std::find_if(commandData.vectorParams.begin(), commandData.vectorParams.end(), [i](std::pair const& vp) { return vp.second == i; }) == commandData.vectorParams.end()) { - // it's a non-const pointer, not a vector-size parameter, if it's a vector parameter, its a two-step process or there's just one success code - // -> look for another non-cost pointer argument - auto paramIt = std::find_if(commandData.params.begin() + i + 1, commandData.params.end(), [](ParamData const& pd) + // it's a non-const pointer and not a vector-size parameter + std::map::const_iterator vpit = commandData.vectorParams.find(i); + if ((vpit == commandData.vectorParams.end()) || commandData.twoStep || (commandData.vectorParams.size() > 1) || (vpit->second == size_t(~0)) || (commandData.params[vpit->second].type.find('*') != std::string::npos)) { - return (pd.type.find('*') != std::string::npos) && (pd.type.find("const") == std::string::npos); - }); - // if there is another such argument, we can't decide which one to return -> return none (~0) - // otherwise return the index of the selcted parameter - commandData.returnParam = paramIt != commandData.params.end() ? ~0 : i; + // it's not a vector parameter, or a two-step process, or there is at least one more vector parameter, or the size argument of this vector parameter is not an argument, or the size argument of this vector parameter is provided by a pointer + // -> look for another non-cost pointer argument + auto paramIt = std::find_if(commandData.params.begin() + i + 1, commandData.params.end(), [](ParamData const& pd) + { + return (pd.type.find('*') != std::string::npos) && (pd.type.find("const") == std::string::npos); + }); + // if there is another such argument, we can't decide which one to return -> return none (~0) + // otherwise return the index of the selcted parameter + commandData.returnParam = paramIt != commandData.params.end() ? ~0 : i; + } } } } diff --git a/tests/DeviceFunctions/CMakeLists.txt b/tests/DeviceFunctions/CMakeLists.txt new file mode 100644 index 0000000..664c85f --- /dev/null +++ b/tests/DeviceFunctions/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.2) + +project(DeviceFunctions) + +set(HEADERS +) + +set(SOURCES + DeviceFunctions.cpp +) + +source_group(headers FILES ${HEADERS}) +source_group(sources FILES ${SOURCES}) + +add_executable(DeviceFunctions + ${HEADERS} + ${SOURCES} +) + +set_target_properties(DeviceFunctions PROPERTIES FOLDER "Tests") +target_link_libraries(DeviceFunctions "$ENV{VK_SDK_PATH}/Lib/vulkan-1.lib") diff --git a/tests/DeviceFunctions/DeviceFunctions.cpp b/tests/DeviceFunctions/DeviceFunctions.cpp new file mode 100644 index 0000000..cb02e9f --- /dev/null +++ b/tests/DeviceFunctions/DeviceFunctions.cpp @@ -0,0 +1,62 @@ +// Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// VulkanHpp Samples : DeviceFunctions +// Compile test on device functions + +#include "vulkan/vulkan.hpp" +#include + +static char const* AppName = "DeviceFunctions"; +static char const* EngineName = "Vulkan.hpp"; + +int main(int /*argc*/, char * /*argv[]*/) +{ + try + { + vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1); + vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo)); + std::vector physicalDevices = instance->enumeratePhysicalDevices(); + assert(!physicalDevices.empty()); + + // get the QueueFamilyProperties of the first PhysicalDevice + std::vector queueFamilyProperties = physicalDevices[0].getQueueFamilyProperties(); + + // get the first index into queueFamiliyProperties which supports graphics + size_t graphicsQueueFamilyIndex = std::distance(queueFamilyProperties.begin(), + std::find_if(queueFamilyProperties.begin(), + queueFamilyProperties.end(), + [](vk::QueueFamilyProperties const& qfp) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; })); + assert(graphicsQueueFamilyIndex < queueFamilyProperties.size()); + + // create a UniqueDevice + float queuePriority = 0.0f; + vk::DeviceQueueCreateInfo deviceQueueCreateInfo(vk::DeviceQueueCreateFlags(), static_cast(graphicsQueueFamilyIndex), 1, &queuePriority); + vk::UniqueDevice device = physicalDevices[0].createDeviceUnique(vk::DeviceCreateInfo(vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo)); + + std::vector data; + device->getAccelerationStructureHandleNVX({}, data, vk::DispatchLoaderDynamic()); + } + catch (vk::SystemError err) + { + std::cout << "vk::SystemError: " << err.what() << std::endl; + exit(-1); + } + catch (...) + { + std::cout << "unknown error\n"; + exit(-1); + } + return 0; +} diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 4869315..da6983b 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -70,7 +70,7 @@ #undef MemoryBarrier #endif -static_assert( VK_HEADER_VERSION == 83 , "Wrong VK_HEADER_VERSION!" ); +static_assert( VK_HEADER_VERSION == 85 , "Wrong VK_HEADER_VERSION!" ); // 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default. // To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION @@ -1113,6 +1113,10 @@ public: { return ::vkBeginCommandBuffer( commandBuffer, pBeginInfo); } + VkResult vkBindAccelerationStructureMemoryNVX( VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNVX* pBindInfos ) const + { + return ::vkBindAccelerationStructureMemoryNVX( device, bindInfoCount, pBindInfos); + } VkResult vkBindBufferMemory( VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset ) const { return ::vkBindBufferMemory( device, buffer, memory, memoryOffset); @@ -1169,6 +1173,10 @@ public: { return ::vkCmdBindPipeline( commandBuffer, pipelineBindPoint, pipeline); } + void vkCmdBindShadingRateImageNV( VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout ) const + { + return ::vkCmdBindShadingRateImageNV( commandBuffer, imageView, imageLayout); + } void vkCmdBindVertexBuffers( VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets ) const { return ::vkCmdBindVertexBuffers( commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); @@ -1177,6 +1185,10 @@ public: { return ::vkCmdBlitImage( commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); } + void vkCmdBuildAccelerationStructureNVX( VkCommandBuffer cmdBuf, VkAccelerationStructureTypeNVX type, uint32_t instanceCount, VkBuffer instanceData, VkDeviceSize instanceOffset, uint32_t geometryCount, const VkGeometryNVX* pGeometries, VkBuildAccelerationStructureFlagsNVX flags, VkBool32 update, VkAccelerationStructureNVX dst, VkAccelerationStructureNVX src, VkBuffer scratch, VkDeviceSize scratchOffset ) const + { + return ::vkCmdBuildAccelerationStructureNVX( cmdBuf, type, instanceCount, instanceData, instanceOffset, geometryCount, pGeometries, flags, update, dst, src, scratch, scratchOffset); + } void vkCmdClearAttachments( VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects ) const { return ::vkCmdClearAttachments( commandBuffer, attachmentCount, pAttachments, rectCount, pRects); @@ -1189,6 +1201,10 @@ public: { return ::vkCmdClearDepthStencilImage( commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); } + void vkCmdCopyAccelerationStructureNVX( VkCommandBuffer cmdBuf, VkAccelerationStructureNVX dst, VkAccelerationStructureNVX src, VkCopyAccelerationStructureModeNVX mode ) const + { + return ::vkCmdCopyAccelerationStructureNVX( cmdBuf, dst, src, mode); + } void vkCmdCopyBuffer( VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions ) const { return ::vkCmdCopyBuffer( commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); @@ -1269,6 +1285,18 @@ public: { return ::vkCmdDrawIndirectCountKHR( commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); } + void vkCmdDrawMeshTasksIndirectCountNV( VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride ) const + { + return ::vkCmdDrawMeshTasksIndirectCountNV( commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); + } + void vkCmdDrawMeshTasksIndirectNV( VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride ) const + { + return ::vkCmdDrawMeshTasksIndirectNV( commandBuffer, buffer, offset, drawCount, stride); + } + void vkCmdDrawMeshTasksNV( VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask ) const + { + return ::vkCmdDrawMeshTasksNV( commandBuffer, taskCount, firstTask); + } void vkCmdEndConditionalRenderingEXT( VkCommandBuffer commandBuffer ) const { return ::vkCmdEndConditionalRenderingEXT( commandBuffer); @@ -1353,6 +1381,10 @@ public: { return ::vkCmdSetCheckpointNV( commandBuffer, pCheckpointMarker); } + void vkCmdSetCoarseSampleOrderNV( VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV* pCustomSampleOrders ) const + { + return ::vkCmdSetCoarseSampleOrderNV( commandBuffer, sampleOrderType, customSampleOrderCount, pCustomSampleOrders); + } void vkCmdSetDepthBias( VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor ) const { return ::vkCmdSetDepthBias( commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); @@ -1377,6 +1409,10 @@ public: { return ::vkCmdSetEvent( commandBuffer, event, stageMask); } + void vkCmdSetExclusiveScissorNV( VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors ) const + { + return ::vkCmdSetExclusiveScissorNV( commandBuffer, firstExclusiveScissor, exclusiveScissorCount, pExclusiveScissors); + } void vkCmdSetLineWidth( VkCommandBuffer commandBuffer, float lineWidth ) const { return ::vkCmdSetLineWidth( commandBuffer, lineWidth); @@ -1405,10 +1441,18 @@ public: { return ::vkCmdSetViewport( commandBuffer, firstViewport, viewportCount, pViewports); } + void vkCmdSetViewportShadingRatePaletteNV( VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV* pShadingRatePalettes ) const + { + return ::vkCmdSetViewportShadingRatePaletteNV( commandBuffer, firstViewport, viewportCount, pShadingRatePalettes); + } void vkCmdSetViewportWScalingNV( VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings ) const { return ::vkCmdSetViewportWScalingNV( commandBuffer, firstViewport, viewportCount, pViewportWScalings); } + void vkCmdTraceRaysNVX( VkCommandBuffer cmdBuf, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, uint32_t width, uint32_t height ) const + { + return ::vkCmdTraceRaysNVX( cmdBuf, raygenShaderBindingTableBuffer, raygenShaderBindingOffset, missShaderBindingTableBuffer, missShaderBindingOffset, missShaderBindingStride, hitShaderBindingTableBuffer, hitShaderBindingOffset, hitShaderBindingStride, width, height); + } void vkCmdUpdateBuffer( VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData ) const { return ::vkCmdUpdateBuffer( commandBuffer, dstBuffer, dstOffset, dataSize, pData); @@ -1417,6 +1461,10 @@ public: { return ::vkCmdWaitEvents( commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); } + void vkCmdWriteAccelerationStructurePropertiesNVX( VkCommandBuffer cmdBuf, VkAccelerationStructureNVX accelerationStructure, VkQueryType queryType, VkQueryPool queryPool, uint32_t query ) const + { + return ::vkCmdWriteAccelerationStructurePropertiesNVX( cmdBuf, accelerationStructure, queryType, queryPool, query); + } void vkCmdWriteBufferMarkerAMD( VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker ) const { return ::vkCmdWriteBufferMarkerAMD( commandBuffer, pipelineStage, dstBuffer, dstOffset, marker); @@ -1425,6 +1473,14 @@ public: { return ::vkCmdWriteTimestamp( commandBuffer, pipelineStage, queryPool, query); } + VkResult vkCompileDeferredNVX( VkDevice device, VkPipeline pipeline, uint32_t shader ) const + { + return ::vkCompileDeferredNVX( device, pipeline, shader); + } + VkResult vkCreateAccelerationStructureNVX( VkDevice device, const VkAccelerationStructureCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureNVX* pAccelerationStructure ) const + { + return ::vkCreateAccelerationStructureNVX( device, pCreateInfo, pAllocator, pAccelerationStructure); + } #ifdef VK_USE_PLATFORM_ANDROID_KHR VkResult vkCreateAndroidSurfaceKHR( VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface ) const { @@ -1549,6 +1605,10 @@ public: { return ::vkCreateQueryPool( device, pCreateInfo, pAllocator, pQueryPool); } + VkResult vkCreateRaytracingPipelinesNVX( VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRaytracingPipelineCreateInfoNVX* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines ) const + { + return ::vkCreateRaytracingPipelinesNVX( device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); + } VkResult vkCreateRenderPass( VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass ) const { return ::vkCreateRenderPass( device, pCreateInfo, pAllocator, pRenderPass); @@ -1631,6 +1691,10 @@ public: { return ::vkDebugReportMessageEXT( instance, flags, objectType, object, location, messageCode, pLayerPrefix, pMessage); } + void vkDestroyAccelerationStructureNVX( VkDevice device, VkAccelerationStructureNVX accelerationStructure, const VkAllocationCallbacks* pAllocator ) const + { + return ::vkDestroyAccelerationStructureNVX( device, accelerationStructure, pAllocator); + } void vkDestroyBuffer( VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator ) const { return ::vkDestroyBuffer( device, buffer, pAllocator); @@ -1815,6 +1879,18 @@ public: { return ::vkFreeMemory( device, memory, pAllocator); } + VkResult vkGetAccelerationStructureHandleNVX( VkDevice device, VkAccelerationStructureNVX accelerationStructure, size_t dataSize, void* pData ) const + { + return ::vkGetAccelerationStructureHandleNVX( device, accelerationStructure, dataSize, pData); + } + void vkGetAccelerationStructureMemoryRequirementsNVX( VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements ) const + { + return ::vkGetAccelerationStructureMemoryRequirementsNVX( device, pInfo, pMemoryRequirements); + } + void vkGetAccelerationStructureScratchMemoryRequirementsNVX( VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements ) const + { + return ::vkGetAccelerationStructureScratchMemoryRequirementsNVX( device, pInfo, pMemoryRequirements); + } #ifdef VK_USE_PLATFORM_ANDROID_ANDROID VkResult vkGetAndroidHardwareBufferPropertiesANDROID( VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties ) const { @@ -2199,6 +2275,10 @@ public: return ::vkGetRandROutputDisplayEXT( physicalDevice, dpy, rrOutput, pDisplay); } #endif /*VK_USE_PLATFORM_XLIB_XRANDR_NV*/ + VkResult vkGetRaytracingShaderHandlesNVX( VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData ) const + { + return ::vkGetRaytracingShaderHandlesNVX( device, pipeline, firstGroup, groupCount, dataSize, pData); + } VkResult vkGetRefreshCycleDurationGOOGLE( VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties ) const { return ::vkGetRefreshCycleDurationGOOGLE( device, swapchain, pDisplayTimingProperties); @@ -4497,6 +4577,73 @@ public: static_assert( sizeof( ValidationCacheEXT ) == sizeof( VkValidationCacheEXT ), "handle and wrapper have different size!" ); + class AccelerationStructureNVX + { + public: + VULKAN_HPP_CONSTEXPR AccelerationStructureNVX() + : m_accelerationStructureNVX(VK_NULL_HANDLE) + {} + + VULKAN_HPP_CONSTEXPR AccelerationStructureNVX( std::nullptr_t ) + : m_accelerationStructureNVX(VK_NULL_HANDLE) + {} + + VULKAN_HPP_TYPESAFE_EXPLICIT AccelerationStructureNVX( VkAccelerationStructureNVX accelerationStructureNVX ) + : m_accelerationStructureNVX( accelerationStructureNVX ) + {} + +#if defined(VULKAN_HPP_TYPESAFE_CONVERSION) + AccelerationStructureNVX & operator=(VkAccelerationStructureNVX accelerationStructureNVX) + { + m_accelerationStructureNVX = accelerationStructureNVX; + return *this; + } +#endif + + AccelerationStructureNVX & operator=( std::nullptr_t ) + { + m_accelerationStructureNVX = VK_NULL_HANDLE; + return *this; + } + + bool operator==( AccelerationStructureNVX const & rhs ) const + { + return m_accelerationStructureNVX == rhs.m_accelerationStructureNVX; + } + + bool operator!=(AccelerationStructureNVX const & rhs ) const + { + return m_accelerationStructureNVX != rhs.m_accelerationStructureNVX; + } + + bool operator<(AccelerationStructureNVX const & rhs ) const + { + return m_accelerationStructureNVX < rhs.m_accelerationStructureNVX; + } + + + + VULKAN_HPP_TYPESAFE_EXPLICIT operator VkAccelerationStructureNVX() const + { + return m_accelerationStructureNVX; + } + + explicit operator bool() const + { + return m_accelerationStructureNVX != VK_NULL_HANDLE; + } + + bool operator!() const + { + return m_accelerationStructureNVX == VK_NULL_HANDLE; + } + + private: + VkAccelerationStructureNVX m_accelerationStructureNVX; + }; + + static_assert( sizeof( AccelerationStructureNVX ) == sizeof( VkAccelerationStructureNVX ), "handle and wrapper have different size!" ); + class DisplayKHR { public: @@ -7506,6 +7653,130 @@ public: }; static_assert( sizeof( VertexInputBindingDivisorDescriptionEXT ) == sizeof( VkVertexInputBindingDivisorDescriptionEXT ), "struct and wrapper have different size!" ); + struct CoarseSampleLocationNV + { + CoarseSampleLocationNV( uint32_t pixelX_ = 0, + uint32_t pixelY_ = 0, + uint32_t sample_ = 0 ) + : pixelX( pixelX_ ) + , pixelY( pixelY_ ) + , sample( sample_ ) + { + } + + CoarseSampleLocationNV( VkCoarseSampleLocationNV const & rhs ) + { + memcpy( this, &rhs, sizeof( CoarseSampleLocationNV ) ); + } + + CoarseSampleLocationNV& operator=( VkCoarseSampleLocationNV const & rhs ) + { + memcpy( this, &rhs, sizeof( CoarseSampleLocationNV ) ); + return *this; + } + CoarseSampleLocationNV& setPixelX( uint32_t pixelX_ ) + { + pixelX = pixelX_; + return *this; + } + + CoarseSampleLocationNV& setPixelY( uint32_t pixelY_ ) + { + pixelY = pixelY_; + return *this; + } + + CoarseSampleLocationNV& setSample( uint32_t sample_ ) + { + sample = sample_; + return *this; + } + + operator VkCoarseSampleLocationNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkCoarseSampleLocationNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( CoarseSampleLocationNV const& rhs ) const + { + return ( pixelX == rhs.pixelX ) + && ( pixelY == rhs.pixelY ) + && ( sample == rhs.sample ); + } + + bool operator!=( CoarseSampleLocationNV const& rhs ) const + { + return !operator==( rhs ); + } + + uint32_t pixelX; + uint32_t pixelY; + uint32_t sample; + }; + static_assert( sizeof( CoarseSampleLocationNV ) == sizeof( VkCoarseSampleLocationNV ), "struct and wrapper have different size!" ); + + struct DrawMeshTasksIndirectCommandNV + { + DrawMeshTasksIndirectCommandNV( uint32_t taskCount_ = 0, + uint32_t firstTask_ = 0 ) + : taskCount( taskCount_ ) + , firstTask( firstTask_ ) + { + } + + DrawMeshTasksIndirectCommandNV( VkDrawMeshTasksIndirectCommandNV const & rhs ) + { + memcpy( this, &rhs, sizeof( DrawMeshTasksIndirectCommandNV ) ); + } + + DrawMeshTasksIndirectCommandNV& operator=( VkDrawMeshTasksIndirectCommandNV const & rhs ) + { + memcpy( this, &rhs, sizeof( DrawMeshTasksIndirectCommandNV ) ); + return *this; + } + DrawMeshTasksIndirectCommandNV& setTaskCount( uint32_t taskCount_ ) + { + taskCount = taskCount_; + return *this; + } + + DrawMeshTasksIndirectCommandNV& setFirstTask( uint32_t firstTask_ ) + { + firstTask = firstTask_; + return *this; + } + + operator VkDrawMeshTasksIndirectCommandNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkDrawMeshTasksIndirectCommandNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( DrawMeshTasksIndirectCommandNV const& rhs ) const + { + return ( taskCount == rhs.taskCount ) + && ( firstTask == rhs.firstTask ); + } + + bool operator!=( DrawMeshTasksIndirectCommandNV const& rhs ) const + { + return !operator==( rhs ); + } + + uint32_t taskCount; + uint32_t firstTask; + }; + static_assert( sizeof( DrawMeshTasksIndirectCommandNV ) == sizeof( VkDrawMeshTasksIndirectCommandNV ), "struct and wrapper have different size!" ); + enum class ImageLayout { eUndefined = VK_IMAGE_LAYOUT_UNDEFINED, @@ -7522,7 +7793,8 @@ public: eDepthAttachmentStencilReadOnlyOptimal = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, eDepthAttachmentStencilReadOnlyOptimalKHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, ePresentSrcKHR = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, - eSharedPresentKHR = VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR + eSharedPresentKHR = VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR, + eShadingRateOptimalNV = VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV }; struct DescriptorImageInfo @@ -7792,7 +8064,9 @@ public: eStorageBuffer = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, eUniformBufferDynamic = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, eStorageBufferDynamic = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, - eInputAttachment = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + eInputAttachment = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, + eInlineUniformBlockEXT = VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT, + eAccelerationStructureNVX = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NVX }; struct DescriptorPoolSize @@ -7955,7 +8229,8 @@ public: { eOcclusion = VK_QUERY_TYPE_OCCLUSION, ePipelineStatistics = VK_QUERY_TYPE_PIPELINE_STATISTICS, - eTimestamp = VK_QUERY_TYPE_TIMESTAMP + eTimestamp = VK_QUERY_TYPE_TIMESTAMP, + eCompactedSizeNVX = VK_QUERY_TYPE_COMPACTED_SIZE_NVX }; enum class BorderColor @@ -7971,7 +8246,8 @@ public: enum class PipelineBindPoint { eGraphics = VK_PIPELINE_BIND_POINT_GRAPHICS, - eCompute = VK_PIPELINE_BIND_POINT_COMPUTE + eCompute = VK_PIPELINE_BIND_POINT_COMPUTE, + eRaytracingNVX = VK_PIPELINE_BIND_POINT_RAYTRACING_NVX }; enum class PipelineCacheHeaderVersion @@ -8939,6 +9215,7 @@ public: eDedicatedAllocationBufferCreateInfoNV = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV, eDedicatedAllocationMemoryAllocateInfoNV = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, eTextureLodGatherFormatPropertiesAMD = VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD, + ePhysicalDeviceCornerSampledImageFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV, eExternalMemoryImageCreateInfoNV = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV, eExportMemoryAllocateInfoNV = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV, eImportMemoryWin32HandleInfoNV = VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV, @@ -8946,6 +9223,8 @@ public: eWin32KeyedMutexAcquireReleaseInfoNV = VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV, eValidationFlagsEXT = VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT, eViSurfaceCreateInfoNN = VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN, + eImageViewAstcDecodeModeEXT = VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT, + ePhysicalDeviceAstcDecodeFeaturesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT, eImportMemoryWin32HandleInfoKHR = VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR, eExportMemoryWin32HandleInfoKHR = VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR, eMemoryWin32HandlePropertiesKHR = VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR, @@ -9021,6 +9300,10 @@ public: eExternalFormatANDROID = VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID, ePhysicalDeviceSamplerFilterMinmaxPropertiesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT, eSamplerReductionModeCreateInfoEXT = VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT, + ePhysicalDeviceInlineUniformBlockFeaturesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT, + ePhysicalDeviceInlineUniformBlockPropertiesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES_EXT, + eWriteDescriptorSetInlineUniformBlockEXT = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT, + eDescriptorPoolInlineUniformBlockCreateInfoEXT = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO_EXT, eSampleLocationsInfoEXT = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT, eRenderPassSampleLocationsBeginInfoEXT = VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT, ePipelineSampleLocationsStateCreateInfoEXT = VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT, @@ -9039,6 +9322,23 @@ public: ePhysicalDeviceDescriptorIndexingPropertiesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT, eDescriptorSetVariableDescriptorCountAllocateInfoEXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT, eDescriptorSetVariableDescriptorCountLayoutSupportEXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT, + ePipelineViewportShadingRateImageStateCreateInfoNV = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV, + ePhysicalDeviceShadingRateImageFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV, + ePhysicalDeviceShadingRateImagePropertiesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV, + ePipelineViewportCoarseSampleOrderStateCreateInfoNV = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV, + eRaytracingPipelineCreateInfoNVX = VK_STRUCTURE_TYPE_RAYTRACING_PIPELINE_CREATE_INFO_NVX, + eAccelerationStructureCreateInfoNVX = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NVX, + eGeometryInstanceNVX = VK_STRUCTURE_TYPE_GEOMETRY_INSTANCE_NVX, + eGeometryNVX = VK_STRUCTURE_TYPE_GEOMETRY_NVX, + eGeometryTrianglesNVX = VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NVX, + eGeometryAabbNVX = VK_STRUCTURE_TYPE_GEOMETRY_AABB_NVX, + eBindAccelerationStructureMemoryInfoNVX = VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NVX, + eDescriptorAccelerationStructureInfoNVX = VK_STRUCTURE_TYPE_DESCRIPTOR_ACCELERATION_STRUCTURE_INFO_NVX, + eAccelerationStructureMemoryRequirementsInfoNVX = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NVX, + ePhysicalDeviceRaytracingPropertiesNVX = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAYTRACING_PROPERTIES_NVX, + eHitShaderModuleCreateInfoNVX = VK_STRUCTURE_TYPE_HIT_SHADER_MODULE_CREATE_INFO_NVX, + ePhysicalDeviceRepresentativeFragmentTestFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV, + ePipelineRepresentativeFragmentTestStateCreateInfoNV = VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV, eDeviceQueueGlobalPriorityCreateInfoEXT = VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT, ePhysicalDevice8BitStorageFeaturesKHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR, eImportMemoryHostPointerInfoEXT = VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT, @@ -9047,8 +9347,17 @@ public: ePhysicalDeviceShaderCorePropertiesAMD = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD, ePhysicalDeviceVertexAttributeDivisorPropertiesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT, ePipelineVertexInputDivisorStateCreateInfoEXT = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT, + ePhysicalDeviceVertexAttributeDivisorFeaturesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT, + ePhysicalDeviceComputeShaderDerivativesFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV, + ePhysicalDeviceMeshShaderFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV, + ePhysicalDeviceMeshShaderPropertiesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV, + ePhysicalDeviceFragmentShaderBarycentricFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV, + ePhysicalDeviceShaderImageFootprintFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV, + ePipelineViewportExclusiveScissorStateCreateInfoNV = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV, + ePhysicalDeviceExclusiveScissorFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV, eCheckpointDataNV = VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV, - eQueueFamilyCheckpointPropertiesNV = VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV + eQueueFamilyCheckpointPropertiesNV = VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV, + ePhysicalDeviceVulkanMemoryModelFeaturesKHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES_KHR }; struct ApplicationInfo @@ -16399,6 +16708,212 @@ public: }; static_assert( sizeof( PhysicalDeviceBlendOperationAdvancedPropertiesEXT ) == sizeof( VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT ), "struct and wrapper have different size!" ); + struct PhysicalDeviceInlineUniformBlockFeaturesEXT + { + operator VkPhysicalDeviceInlineUniformBlockFeaturesEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceInlineUniformBlockFeaturesEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceInlineUniformBlockFeaturesEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( inlineUniformBlock == rhs.inlineUniformBlock ) + && ( descriptorBindingInlineUniformBlockUpdateAfterBind == rhs.descriptorBindingInlineUniformBlockUpdateAfterBind ); + } + + bool operator!=( PhysicalDeviceInlineUniformBlockFeaturesEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceInlineUniformBlockFeaturesEXT; + + public: + void* pNext = nullptr; + Bool32 inlineUniformBlock; + Bool32 descriptorBindingInlineUniformBlockUpdateAfterBind; + }; + static_assert( sizeof( PhysicalDeviceInlineUniformBlockFeaturesEXT ) == sizeof( VkPhysicalDeviceInlineUniformBlockFeaturesEXT ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceInlineUniformBlockPropertiesEXT + { + operator VkPhysicalDeviceInlineUniformBlockPropertiesEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceInlineUniformBlockPropertiesEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceInlineUniformBlockPropertiesEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( maxInlineUniformBlockSize == rhs.maxInlineUniformBlockSize ) + && ( maxPerStageDescriptorInlineUniformBlocks == rhs.maxPerStageDescriptorInlineUniformBlocks ) + && ( maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks == rhs.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks ) + && ( maxDescriptorSetInlineUniformBlocks == rhs.maxDescriptorSetInlineUniformBlocks ) + && ( maxDescriptorSetUpdateAfterBindInlineUniformBlocks == rhs.maxDescriptorSetUpdateAfterBindInlineUniformBlocks ); + } + + bool operator!=( PhysicalDeviceInlineUniformBlockPropertiesEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceInlineUniformBlockPropertiesEXT; + + public: + void* pNext = nullptr; + uint32_t maxInlineUniformBlockSize; + uint32_t maxPerStageDescriptorInlineUniformBlocks; + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; + uint32_t maxDescriptorSetInlineUniformBlocks; + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; + }; + static_assert( sizeof( PhysicalDeviceInlineUniformBlockPropertiesEXT ) == sizeof( VkPhysicalDeviceInlineUniformBlockPropertiesEXT ), "struct and wrapper have different size!" ); + + struct WriteDescriptorSetInlineUniformBlockEXT + { + WriteDescriptorSetInlineUniformBlockEXT( uint32_t dataSize_ = 0, + const void* pData_ = nullptr ) + : dataSize( dataSize_ ) + , pData( pData_ ) + { + } + + WriteDescriptorSetInlineUniformBlockEXT( VkWriteDescriptorSetInlineUniformBlockEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( WriteDescriptorSetInlineUniformBlockEXT ) ); + } + + WriteDescriptorSetInlineUniformBlockEXT& operator=( VkWriteDescriptorSetInlineUniformBlockEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( WriteDescriptorSetInlineUniformBlockEXT ) ); + return *this; + } + WriteDescriptorSetInlineUniformBlockEXT& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + WriteDescriptorSetInlineUniformBlockEXT& setDataSize( uint32_t dataSize_ ) + { + dataSize = dataSize_; + return *this; + } + + WriteDescriptorSetInlineUniformBlockEXT& setPData( const void* pData_ ) + { + pData = pData_; + return *this; + } + + operator VkWriteDescriptorSetInlineUniformBlockEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkWriteDescriptorSetInlineUniformBlockEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( WriteDescriptorSetInlineUniformBlockEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( dataSize == rhs.dataSize ) + && ( pData == rhs.pData ); + } + + bool operator!=( WriteDescriptorSetInlineUniformBlockEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eWriteDescriptorSetInlineUniformBlockEXT; + + public: + const void* pNext = nullptr; + uint32_t dataSize; + const void* pData; + }; + static_assert( sizeof( WriteDescriptorSetInlineUniformBlockEXT ) == sizeof( VkWriteDescriptorSetInlineUniformBlockEXT ), "struct and wrapper have different size!" ); + + struct DescriptorPoolInlineUniformBlockCreateInfoEXT + { + DescriptorPoolInlineUniformBlockCreateInfoEXT( uint32_t maxInlineUniformBlockBindings_ = 0 ) + : maxInlineUniformBlockBindings( maxInlineUniformBlockBindings_ ) + { + } + + DescriptorPoolInlineUniformBlockCreateInfoEXT( VkDescriptorPoolInlineUniformBlockCreateInfoEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( DescriptorPoolInlineUniformBlockCreateInfoEXT ) ); + } + + DescriptorPoolInlineUniformBlockCreateInfoEXT& operator=( VkDescriptorPoolInlineUniformBlockCreateInfoEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( DescriptorPoolInlineUniformBlockCreateInfoEXT ) ); + return *this; + } + DescriptorPoolInlineUniformBlockCreateInfoEXT& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + DescriptorPoolInlineUniformBlockCreateInfoEXT& setMaxInlineUniformBlockBindings( uint32_t maxInlineUniformBlockBindings_ ) + { + maxInlineUniformBlockBindings = maxInlineUniformBlockBindings_; + return *this; + } + + operator VkDescriptorPoolInlineUniformBlockCreateInfoEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkDescriptorPoolInlineUniformBlockCreateInfoEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( DescriptorPoolInlineUniformBlockCreateInfoEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( maxInlineUniformBlockBindings == rhs.maxInlineUniformBlockBindings ); + } + + bool operator!=( DescriptorPoolInlineUniformBlockCreateInfoEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eDescriptorPoolInlineUniformBlockCreateInfoEXT; + + public: + const void* pNext = nullptr; + uint32_t maxInlineUniformBlockBindings; + }; + static_assert( sizeof( DescriptorPoolInlineUniformBlockCreateInfoEXT ) == sizeof( VkDescriptorPoolInlineUniformBlockCreateInfoEXT ), "struct and wrapper have different size!" ); + struct ImageFormatListCreateInfoKHR { ImageFormatListCreateInfoKHR( uint32_t viewFormatCount_ = 0, @@ -18209,6 +18724,1705 @@ public: }; static_assert( sizeof( PhysicalDeviceConditionalRenderingFeaturesEXT ) == sizeof( VkPhysicalDeviceConditionalRenderingFeaturesEXT ), "struct and wrapper have different size!" ); + struct PhysicalDeviceVulkanMemoryModelFeaturesKHR + { + operator VkPhysicalDeviceVulkanMemoryModelFeaturesKHR const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceVulkanMemoryModelFeaturesKHR &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceVulkanMemoryModelFeaturesKHR const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( vulkanMemoryModel == rhs.vulkanMemoryModel ) + && ( vulkanMemoryModelDeviceScope == rhs.vulkanMemoryModelDeviceScope ); + } + + bool operator!=( PhysicalDeviceVulkanMemoryModelFeaturesKHR const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceVulkanMemoryModelFeaturesKHR; + + public: + void* pNext = nullptr; + Bool32 vulkanMemoryModel; + Bool32 vulkanMemoryModelDeviceScope; + }; + static_assert( sizeof( PhysicalDeviceVulkanMemoryModelFeaturesKHR ) == sizeof( VkPhysicalDeviceVulkanMemoryModelFeaturesKHR ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceVertexAttributeDivisorFeaturesEXT + { + PhysicalDeviceVertexAttributeDivisorFeaturesEXT( Bool32 vertexAttributeInstanceRateDivisor_ = 0, + Bool32 vertexAttributeInstanceRateZeroDivisor_ = 0 ) + : vertexAttributeInstanceRateDivisor( vertexAttributeInstanceRateDivisor_ ) + , vertexAttributeInstanceRateZeroDivisor( vertexAttributeInstanceRateZeroDivisor_ ) + { + } + + PhysicalDeviceVertexAttributeDivisorFeaturesEXT( VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceVertexAttributeDivisorFeaturesEXT ) ); + } + + PhysicalDeviceVertexAttributeDivisorFeaturesEXT& operator=( VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceVertexAttributeDivisorFeaturesEXT ) ); + return *this; + } + PhysicalDeviceVertexAttributeDivisorFeaturesEXT& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceVertexAttributeDivisorFeaturesEXT& setVertexAttributeInstanceRateDivisor( Bool32 vertexAttributeInstanceRateDivisor_ ) + { + vertexAttributeInstanceRateDivisor = vertexAttributeInstanceRateDivisor_; + return *this; + } + + PhysicalDeviceVertexAttributeDivisorFeaturesEXT& setVertexAttributeInstanceRateZeroDivisor( Bool32 vertexAttributeInstanceRateZeroDivisor_ ) + { + vertexAttributeInstanceRateZeroDivisor = vertexAttributeInstanceRateZeroDivisor_; + return *this; + } + + operator VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceVertexAttributeDivisorFeaturesEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( vertexAttributeInstanceRateDivisor == rhs.vertexAttributeInstanceRateDivisor ) + && ( vertexAttributeInstanceRateZeroDivisor == rhs.vertexAttributeInstanceRateZeroDivisor ); + } + + bool operator!=( PhysicalDeviceVertexAttributeDivisorFeaturesEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceVertexAttributeDivisorFeaturesEXT; + + public: + void* pNext = nullptr; + Bool32 vertexAttributeInstanceRateDivisor; + Bool32 vertexAttributeInstanceRateZeroDivisor; + }; + static_assert( sizeof( PhysicalDeviceVertexAttributeDivisorFeaturesEXT ) == sizeof( VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT ), "struct and wrapper have different size!" ); + + struct ImageViewASTCDecodeModeEXT + { + ImageViewASTCDecodeModeEXT( Format decodeMode_ = Format::eUndefined ) + : decodeMode( decodeMode_ ) + { + } + + ImageViewASTCDecodeModeEXT( VkImageViewASTCDecodeModeEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( ImageViewASTCDecodeModeEXT ) ); + } + + ImageViewASTCDecodeModeEXT& operator=( VkImageViewASTCDecodeModeEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( ImageViewASTCDecodeModeEXT ) ); + return *this; + } + ImageViewASTCDecodeModeEXT& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + ImageViewASTCDecodeModeEXT& setDecodeMode( Format decodeMode_ ) + { + decodeMode = decodeMode_; + return *this; + } + + operator VkImageViewASTCDecodeModeEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkImageViewASTCDecodeModeEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( ImageViewASTCDecodeModeEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( decodeMode == rhs.decodeMode ); + } + + bool operator!=( ImageViewASTCDecodeModeEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eImageViewAstcDecodeModeEXT; + + public: + const void* pNext = nullptr; + Format decodeMode; + }; + static_assert( sizeof( ImageViewASTCDecodeModeEXT ) == sizeof( VkImageViewASTCDecodeModeEXT ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceASTCDecodeFeaturesEXT + { + PhysicalDeviceASTCDecodeFeaturesEXT( Bool32 decodeModeSharedExponent_ = 0 ) + : decodeModeSharedExponent( decodeModeSharedExponent_ ) + { + } + + PhysicalDeviceASTCDecodeFeaturesEXT( VkPhysicalDeviceASTCDecodeFeaturesEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceASTCDecodeFeaturesEXT ) ); + } + + PhysicalDeviceASTCDecodeFeaturesEXT& operator=( VkPhysicalDeviceASTCDecodeFeaturesEXT const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceASTCDecodeFeaturesEXT ) ); + return *this; + } + PhysicalDeviceASTCDecodeFeaturesEXT& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceASTCDecodeFeaturesEXT& setDecodeModeSharedExponent( Bool32 decodeModeSharedExponent_ ) + { + decodeModeSharedExponent = decodeModeSharedExponent_; + return *this; + } + + operator VkPhysicalDeviceASTCDecodeFeaturesEXT const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceASTCDecodeFeaturesEXT &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceASTCDecodeFeaturesEXT const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( decodeModeSharedExponent == rhs.decodeModeSharedExponent ); + } + + bool operator!=( PhysicalDeviceASTCDecodeFeaturesEXT const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceAstcDecodeFeaturesEXT; + + public: + void* pNext = nullptr; + Bool32 decodeModeSharedExponent; + }; + static_assert( sizeof( PhysicalDeviceASTCDecodeFeaturesEXT ) == sizeof( VkPhysicalDeviceASTCDecodeFeaturesEXT ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceRepresentativeFragmentTestFeaturesNV + { + PhysicalDeviceRepresentativeFragmentTestFeaturesNV( Bool32 representativeFragmentTest_ = 0 ) + : representativeFragmentTest( representativeFragmentTest_ ) + { + } + + PhysicalDeviceRepresentativeFragmentTestFeaturesNV( VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceRepresentativeFragmentTestFeaturesNV ) ); + } + + PhysicalDeviceRepresentativeFragmentTestFeaturesNV& operator=( VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceRepresentativeFragmentTestFeaturesNV ) ); + return *this; + } + PhysicalDeviceRepresentativeFragmentTestFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceRepresentativeFragmentTestFeaturesNV& setRepresentativeFragmentTest( Bool32 representativeFragmentTest_ ) + { + representativeFragmentTest = representativeFragmentTest_; + return *this; + } + + operator VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceRepresentativeFragmentTestFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( representativeFragmentTest == rhs.representativeFragmentTest ); + } + + bool operator!=( PhysicalDeviceRepresentativeFragmentTestFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceRepresentativeFragmentTestFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 representativeFragmentTest; + }; + static_assert( sizeof( PhysicalDeviceRepresentativeFragmentTestFeaturesNV ) == sizeof( VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV ), "struct and wrapper have different size!" ); + + struct PipelineRepresentativeFragmentTestStateCreateInfoNV + { + PipelineRepresentativeFragmentTestStateCreateInfoNV( Bool32 representativeFragmentTestEnable_ = 0 ) + : representativeFragmentTestEnable( representativeFragmentTestEnable_ ) + { + } + + PipelineRepresentativeFragmentTestStateCreateInfoNV( VkPipelineRepresentativeFragmentTestStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineRepresentativeFragmentTestStateCreateInfoNV ) ); + } + + PipelineRepresentativeFragmentTestStateCreateInfoNV& operator=( VkPipelineRepresentativeFragmentTestStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineRepresentativeFragmentTestStateCreateInfoNV ) ); + return *this; + } + PipelineRepresentativeFragmentTestStateCreateInfoNV& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PipelineRepresentativeFragmentTestStateCreateInfoNV& setRepresentativeFragmentTestEnable( Bool32 representativeFragmentTestEnable_ ) + { + representativeFragmentTestEnable = representativeFragmentTestEnable_; + return *this; + } + + operator VkPipelineRepresentativeFragmentTestStateCreateInfoNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPipelineRepresentativeFragmentTestStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PipelineRepresentativeFragmentTestStateCreateInfoNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( representativeFragmentTestEnable == rhs.representativeFragmentTestEnable ); + } + + bool operator!=( PipelineRepresentativeFragmentTestStateCreateInfoNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePipelineRepresentativeFragmentTestStateCreateInfoNV; + + public: + const void* pNext = nullptr; + Bool32 representativeFragmentTestEnable; + }; + static_assert( sizeof( PipelineRepresentativeFragmentTestStateCreateInfoNV ) == sizeof( VkPipelineRepresentativeFragmentTestStateCreateInfoNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceExclusiveScissorFeaturesNV + { + PhysicalDeviceExclusiveScissorFeaturesNV( Bool32 exclusiveScissor_ = 0 ) + : exclusiveScissor( exclusiveScissor_ ) + { + } + + PhysicalDeviceExclusiveScissorFeaturesNV( VkPhysicalDeviceExclusiveScissorFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceExclusiveScissorFeaturesNV ) ); + } + + PhysicalDeviceExclusiveScissorFeaturesNV& operator=( VkPhysicalDeviceExclusiveScissorFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceExclusiveScissorFeaturesNV ) ); + return *this; + } + PhysicalDeviceExclusiveScissorFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceExclusiveScissorFeaturesNV& setExclusiveScissor( Bool32 exclusiveScissor_ ) + { + exclusiveScissor = exclusiveScissor_; + return *this; + } + + operator VkPhysicalDeviceExclusiveScissorFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceExclusiveScissorFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceExclusiveScissorFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( exclusiveScissor == rhs.exclusiveScissor ); + } + + bool operator!=( PhysicalDeviceExclusiveScissorFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceExclusiveScissorFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 exclusiveScissor; + }; + static_assert( sizeof( PhysicalDeviceExclusiveScissorFeaturesNV ) == sizeof( VkPhysicalDeviceExclusiveScissorFeaturesNV ), "struct and wrapper have different size!" ); + + struct PipelineViewportExclusiveScissorStateCreateInfoNV + { + PipelineViewportExclusiveScissorStateCreateInfoNV( uint32_t exclusiveScissorCount_ = 0, + const Rect2D* pExclusiveScissors_ = nullptr ) + : exclusiveScissorCount( exclusiveScissorCount_ ) + , pExclusiveScissors( pExclusiveScissors_ ) + { + } + + PipelineViewportExclusiveScissorStateCreateInfoNV( VkPipelineViewportExclusiveScissorStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineViewportExclusiveScissorStateCreateInfoNV ) ); + } + + PipelineViewportExclusiveScissorStateCreateInfoNV& operator=( VkPipelineViewportExclusiveScissorStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineViewportExclusiveScissorStateCreateInfoNV ) ); + return *this; + } + PipelineViewportExclusiveScissorStateCreateInfoNV& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PipelineViewportExclusiveScissorStateCreateInfoNV& setExclusiveScissorCount( uint32_t exclusiveScissorCount_ ) + { + exclusiveScissorCount = exclusiveScissorCount_; + return *this; + } + + PipelineViewportExclusiveScissorStateCreateInfoNV& setPExclusiveScissors( const Rect2D* pExclusiveScissors_ ) + { + pExclusiveScissors = pExclusiveScissors_; + return *this; + } + + operator VkPipelineViewportExclusiveScissorStateCreateInfoNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPipelineViewportExclusiveScissorStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PipelineViewportExclusiveScissorStateCreateInfoNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( exclusiveScissorCount == rhs.exclusiveScissorCount ) + && ( pExclusiveScissors == rhs.pExclusiveScissors ); + } + + bool operator!=( PipelineViewportExclusiveScissorStateCreateInfoNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePipelineViewportExclusiveScissorStateCreateInfoNV; + + public: + const void* pNext = nullptr; + uint32_t exclusiveScissorCount; + const Rect2D* pExclusiveScissors; + }; + static_assert( sizeof( PipelineViewportExclusiveScissorStateCreateInfoNV ) == sizeof( VkPipelineViewportExclusiveScissorStateCreateInfoNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceCornerSampledImageFeaturesNV + { + PhysicalDeviceCornerSampledImageFeaturesNV( Bool32 cornerSampledImage_ = 0 ) + : cornerSampledImage( cornerSampledImage_ ) + { + } + + PhysicalDeviceCornerSampledImageFeaturesNV( VkPhysicalDeviceCornerSampledImageFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceCornerSampledImageFeaturesNV ) ); + } + + PhysicalDeviceCornerSampledImageFeaturesNV& operator=( VkPhysicalDeviceCornerSampledImageFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceCornerSampledImageFeaturesNV ) ); + return *this; + } + PhysicalDeviceCornerSampledImageFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceCornerSampledImageFeaturesNV& setCornerSampledImage( Bool32 cornerSampledImage_ ) + { + cornerSampledImage = cornerSampledImage_; + return *this; + } + + operator VkPhysicalDeviceCornerSampledImageFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceCornerSampledImageFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceCornerSampledImageFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( cornerSampledImage == rhs.cornerSampledImage ); + } + + bool operator!=( PhysicalDeviceCornerSampledImageFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceCornerSampledImageFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 cornerSampledImage; + }; + static_assert( sizeof( PhysicalDeviceCornerSampledImageFeaturesNV ) == sizeof( VkPhysicalDeviceCornerSampledImageFeaturesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceComputeShaderDerivativesFeaturesNV + { + PhysicalDeviceComputeShaderDerivativesFeaturesNV( Bool32 computeDerivativeGroupQuads_ = 0, + Bool32 computeDerivativeGroupLinear_ = 0 ) + : computeDerivativeGroupQuads( computeDerivativeGroupQuads_ ) + , computeDerivativeGroupLinear( computeDerivativeGroupLinear_ ) + { + } + + PhysicalDeviceComputeShaderDerivativesFeaturesNV( VkPhysicalDeviceComputeShaderDerivativesFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceComputeShaderDerivativesFeaturesNV ) ); + } + + PhysicalDeviceComputeShaderDerivativesFeaturesNV& operator=( VkPhysicalDeviceComputeShaderDerivativesFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceComputeShaderDerivativesFeaturesNV ) ); + return *this; + } + PhysicalDeviceComputeShaderDerivativesFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceComputeShaderDerivativesFeaturesNV& setComputeDerivativeGroupQuads( Bool32 computeDerivativeGroupQuads_ ) + { + computeDerivativeGroupQuads = computeDerivativeGroupQuads_; + return *this; + } + + PhysicalDeviceComputeShaderDerivativesFeaturesNV& setComputeDerivativeGroupLinear( Bool32 computeDerivativeGroupLinear_ ) + { + computeDerivativeGroupLinear = computeDerivativeGroupLinear_; + return *this; + } + + operator VkPhysicalDeviceComputeShaderDerivativesFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceComputeShaderDerivativesFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceComputeShaderDerivativesFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( computeDerivativeGroupQuads == rhs.computeDerivativeGroupQuads ) + && ( computeDerivativeGroupLinear == rhs.computeDerivativeGroupLinear ); + } + + bool operator!=( PhysicalDeviceComputeShaderDerivativesFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceComputeShaderDerivativesFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 computeDerivativeGroupQuads; + Bool32 computeDerivativeGroupLinear; + }; + static_assert( sizeof( PhysicalDeviceComputeShaderDerivativesFeaturesNV ) == sizeof( VkPhysicalDeviceComputeShaderDerivativesFeaturesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceFragmentShaderBarycentricFeaturesNV + { + PhysicalDeviceFragmentShaderBarycentricFeaturesNV( Bool32 fragmentShaderBarycentric_ = 0 ) + : fragmentShaderBarycentric( fragmentShaderBarycentric_ ) + { + } + + PhysicalDeviceFragmentShaderBarycentricFeaturesNV( VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceFragmentShaderBarycentricFeaturesNV ) ); + } + + PhysicalDeviceFragmentShaderBarycentricFeaturesNV& operator=( VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceFragmentShaderBarycentricFeaturesNV ) ); + return *this; + } + PhysicalDeviceFragmentShaderBarycentricFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceFragmentShaderBarycentricFeaturesNV& setFragmentShaderBarycentric( Bool32 fragmentShaderBarycentric_ ) + { + fragmentShaderBarycentric = fragmentShaderBarycentric_; + return *this; + } + + operator VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceFragmentShaderBarycentricFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( fragmentShaderBarycentric == rhs.fragmentShaderBarycentric ); + } + + bool operator!=( PhysicalDeviceFragmentShaderBarycentricFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceFragmentShaderBarycentricFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 fragmentShaderBarycentric; + }; + static_assert( sizeof( PhysicalDeviceFragmentShaderBarycentricFeaturesNV ) == sizeof( VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceShaderImageFootprintFeaturesNV + { + PhysicalDeviceShaderImageFootprintFeaturesNV( Bool32 imageFootprint_ = 0 ) + : imageFootprint( imageFootprint_ ) + { + } + + PhysicalDeviceShaderImageFootprintFeaturesNV( VkPhysicalDeviceShaderImageFootprintFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceShaderImageFootprintFeaturesNV ) ); + } + + PhysicalDeviceShaderImageFootprintFeaturesNV& operator=( VkPhysicalDeviceShaderImageFootprintFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceShaderImageFootprintFeaturesNV ) ); + return *this; + } + PhysicalDeviceShaderImageFootprintFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceShaderImageFootprintFeaturesNV& setImageFootprint( Bool32 imageFootprint_ ) + { + imageFootprint = imageFootprint_; + return *this; + } + + operator VkPhysicalDeviceShaderImageFootprintFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceShaderImageFootprintFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceShaderImageFootprintFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( imageFootprint == rhs.imageFootprint ); + } + + bool operator!=( PhysicalDeviceShaderImageFootprintFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceShaderImageFootprintFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 imageFootprint; + }; + static_assert( sizeof( PhysicalDeviceShaderImageFootprintFeaturesNV ) == sizeof( VkPhysicalDeviceShaderImageFootprintFeaturesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceShadingRateImageFeaturesNV + { + PhysicalDeviceShadingRateImageFeaturesNV( Bool32 shadingRateImage_ = 0, + Bool32 shadingRateCoarseSampleOrder_ = 0 ) + : shadingRateImage( shadingRateImage_ ) + , shadingRateCoarseSampleOrder( shadingRateCoarseSampleOrder_ ) + { + } + + PhysicalDeviceShadingRateImageFeaturesNV( VkPhysicalDeviceShadingRateImageFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceShadingRateImageFeaturesNV ) ); + } + + PhysicalDeviceShadingRateImageFeaturesNV& operator=( VkPhysicalDeviceShadingRateImageFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceShadingRateImageFeaturesNV ) ); + return *this; + } + PhysicalDeviceShadingRateImageFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceShadingRateImageFeaturesNV& setShadingRateImage( Bool32 shadingRateImage_ ) + { + shadingRateImage = shadingRateImage_; + return *this; + } + + PhysicalDeviceShadingRateImageFeaturesNV& setShadingRateCoarseSampleOrder( Bool32 shadingRateCoarseSampleOrder_ ) + { + shadingRateCoarseSampleOrder = shadingRateCoarseSampleOrder_; + return *this; + } + + operator VkPhysicalDeviceShadingRateImageFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceShadingRateImageFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceShadingRateImageFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( shadingRateImage == rhs.shadingRateImage ) + && ( shadingRateCoarseSampleOrder == rhs.shadingRateCoarseSampleOrder ); + } + + bool operator!=( PhysicalDeviceShadingRateImageFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceShadingRateImageFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 shadingRateImage; + Bool32 shadingRateCoarseSampleOrder; + }; + static_assert( sizeof( PhysicalDeviceShadingRateImageFeaturesNV ) == sizeof( VkPhysicalDeviceShadingRateImageFeaturesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceShadingRateImagePropertiesNV + { + operator VkPhysicalDeviceShadingRateImagePropertiesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceShadingRateImagePropertiesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceShadingRateImagePropertiesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( shadingRateTexelSize == rhs.shadingRateTexelSize ) + && ( shadingRatePaletteSize == rhs.shadingRatePaletteSize ) + && ( shadingRateMaxCoarseSamples == rhs.shadingRateMaxCoarseSamples ); + } + + bool operator!=( PhysicalDeviceShadingRateImagePropertiesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceShadingRateImagePropertiesNV; + + public: + void* pNext = nullptr; + Extent2D shadingRateTexelSize; + uint32_t shadingRatePaletteSize; + uint32_t shadingRateMaxCoarseSamples; + }; + static_assert( sizeof( PhysicalDeviceShadingRateImagePropertiesNV ) == sizeof( VkPhysicalDeviceShadingRateImagePropertiesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceMeshShaderFeaturesNV + { + PhysicalDeviceMeshShaderFeaturesNV( Bool32 taskShader_ = 0, + Bool32 meshShader_ = 0 ) + : taskShader( taskShader_ ) + , meshShader( meshShader_ ) + { + } + + PhysicalDeviceMeshShaderFeaturesNV( VkPhysicalDeviceMeshShaderFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceMeshShaderFeaturesNV ) ); + } + + PhysicalDeviceMeshShaderFeaturesNV& operator=( VkPhysicalDeviceMeshShaderFeaturesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceMeshShaderFeaturesNV ) ); + return *this; + } + PhysicalDeviceMeshShaderFeaturesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceMeshShaderFeaturesNV& setTaskShader( Bool32 taskShader_ ) + { + taskShader = taskShader_; + return *this; + } + + PhysicalDeviceMeshShaderFeaturesNV& setMeshShader( Bool32 meshShader_ ) + { + meshShader = meshShader_; + return *this; + } + + operator VkPhysicalDeviceMeshShaderFeaturesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceMeshShaderFeaturesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceMeshShaderFeaturesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( taskShader == rhs.taskShader ) + && ( meshShader == rhs.meshShader ); + } + + bool operator!=( PhysicalDeviceMeshShaderFeaturesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceMeshShaderFeaturesNV; + + public: + void* pNext = nullptr; + Bool32 taskShader; + Bool32 meshShader; + }; + static_assert( sizeof( PhysicalDeviceMeshShaderFeaturesNV ) == sizeof( VkPhysicalDeviceMeshShaderFeaturesNV ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceMeshShaderPropertiesNV + { + PhysicalDeviceMeshShaderPropertiesNV( uint32_t maxDrawMeshTasksCount_ = 0, + uint32_t maxTaskWorkGroupInvocations_ = 0, + std::array const& maxTaskWorkGroupSize_ = { { 0, 0, 0 } }, + uint32_t maxTaskTotalMemorySize_ = 0, + uint32_t maxTaskOutputCount_ = 0, + uint32_t maxMeshWorkGroupInvocations_ = 0, + std::array const& maxMeshWorkGroupSize_ = { { 0, 0, 0 } }, + uint32_t maxMeshTotalMemorySize_ = 0, + uint32_t maxMeshOutputVertices_ = 0, + uint32_t maxMeshOutputPrimitives_ = 0, + uint32_t maxMeshMultiviewViewCount_ = 0, + uint32_t meshOutputPerVertexGranularity_ = 0, + uint32_t meshOutputPerPrimitiveGranularity_ = 0 ) + : maxDrawMeshTasksCount( maxDrawMeshTasksCount_ ) + , maxTaskWorkGroupInvocations( maxTaskWorkGroupInvocations_ ) + , maxTaskTotalMemorySize( maxTaskTotalMemorySize_ ) + , maxTaskOutputCount( maxTaskOutputCount_ ) + , maxMeshWorkGroupInvocations( maxMeshWorkGroupInvocations_ ) + , maxMeshTotalMemorySize( maxMeshTotalMemorySize_ ) + , maxMeshOutputVertices( maxMeshOutputVertices_ ) + , maxMeshOutputPrimitives( maxMeshOutputPrimitives_ ) + , maxMeshMultiviewViewCount( maxMeshMultiviewViewCount_ ) + , meshOutputPerVertexGranularity( meshOutputPerVertexGranularity_ ) + , meshOutputPerPrimitiveGranularity( meshOutputPerPrimitiveGranularity_ ) + { + memcpy( &maxTaskWorkGroupSize, maxTaskWorkGroupSize_.data(), 3 * sizeof( uint32_t ) ); + memcpy( &maxMeshWorkGroupSize, maxMeshWorkGroupSize_.data(), 3 * sizeof( uint32_t ) ); + } + + PhysicalDeviceMeshShaderPropertiesNV( VkPhysicalDeviceMeshShaderPropertiesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceMeshShaderPropertiesNV ) ); + } + + PhysicalDeviceMeshShaderPropertiesNV& operator=( VkPhysicalDeviceMeshShaderPropertiesNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceMeshShaderPropertiesNV ) ); + return *this; + } + PhysicalDeviceMeshShaderPropertiesNV& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxDrawMeshTasksCount( uint32_t maxDrawMeshTasksCount_ ) + { + maxDrawMeshTasksCount = maxDrawMeshTasksCount_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxTaskWorkGroupInvocations( uint32_t maxTaskWorkGroupInvocations_ ) + { + maxTaskWorkGroupInvocations = maxTaskWorkGroupInvocations_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxTaskWorkGroupSize( std::array maxTaskWorkGroupSize_ ) + { + memcpy( &maxTaskWorkGroupSize, maxTaskWorkGroupSize_.data(), 3 * sizeof( uint32_t ) ); + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxTaskTotalMemorySize( uint32_t maxTaskTotalMemorySize_ ) + { + maxTaskTotalMemorySize = maxTaskTotalMemorySize_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxTaskOutputCount( uint32_t maxTaskOutputCount_ ) + { + maxTaskOutputCount = maxTaskOutputCount_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxMeshWorkGroupInvocations( uint32_t maxMeshWorkGroupInvocations_ ) + { + maxMeshWorkGroupInvocations = maxMeshWorkGroupInvocations_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxMeshWorkGroupSize( std::array maxMeshWorkGroupSize_ ) + { + memcpy( &maxMeshWorkGroupSize, maxMeshWorkGroupSize_.data(), 3 * sizeof( uint32_t ) ); + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxMeshTotalMemorySize( uint32_t maxMeshTotalMemorySize_ ) + { + maxMeshTotalMemorySize = maxMeshTotalMemorySize_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxMeshOutputVertices( uint32_t maxMeshOutputVertices_ ) + { + maxMeshOutputVertices = maxMeshOutputVertices_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxMeshOutputPrimitives( uint32_t maxMeshOutputPrimitives_ ) + { + maxMeshOutputPrimitives = maxMeshOutputPrimitives_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMaxMeshMultiviewViewCount( uint32_t maxMeshMultiviewViewCount_ ) + { + maxMeshMultiviewViewCount = maxMeshMultiviewViewCount_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMeshOutputPerVertexGranularity( uint32_t meshOutputPerVertexGranularity_ ) + { + meshOutputPerVertexGranularity = meshOutputPerVertexGranularity_; + return *this; + } + + PhysicalDeviceMeshShaderPropertiesNV& setMeshOutputPerPrimitiveGranularity( uint32_t meshOutputPerPrimitiveGranularity_ ) + { + meshOutputPerPrimitiveGranularity = meshOutputPerPrimitiveGranularity_; + return *this; + } + + operator VkPhysicalDeviceMeshShaderPropertiesNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceMeshShaderPropertiesNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceMeshShaderPropertiesNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( maxDrawMeshTasksCount == rhs.maxDrawMeshTasksCount ) + && ( maxTaskWorkGroupInvocations == rhs.maxTaskWorkGroupInvocations ) + && ( memcmp( maxTaskWorkGroupSize, rhs.maxTaskWorkGroupSize, 3 * sizeof( uint32_t ) ) == 0 ) + && ( maxTaskTotalMemorySize == rhs.maxTaskTotalMemorySize ) + && ( maxTaskOutputCount == rhs.maxTaskOutputCount ) + && ( maxMeshWorkGroupInvocations == rhs.maxMeshWorkGroupInvocations ) + && ( memcmp( maxMeshWorkGroupSize, rhs.maxMeshWorkGroupSize, 3 * sizeof( uint32_t ) ) == 0 ) + && ( maxMeshTotalMemorySize == rhs.maxMeshTotalMemorySize ) + && ( maxMeshOutputVertices == rhs.maxMeshOutputVertices ) + && ( maxMeshOutputPrimitives == rhs.maxMeshOutputPrimitives ) + && ( maxMeshMultiviewViewCount == rhs.maxMeshMultiviewViewCount ) + && ( meshOutputPerVertexGranularity == rhs.meshOutputPerVertexGranularity ) + && ( meshOutputPerPrimitiveGranularity == rhs.meshOutputPerPrimitiveGranularity ); + } + + bool operator!=( PhysicalDeviceMeshShaderPropertiesNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceMeshShaderPropertiesNV; + + public: + void* pNext = nullptr; + uint32_t maxDrawMeshTasksCount; + uint32_t maxTaskWorkGroupInvocations; + uint32_t maxTaskWorkGroupSize[3]; + uint32_t maxTaskTotalMemorySize; + uint32_t maxTaskOutputCount; + uint32_t maxMeshWorkGroupInvocations; + uint32_t maxMeshWorkGroupSize[3]; + uint32_t maxMeshTotalMemorySize; + uint32_t maxMeshOutputVertices; + uint32_t maxMeshOutputPrimitives; + uint32_t maxMeshMultiviewViewCount; + uint32_t meshOutputPerVertexGranularity; + uint32_t meshOutputPerPrimitiveGranularity; + }; + static_assert( sizeof( PhysicalDeviceMeshShaderPropertiesNV ) == sizeof( VkPhysicalDeviceMeshShaderPropertiesNV ), "struct and wrapper have different size!" ); + + struct GeometryTrianglesNVX + { + GeometryTrianglesNVX( Buffer vertexData_ = Buffer(), + DeviceSize vertexOffset_ = 0, + uint32_t vertexCount_ = 0, + DeviceSize vertexStride_ = 0, + Format vertexFormat_ = Format::eUndefined, + Buffer indexData_ = Buffer(), + DeviceSize indexOffset_ = 0, + uint32_t indexCount_ = 0, + IndexType indexType_ = IndexType::eUint16, + Buffer transformData_ = Buffer(), + DeviceSize transformOffset_ = 0 ) + : vertexData( vertexData_ ) + , vertexOffset( vertexOffset_ ) + , vertexCount( vertexCount_ ) + , vertexStride( vertexStride_ ) + , vertexFormat( vertexFormat_ ) + , indexData( indexData_ ) + , indexOffset( indexOffset_ ) + , indexCount( indexCount_ ) + , indexType( indexType_ ) + , transformData( transformData_ ) + , transformOffset( transformOffset_ ) + { + } + + GeometryTrianglesNVX( VkGeometryTrianglesNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryTrianglesNVX ) ); + } + + GeometryTrianglesNVX& operator=( VkGeometryTrianglesNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryTrianglesNVX ) ); + return *this; + } + GeometryTrianglesNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + GeometryTrianglesNVX& setVertexData( Buffer vertexData_ ) + { + vertexData = vertexData_; + return *this; + } + + GeometryTrianglesNVX& setVertexOffset( DeviceSize vertexOffset_ ) + { + vertexOffset = vertexOffset_; + return *this; + } + + GeometryTrianglesNVX& setVertexCount( uint32_t vertexCount_ ) + { + vertexCount = vertexCount_; + return *this; + } + + GeometryTrianglesNVX& setVertexStride( DeviceSize vertexStride_ ) + { + vertexStride = vertexStride_; + return *this; + } + + GeometryTrianglesNVX& setVertexFormat( Format vertexFormat_ ) + { + vertexFormat = vertexFormat_; + return *this; + } + + GeometryTrianglesNVX& setIndexData( Buffer indexData_ ) + { + indexData = indexData_; + return *this; + } + + GeometryTrianglesNVX& setIndexOffset( DeviceSize indexOffset_ ) + { + indexOffset = indexOffset_; + return *this; + } + + GeometryTrianglesNVX& setIndexCount( uint32_t indexCount_ ) + { + indexCount = indexCount_; + return *this; + } + + GeometryTrianglesNVX& setIndexType( IndexType indexType_ ) + { + indexType = indexType_; + return *this; + } + + GeometryTrianglesNVX& setTransformData( Buffer transformData_ ) + { + transformData = transformData_; + return *this; + } + + GeometryTrianglesNVX& setTransformOffset( DeviceSize transformOffset_ ) + { + transformOffset = transformOffset_; + return *this; + } + + operator VkGeometryTrianglesNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkGeometryTrianglesNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( GeometryTrianglesNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( vertexData == rhs.vertexData ) + && ( vertexOffset == rhs.vertexOffset ) + && ( vertexCount == rhs.vertexCount ) + && ( vertexStride == rhs.vertexStride ) + && ( vertexFormat == rhs.vertexFormat ) + && ( indexData == rhs.indexData ) + && ( indexOffset == rhs.indexOffset ) + && ( indexCount == rhs.indexCount ) + && ( indexType == rhs.indexType ) + && ( transformData == rhs.transformData ) + && ( transformOffset == rhs.transformOffset ); + } + + bool operator!=( GeometryTrianglesNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eGeometryTrianglesNVX; + + public: + const void* pNext = nullptr; + Buffer vertexData; + DeviceSize vertexOffset; + uint32_t vertexCount; + DeviceSize vertexStride; + Format vertexFormat; + Buffer indexData; + DeviceSize indexOffset; + uint32_t indexCount; + IndexType indexType; + Buffer transformData; + DeviceSize transformOffset; + }; + static_assert( sizeof( GeometryTrianglesNVX ) == sizeof( VkGeometryTrianglesNVX ), "struct and wrapper have different size!" ); + + struct GeometryAABBNVX + { + GeometryAABBNVX( Buffer aabbData_ = Buffer(), + uint32_t numAABBs_ = 0, + uint32_t stride_ = 0, + DeviceSize offset_ = 0 ) + : aabbData( aabbData_ ) + , numAABBs( numAABBs_ ) + , stride( stride_ ) + , offset( offset_ ) + { + } + + GeometryAABBNVX( VkGeometryAABBNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryAABBNVX ) ); + } + + GeometryAABBNVX& operator=( VkGeometryAABBNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryAABBNVX ) ); + return *this; + } + GeometryAABBNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + GeometryAABBNVX& setAabbData( Buffer aabbData_ ) + { + aabbData = aabbData_; + return *this; + } + + GeometryAABBNVX& setNumAABBs( uint32_t numAABBs_ ) + { + numAABBs = numAABBs_; + return *this; + } + + GeometryAABBNVX& setStride( uint32_t stride_ ) + { + stride = stride_; + return *this; + } + + GeometryAABBNVX& setOffset( DeviceSize offset_ ) + { + offset = offset_; + return *this; + } + + operator VkGeometryAABBNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkGeometryAABBNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( GeometryAABBNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( aabbData == rhs.aabbData ) + && ( numAABBs == rhs.numAABBs ) + && ( stride == rhs.stride ) + && ( offset == rhs.offset ); + } + + bool operator!=( GeometryAABBNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eGeometryAabbNVX; + + public: + const void* pNext = nullptr; + Buffer aabbData; + uint32_t numAABBs; + uint32_t stride; + DeviceSize offset; + }; + static_assert( sizeof( GeometryAABBNVX ) == sizeof( VkGeometryAABBNVX ), "struct and wrapper have different size!" ); + + struct GeometryDataNVX + { + GeometryDataNVX( GeometryTrianglesNVX triangles_ = GeometryTrianglesNVX(), + GeometryAABBNVX aabbs_ = GeometryAABBNVX() ) + : triangles( triangles_ ) + , aabbs( aabbs_ ) + { + } + + GeometryDataNVX( VkGeometryDataNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryDataNVX ) ); + } + + GeometryDataNVX& operator=( VkGeometryDataNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryDataNVX ) ); + return *this; + } + GeometryDataNVX& setTriangles( GeometryTrianglesNVX triangles_ ) + { + triangles = triangles_; + return *this; + } + + GeometryDataNVX& setAabbs( GeometryAABBNVX aabbs_ ) + { + aabbs = aabbs_; + return *this; + } + + operator VkGeometryDataNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkGeometryDataNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( GeometryDataNVX const& rhs ) const + { + return ( triangles == rhs.triangles ) + && ( aabbs == rhs.aabbs ); + } + + bool operator!=( GeometryDataNVX const& rhs ) const + { + return !operator==( rhs ); + } + + GeometryTrianglesNVX triangles; + GeometryAABBNVX aabbs; + }; + static_assert( sizeof( GeometryDataNVX ) == sizeof( VkGeometryDataNVX ), "struct and wrapper have different size!" ); + + struct BindAccelerationStructureMemoryInfoNVX + { + BindAccelerationStructureMemoryInfoNVX( AccelerationStructureNVX accelerationStructure_ = AccelerationStructureNVX(), + DeviceMemory memory_ = DeviceMemory(), + DeviceSize memoryOffset_ = 0, + uint32_t deviceIndexCount_ = 0, + const uint32_t* pDeviceIndices_ = nullptr ) + : accelerationStructure( accelerationStructure_ ) + , memory( memory_ ) + , memoryOffset( memoryOffset_ ) + , deviceIndexCount( deviceIndexCount_ ) + , pDeviceIndices( pDeviceIndices_ ) + { + } + + BindAccelerationStructureMemoryInfoNVX( VkBindAccelerationStructureMemoryInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( BindAccelerationStructureMemoryInfoNVX ) ); + } + + BindAccelerationStructureMemoryInfoNVX& operator=( VkBindAccelerationStructureMemoryInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( BindAccelerationStructureMemoryInfoNVX ) ); + return *this; + } + BindAccelerationStructureMemoryInfoNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + BindAccelerationStructureMemoryInfoNVX& setAccelerationStructure( AccelerationStructureNVX accelerationStructure_ ) + { + accelerationStructure = accelerationStructure_; + return *this; + } + + BindAccelerationStructureMemoryInfoNVX& setMemory( DeviceMemory memory_ ) + { + memory = memory_; + return *this; + } + + BindAccelerationStructureMemoryInfoNVX& setMemoryOffset( DeviceSize memoryOffset_ ) + { + memoryOffset = memoryOffset_; + return *this; + } + + BindAccelerationStructureMemoryInfoNVX& setDeviceIndexCount( uint32_t deviceIndexCount_ ) + { + deviceIndexCount = deviceIndexCount_; + return *this; + } + + BindAccelerationStructureMemoryInfoNVX& setPDeviceIndices( const uint32_t* pDeviceIndices_ ) + { + pDeviceIndices = pDeviceIndices_; + return *this; + } + + operator VkBindAccelerationStructureMemoryInfoNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkBindAccelerationStructureMemoryInfoNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( BindAccelerationStructureMemoryInfoNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( accelerationStructure == rhs.accelerationStructure ) + && ( memory == rhs.memory ) + && ( memoryOffset == rhs.memoryOffset ) + && ( deviceIndexCount == rhs.deviceIndexCount ) + && ( pDeviceIndices == rhs.pDeviceIndices ); + } + + bool operator!=( BindAccelerationStructureMemoryInfoNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eBindAccelerationStructureMemoryInfoNVX; + + public: + const void* pNext = nullptr; + AccelerationStructureNVX accelerationStructure; + DeviceMemory memory; + DeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; + }; + static_assert( sizeof( BindAccelerationStructureMemoryInfoNVX ) == sizeof( VkBindAccelerationStructureMemoryInfoNVX ), "struct and wrapper have different size!" ); + + struct DescriptorAccelerationStructureInfoNVX + { + DescriptorAccelerationStructureInfoNVX( uint32_t accelerationStructureCount_ = 0, + const AccelerationStructureNVX* pAccelerationStructures_ = nullptr ) + : accelerationStructureCount( accelerationStructureCount_ ) + , pAccelerationStructures( pAccelerationStructures_ ) + { + } + + DescriptorAccelerationStructureInfoNVX( VkDescriptorAccelerationStructureInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( DescriptorAccelerationStructureInfoNVX ) ); + } + + DescriptorAccelerationStructureInfoNVX& operator=( VkDescriptorAccelerationStructureInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( DescriptorAccelerationStructureInfoNVX ) ); + return *this; + } + DescriptorAccelerationStructureInfoNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + DescriptorAccelerationStructureInfoNVX& setAccelerationStructureCount( uint32_t accelerationStructureCount_ ) + { + accelerationStructureCount = accelerationStructureCount_; + return *this; + } + + DescriptorAccelerationStructureInfoNVX& setPAccelerationStructures( const AccelerationStructureNVX* pAccelerationStructures_ ) + { + pAccelerationStructures = pAccelerationStructures_; + return *this; + } + + operator VkDescriptorAccelerationStructureInfoNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkDescriptorAccelerationStructureInfoNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( DescriptorAccelerationStructureInfoNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( accelerationStructureCount == rhs.accelerationStructureCount ) + && ( pAccelerationStructures == rhs.pAccelerationStructures ); + } + + bool operator!=( DescriptorAccelerationStructureInfoNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eDescriptorAccelerationStructureInfoNVX; + + public: + const void* pNext = nullptr; + uint32_t accelerationStructureCount; + const AccelerationStructureNVX* pAccelerationStructures; + }; + static_assert( sizeof( DescriptorAccelerationStructureInfoNVX ) == sizeof( VkDescriptorAccelerationStructureInfoNVX ), "struct and wrapper have different size!" ); + + struct AccelerationStructureMemoryRequirementsInfoNVX + { + AccelerationStructureMemoryRequirementsInfoNVX( AccelerationStructureNVX accelerationStructure_ = AccelerationStructureNVX() ) + : accelerationStructure( accelerationStructure_ ) + { + } + + AccelerationStructureMemoryRequirementsInfoNVX( VkAccelerationStructureMemoryRequirementsInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( AccelerationStructureMemoryRequirementsInfoNVX ) ); + } + + AccelerationStructureMemoryRequirementsInfoNVX& operator=( VkAccelerationStructureMemoryRequirementsInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( AccelerationStructureMemoryRequirementsInfoNVX ) ); + return *this; + } + AccelerationStructureMemoryRequirementsInfoNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + AccelerationStructureMemoryRequirementsInfoNVX& setAccelerationStructure( AccelerationStructureNVX accelerationStructure_ ) + { + accelerationStructure = accelerationStructure_; + return *this; + } + + operator VkAccelerationStructureMemoryRequirementsInfoNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkAccelerationStructureMemoryRequirementsInfoNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( AccelerationStructureMemoryRequirementsInfoNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( accelerationStructure == rhs.accelerationStructure ); + } + + bool operator!=( AccelerationStructureMemoryRequirementsInfoNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eAccelerationStructureMemoryRequirementsInfoNVX; + + public: + const void* pNext = nullptr; + AccelerationStructureNVX accelerationStructure; + }; + static_assert( sizeof( AccelerationStructureMemoryRequirementsInfoNVX ) == sizeof( VkAccelerationStructureMemoryRequirementsInfoNVX ), "struct and wrapper have different size!" ); + + struct PhysicalDeviceRaytracingPropertiesNVX + { + PhysicalDeviceRaytracingPropertiesNVX( uint32_t shaderHeaderSize_ = 0, + uint32_t maxRecursionDepth_ = 0, + uint32_t maxGeometryCount_ = 0 ) + : shaderHeaderSize( shaderHeaderSize_ ) + , maxRecursionDepth( maxRecursionDepth_ ) + , maxGeometryCount( maxGeometryCount_ ) + { + } + + PhysicalDeviceRaytracingPropertiesNVX( VkPhysicalDeviceRaytracingPropertiesNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceRaytracingPropertiesNVX ) ); + } + + PhysicalDeviceRaytracingPropertiesNVX& operator=( VkPhysicalDeviceRaytracingPropertiesNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( PhysicalDeviceRaytracingPropertiesNVX ) ); + return *this; + } + PhysicalDeviceRaytracingPropertiesNVX& setPNext( void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PhysicalDeviceRaytracingPropertiesNVX& setShaderHeaderSize( uint32_t shaderHeaderSize_ ) + { + shaderHeaderSize = shaderHeaderSize_; + return *this; + } + + PhysicalDeviceRaytracingPropertiesNVX& setMaxRecursionDepth( uint32_t maxRecursionDepth_ ) + { + maxRecursionDepth = maxRecursionDepth_; + return *this; + } + + PhysicalDeviceRaytracingPropertiesNVX& setMaxGeometryCount( uint32_t maxGeometryCount_ ) + { + maxGeometryCount = maxGeometryCount_; + return *this; + } + + operator VkPhysicalDeviceRaytracingPropertiesNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkPhysicalDeviceRaytracingPropertiesNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( PhysicalDeviceRaytracingPropertiesNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( shaderHeaderSize == rhs.shaderHeaderSize ) + && ( maxRecursionDepth == rhs.maxRecursionDepth ) + && ( maxGeometryCount == rhs.maxGeometryCount ); + } + + bool operator!=( PhysicalDeviceRaytracingPropertiesNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePhysicalDeviceRaytracingPropertiesNVX; + + public: + void* pNext = nullptr; + uint32_t shaderHeaderSize; + uint32_t maxRecursionDepth; + uint32_t maxGeometryCount; + }; + static_assert( sizeof( PhysicalDeviceRaytracingPropertiesNVX ) == sizeof( VkPhysicalDeviceRaytracingPropertiesNVX ), "struct and wrapper have different size!" ); + enum class SubpassContents { eInline = VK_SUBPASS_CONTENTS_INLINE, @@ -18398,7 +20612,10 @@ public: eStencilReference = VK_DYNAMIC_STATE_STENCIL_REFERENCE, eViewportWScalingNV = VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, eDiscardRectangleEXT = VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, - eSampleLocationsEXT = VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT + eSampleLocationsEXT = VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, + eViewportShadingRatePaletteNV = VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV, + eViewportCoarseSampleOrderNV = VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV, + eExclusiveScissorNV = VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV }; struct PipelineDynamicStateCreateInfo @@ -18660,7 +20877,8 @@ public: eObjectTableNVX = VK_OBJECT_TYPE_OBJECT_TABLE_NVX, eIndirectCommandsLayoutNVX = VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX, eDebugUtilsMessengerEXT = VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT, - eValidationCacheEXT = VK_OBJECT_TYPE_VALIDATION_CACHE_EXT + eValidationCacheEXT = VK_OBJECT_TYPE_VALIDATION_CACHE_EXT, + eAccelerationStructureNVX = VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX }; struct DebugUtilsObjectNameInfoEXT @@ -19616,7 +21834,10 @@ public: eConditionalRenderingReadEXT = VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT, eCommandProcessReadNVX = VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX, eCommandProcessWriteNVX = VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX, - eColorAttachmentReadNoncoherentEXT = VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT + eColorAttachmentReadNoncoherentEXT = VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT, + eShadingRateImageReadNV = VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV, + eAccelerationStructureReadNVX = VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NVX, + eAccelerationStructureWriteNVX = VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NVX }; using AccessFlags = Flags; @@ -19635,7 +21856,7 @@ public: { enum { - allFlags = VkFlags(AccessFlagBits::eIndirectCommandRead) | VkFlags(AccessFlagBits::eIndexRead) | VkFlags(AccessFlagBits::eVertexAttributeRead) | VkFlags(AccessFlagBits::eUniformRead) | VkFlags(AccessFlagBits::eInputAttachmentRead) | VkFlags(AccessFlagBits::eShaderRead) | VkFlags(AccessFlagBits::eShaderWrite) | VkFlags(AccessFlagBits::eColorAttachmentRead) | VkFlags(AccessFlagBits::eColorAttachmentWrite) | VkFlags(AccessFlagBits::eDepthStencilAttachmentRead) | VkFlags(AccessFlagBits::eDepthStencilAttachmentWrite) | VkFlags(AccessFlagBits::eTransferRead) | VkFlags(AccessFlagBits::eTransferWrite) | VkFlags(AccessFlagBits::eHostRead) | VkFlags(AccessFlagBits::eHostWrite) | VkFlags(AccessFlagBits::eMemoryRead) | VkFlags(AccessFlagBits::eMemoryWrite) | VkFlags(AccessFlagBits::eConditionalRenderingReadEXT) | VkFlags(AccessFlagBits::eCommandProcessReadNVX) | VkFlags(AccessFlagBits::eCommandProcessWriteNVX) | VkFlags(AccessFlagBits::eColorAttachmentReadNoncoherentEXT) + allFlags = VkFlags(AccessFlagBits::eIndirectCommandRead) | VkFlags(AccessFlagBits::eIndexRead) | VkFlags(AccessFlagBits::eVertexAttributeRead) | VkFlags(AccessFlagBits::eUniformRead) | VkFlags(AccessFlagBits::eInputAttachmentRead) | VkFlags(AccessFlagBits::eShaderRead) | VkFlags(AccessFlagBits::eShaderWrite) | VkFlags(AccessFlagBits::eColorAttachmentRead) | VkFlags(AccessFlagBits::eColorAttachmentWrite) | VkFlags(AccessFlagBits::eDepthStencilAttachmentRead) | VkFlags(AccessFlagBits::eDepthStencilAttachmentWrite) | VkFlags(AccessFlagBits::eTransferRead) | VkFlags(AccessFlagBits::eTransferWrite) | VkFlags(AccessFlagBits::eHostRead) | VkFlags(AccessFlagBits::eHostWrite) | VkFlags(AccessFlagBits::eMemoryRead) | VkFlags(AccessFlagBits::eMemoryWrite) | VkFlags(AccessFlagBits::eConditionalRenderingReadEXT) | VkFlags(AccessFlagBits::eCommandProcessReadNVX) | VkFlags(AccessFlagBits::eCommandProcessWriteNVX) | VkFlags(AccessFlagBits::eColorAttachmentReadNoncoherentEXT) | VkFlags(AccessFlagBits::eShadingRateImageReadNV) | VkFlags(AccessFlagBits::eAccelerationStructureReadNVX) | VkFlags(AccessFlagBits::eAccelerationStructureWriteNVX) }; }; @@ -19840,7 +22061,8 @@ public: eIndexBuffer = VK_BUFFER_USAGE_INDEX_BUFFER_BIT, eVertexBuffer = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, eIndirectBuffer = VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, - eConditionalRenderingEXT = VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT + eConditionalRenderingEXT = VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT, + eRaytracingNVX = VK_BUFFER_USAGE_RAYTRACING_BIT_NVX }; using BufferUsageFlags = Flags; @@ -19859,7 +22081,7 @@ public: { enum { - allFlags = VkFlags(BufferUsageFlagBits::eTransferSrc) | VkFlags(BufferUsageFlagBits::eTransferDst) | VkFlags(BufferUsageFlagBits::eUniformTexelBuffer) | VkFlags(BufferUsageFlagBits::eStorageTexelBuffer) | VkFlags(BufferUsageFlagBits::eUniformBuffer) | VkFlags(BufferUsageFlagBits::eStorageBuffer) | VkFlags(BufferUsageFlagBits::eIndexBuffer) | VkFlags(BufferUsageFlagBits::eVertexBuffer) | VkFlags(BufferUsageFlagBits::eIndirectBuffer) | VkFlags(BufferUsageFlagBits::eConditionalRenderingEXT) + allFlags = VkFlags(BufferUsageFlagBits::eTransferSrc) | VkFlags(BufferUsageFlagBits::eTransferDst) | VkFlags(BufferUsageFlagBits::eUniformTexelBuffer) | VkFlags(BufferUsageFlagBits::eStorageTexelBuffer) | VkFlags(BufferUsageFlagBits::eUniformBuffer) | VkFlags(BufferUsageFlagBits::eStorageBuffer) | VkFlags(BufferUsageFlagBits::eIndexBuffer) | VkFlags(BufferUsageFlagBits::eVertexBuffer) | VkFlags(BufferUsageFlagBits::eIndirectBuffer) | VkFlags(BufferUsageFlagBits::eConditionalRenderingEXT) | VkFlags(BufferUsageFlagBits::eRaytracingNVX) }; }; @@ -20010,7 +22232,15 @@ public: eFragment = VK_SHADER_STAGE_FRAGMENT_BIT, eCompute = VK_SHADER_STAGE_COMPUTE_BIT, eAllGraphics = VK_SHADER_STAGE_ALL_GRAPHICS, - eAll = VK_SHADER_STAGE_ALL + eAll = VK_SHADER_STAGE_ALL, + eRaygenNVX = VK_SHADER_STAGE_RAYGEN_BIT_NVX, + eAnyHitNVX = VK_SHADER_STAGE_ANY_HIT_BIT_NVX, + eClosestHitNVX = VK_SHADER_STAGE_CLOSEST_HIT_BIT_NVX, + eMissNVX = VK_SHADER_STAGE_MISS_BIT_NVX, + eIntersectionNVX = VK_SHADER_STAGE_INTERSECTION_BIT_NVX, + eCallableNVX = VK_SHADER_STAGE_CALLABLE_BIT_NVX, + eTaskNV = VK_SHADER_STAGE_TASK_BIT_NV, + eMeshNV = VK_SHADER_STAGE_MESH_BIT_NV }; using ShaderStageFlags = Flags; @@ -20029,7 +22259,7 @@ public: { enum { - allFlags = VkFlags(ShaderStageFlagBits::eVertex) | VkFlags(ShaderStageFlagBits::eTessellationControl) | VkFlags(ShaderStageFlagBits::eTessellationEvaluation) | VkFlags(ShaderStageFlagBits::eGeometry) | VkFlags(ShaderStageFlagBits::eFragment) | VkFlags(ShaderStageFlagBits::eCompute) | VkFlags(ShaderStageFlagBits::eAllGraphics) | VkFlags(ShaderStageFlagBits::eAll) + allFlags = VkFlags(ShaderStageFlagBits::eVertex) | VkFlags(ShaderStageFlagBits::eTessellationControl) | VkFlags(ShaderStageFlagBits::eTessellationEvaluation) | VkFlags(ShaderStageFlagBits::eGeometry) | VkFlags(ShaderStageFlagBits::eFragment) | VkFlags(ShaderStageFlagBits::eCompute) | VkFlags(ShaderStageFlagBits::eAllGraphics) | VkFlags(ShaderStageFlagBits::eAll) | VkFlags(ShaderStageFlagBits::eRaygenNVX) | VkFlags(ShaderStageFlagBits::eAnyHitNVX) | VkFlags(ShaderStageFlagBits::eClosestHitNVX) | VkFlags(ShaderStageFlagBits::eMissNVX) | VkFlags(ShaderStageFlagBits::eIntersectionNVX) | VkFlags(ShaderStageFlagBits::eCallableNVX) | VkFlags(ShaderStageFlagBits::eTaskNV) | VkFlags(ShaderStageFlagBits::eMeshNV) }; }; @@ -20434,7 +22664,8 @@ public: eColorAttachment = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, eDepthStencilAttachment = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, eTransientAttachment = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, - eInputAttachment = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT + eInputAttachment = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, + eShadingRateImageNV = VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV }; using ImageUsageFlags = Flags; @@ -20453,7 +22684,7 @@ public: { enum { - allFlags = VkFlags(ImageUsageFlagBits::eTransferSrc) | VkFlags(ImageUsageFlagBits::eTransferDst) | VkFlags(ImageUsageFlagBits::eSampled) | VkFlags(ImageUsageFlagBits::eStorage) | VkFlags(ImageUsageFlagBits::eColorAttachment) | VkFlags(ImageUsageFlagBits::eDepthStencilAttachment) | VkFlags(ImageUsageFlagBits::eTransientAttachment) | VkFlags(ImageUsageFlagBits::eInputAttachment) + allFlags = VkFlags(ImageUsageFlagBits::eTransferSrc) | VkFlags(ImageUsageFlagBits::eTransferDst) | VkFlags(ImageUsageFlagBits::eSampled) | VkFlags(ImageUsageFlagBits::eStorage) | VkFlags(ImageUsageFlagBits::eColorAttachment) | VkFlags(ImageUsageFlagBits::eDepthStencilAttachment) | VkFlags(ImageUsageFlagBits::eTransientAttachment) | VkFlags(ImageUsageFlagBits::eInputAttachment) | VkFlags(ImageUsageFlagBits::eShadingRateImageNV) }; }; @@ -20572,6 +22803,7 @@ public: eProtected = VK_IMAGE_CREATE_PROTECTED_BIT, eDisjoint = VK_IMAGE_CREATE_DISJOINT_BIT, eDisjointKHR = VK_IMAGE_CREATE_DISJOINT_BIT, + eCornerSampledNV = VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, eSampleLocationsCompatibleDepthEXT = VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT }; @@ -20591,7 +22823,7 @@ public: { enum { - allFlags = VkFlags(ImageCreateFlagBits::eSparseBinding) | VkFlags(ImageCreateFlagBits::eSparseResidency) | VkFlags(ImageCreateFlagBits::eSparseAliased) | VkFlags(ImageCreateFlagBits::eMutableFormat) | VkFlags(ImageCreateFlagBits::eCubeCompatible) | VkFlags(ImageCreateFlagBits::eAlias) | VkFlags(ImageCreateFlagBits::eSplitInstanceBindRegions) | VkFlags(ImageCreateFlagBits::e2DArrayCompatible) | VkFlags(ImageCreateFlagBits::eBlockTexelViewCompatible) | VkFlags(ImageCreateFlagBits::eExtendedUsage) | VkFlags(ImageCreateFlagBits::eProtected) | VkFlags(ImageCreateFlagBits::eDisjoint) | VkFlags(ImageCreateFlagBits::eSampleLocationsCompatibleDepthEXT) + allFlags = VkFlags(ImageCreateFlagBits::eSparseBinding) | VkFlags(ImageCreateFlagBits::eSparseResidency) | VkFlags(ImageCreateFlagBits::eSparseAliased) | VkFlags(ImageCreateFlagBits::eMutableFormat) | VkFlags(ImageCreateFlagBits::eCubeCompatible) | VkFlags(ImageCreateFlagBits::eAlias) | VkFlags(ImageCreateFlagBits::eSplitInstanceBindRegions) | VkFlags(ImageCreateFlagBits::e2DArrayCompatible) | VkFlags(ImageCreateFlagBits::eBlockTexelViewCompatible) | VkFlags(ImageCreateFlagBits::eExtendedUsage) | VkFlags(ImageCreateFlagBits::eProtected) | VkFlags(ImageCreateFlagBits::eDisjoint) | VkFlags(ImageCreateFlagBits::eCornerSampledNV) | VkFlags(ImageCreateFlagBits::eSampleLocationsCompatibleDepthEXT) }; }; @@ -20705,7 +22937,8 @@ public: eViewIndexFromDeviceIndex = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT, eViewIndexFromDeviceIndexKHR = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT, eDispatchBase = VK_PIPELINE_CREATE_DISPATCH_BASE, - eDispatchBaseKHR = VK_PIPELINE_CREATE_DISPATCH_BASE + eDispatchBaseKHR = VK_PIPELINE_CREATE_DISPATCH_BASE, + eDeferCompileNVX = VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NVX }; using PipelineCreateFlags = Flags; @@ -20724,7 +22957,7 @@ public: { enum { - allFlags = VkFlags(PipelineCreateFlagBits::eDisableOptimization) | VkFlags(PipelineCreateFlagBits::eAllowDerivatives) | VkFlags(PipelineCreateFlagBits::eDerivative) | VkFlags(PipelineCreateFlagBits::eViewIndexFromDeviceIndex) | VkFlags(PipelineCreateFlagBits::eDispatchBase) + allFlags = VkFlags(PipelineCreateFlagBits::eDisableOptimization) | VkFlags(PipelineCreateFlagBits::eAllowDerivatives) | VkFlags(PipelineCreateFlagBits::eDerivative) | VkFlags(PipelineCreateFlagBits::eViewIndexFromDeviceIndex) | VkFlags(PipelineCreateFlagBits::eDispatchBase) | VkFlags(PipelineCreateFlagBits::eDeferCompileNVX) }; }; @@ -20828,6 +23061,136 @@ public: }; static_assert( sizeof( ComputePipelineCreateInfo ) == sizeof( VkComputePipelineCreateInfo ), "struct and wrapper have different size!" ); + struct RaytracingPipelineCreateInfoNVX + { + RaytracingPipelineCreateInfoNVX( PipelineCreateFlags flags_ = PipelineCreateFlags(), + uint32_t stageCount_ = 0, + const PipelineShaderStageCreateInfo* pStages_ = nullptr, + const uint32_t* pGroupNumbers_ = nullptr, + uint32_t maxRecursionDepth_ = 0, + PipelineLayout layout_ = PipelineLayout(), + Pipeline basePipelineHandle_ = Pipeline(), + int32_t basePipelineIndex_ = 0 ) + : flags( flags_ ) + , stageCount( stageCount_ ) + , pStages( pStages_ ) + , pGroupNumbers( pGroupNumbers_ ) + , maxRecursionDepth( maxRecursionDepth_ ) + , layout( layout_ ) + , basePipelineHandle( basePipelineHandle_ ) + , basePipelineIndex( basePipelineIndex_ ) + { + } + + RaytracingPipelineCreateInfoNVX( VkRaytracingPipelineCreateInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( RaytracingPipelineCreateInfoNVX ) ); + } + + RaytracingPipelineCreateInfoNVX& operator=( VkRaytracingPipelineCreateInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( RaytracingPipelineCreateInfoNVX ) ); + return *this; + } + RaytracingPipelineCreateInfoNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setFlags( PipelineCreateFlags flags_ ) + { + flags = flags_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setStageCount( uint32_t stageCount_ ) + { + stageCount = stageCount_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setPStages( const PipelineShaderStageCreateInfo* pStages_ ) + { + pStages = pStages_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setPGroupNumbers( const uint32_t* pGroupNumbers_ ) + { + pGroupNumbers = pGroupNumbers_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setMaxRecursionDepth( uint32_t maxRecursionDepth_ ) + { + maxRecursionDepth = maxRecursionDepth_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setLayout( PipelineLayout layout_ ) + { + layout = layout_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setBasePipelineHandle( Pipeline basePipelineHandle_ ) + { + basePipelineHandle = basePipelineHandle_; + return *this; + } + + RaytracingPipelineCreateInfoNVX& setBasePipelineIndex( int32_t basePipelineIndex_ ) + { + basePipelineIndex = basePipelineIndex_; + return *this; + } + + operator VkRaytracingPipelineCreateInfoNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkRaytracingPipelineCreateInfoNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( RaytracingPipelineCreateInfoNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( flags == rhs.flags ) + && ( stageCount == rhs.stageCount ) + && ( pStages == rhs.pStages ) + && ( pGroupNumbers == rhs.pGroupNumbers ) + && ( maxRecursionDepth == rhs.maxRecursionDepth ) + && ( layout == rhs.layout ) + && ( basePipelineHandle == rhs.basePipelineHandle ) + && ( basePipelineIndex == rhs.basePipelineIndex ); + } + + bool operator!=( RaytracingPipelineCreateInfoNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eRaytracingPipelineCreateInfoNVX; + + public: + const void* pNext = nullptr; + PipelineCreateFlags flags; + uint32_t stageCount; + const PipelineShaderStageCreateInfo* pStages; + const uint32_t* pGroupNumbers; + uint32_t maxRecursionDepth; + PipelineLayout layout; + Pipeline basePipelineHandle; + int32_t basePipelineIndex; + }; + static_assert( sizeof( RaytracingPipelineCreateInfoNVX ) == sizeof( VkRaytracingPipelineCreateInfoNVX ), "struct and wrapper have different size!" ); + enum class ColorComponentFlagBits { eR = VK_COLOR_COMPONENT_R_BIT, @@ -23669,7 +26032,11 @@ public: eAllGraphics = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, eAllCommands = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, eConditionalRenderingEXT = VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT, - eCommandProcessNVX = VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX + eCommandProcessNVX = VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX, + eShadingRateImageNV = VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV, + eRaytracingNVX = VK_PIPELINE_STAGE_RAYTRACING_BIT_NVX, + eTaskShaderNV = VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, + eMeshShaderNV = VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV }; using PipelineStageFlags = Flags; @@ -23688,7 +26055,7 @@ public: { enum { - allFlags = VkFlags(PipelineStageFlagBits::eTopOfPipe) | VkFlags(PipelineStageFlagBits::eDrawIndirect) | VkFlags(PipelineStageFlagBits::eVertexInput) | VkFlags(PipelineStageFlagBits::eVertexShader) | VkFlags(PipelineStageFlagBits::eTessellationControlShader) | VkFlags(PipelineStageFlagBits::eTessellationEvaluationShader) | VkFlags(PipelineStageFlagBits::eGeometryShader) | VkFlags(PipelineStageFlagBits::eFragmentShader) | VkFlags(PipelineStageFlagBits::eEarlyFragmentTests) | VkFlags(PipelineStageFlagBits::eLateFragmentTests) | VkFlags(PipelineStageFlagBits::eColorAttachmentOutput) | VkFlags(PipelineStageFlagBits::eComputeShader) | VkFlags(PipelineStageFlagBits::eTransfer) | VkFlags(PipelineStageFlagBits::eBottomOfPipe) | VkFlags(PipelineStageFlagBits::eHost) | VkFlags(PipelineStageFlagBits::eAllGraphics) | VkFlags(PipelineStageFlagBits::eAllCommands) | VkFlags(PipelineStageFlagBits::eConditionalRenderingEXT) | VkFlags(PipelineStageFlagBits::eCommandProcessNVX) + allFlags = VkFlags(PipelineStageFlagBits::eTopOfPipe) | VkFlags(PipelineStageFlagBits::eDrawIndirect) | VkFlags(PipelineStageFlagBits::eVertexInput) | VkFlags(PipelineStageFlagBits::eVertexShader) | VkFlags(PipelineStageFlagBits::eTessellationControlShader) | VkFlags(PipelineStageFlagBits::eTessellationEvaluationShader) | VkFlags(PipelineStageFlagBits::eGeometryShader) | VkFlags(PipelineStageFlagBits::eFragmentShader) | VkFlags(PipelineStageFlagBits::eEarlyFragmentTests) | VkFlags(PipelineStageFlagBits::eLateFragmentTests) | VkFlags(PipelineStageFlagBits::eColorAttachmentOutput) | VkFlags(PipelineStageFlagBits::eComputeShader) | VkFlags(PipelineStageFlagBits::eTransfer) | VkFlags(PipelineStageFlagBits::eBottomOfPipe) | VkFlags(PipelineStageFlagBits::eHost) | VkFlags(PipelineStageFlagBits::eAllGraphics) | VkFlags(PipelineStageFlagBits::eAllCommands) | VkFlags(PipelineStageFlagBits::eConditionalRenderingEXT) | VkFlags(PipelineStageFlagBits::eCommandProcessNVX) | VkFlags(PipelineStageFlagBits::eShadingRateImageNV) | VkFlags(PipelineStageFlagBits::eRaytracingNVX) | VkFlags(PipelineStageFlagBits::eTaskShaderNV) | VkFlags(PipelineStageFlagBits::eMeshShaderNV) }; }; @@ -26731,7 +29098,8 @@ public: eSamplerYcbcrConversion = VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT, eSamplerYcbcrConversionKHR = VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT, eDescriptorUpdateTemplate = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT, - eDescriptorUpdateTemplateKHR = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT + eDescriptorUpdateTemplateKHR = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT, + eAccelerationStructureNVX = VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX_EXT }; struct DebugMarkerObjectNameInfoEXT @@ -33351,6 +35719,615 @@ public: }; static_assert( sizeof( ConditionalRenderingBeginInfoEXT ) == sizeof( VkConditionalRenderingBeginInfoEXT ), "struct and wrapper have different size!" ); + enum class ShadingRatePaletteEntryNV + { + eNoInvocations = VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV, + e16InvocationsPerPixel = VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV, + e8InvocationsPerPixel = VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV, + e4InvocationsPerPixel = VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV, + e2InvocationsPerPixel = VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV, + e1InvocationPerPixel = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV, + e1InvocationPer2X1Pixels = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV, + e1InvocationPer1X2Pixels = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV, + e1InvocationPer2X2Pixels = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV, + e1InvocationPer4X2Pixels = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV, + e1InvocationPer2X4Pixels = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV, + e1InvocationPer4X4Pixels = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV + }; + + struct ShadingRatePaletteNV + { + ShadingRatePaletteNV( uint32_t shadingRatePaletteEntryCount_ = 0, + const ShadingRatePaletteEntryNV* pShadingRatePaletteEntries_ = nullptr ) + : shadingRatePaletteEntryCount( shadingRatePaletteEntryCount_ ) + , pShadingRatePaletteEntries( pShadingRatePaletteEntries_ ) + { + } + + ShadingRatePaletteNV( VkShadingRatePaletteNV const & rhs ) + { + memcpy( this, &rhs, sizeof( ShadingRatePaletteNV ) ); + } + + ShadingRatePaletteNV& operator=( VkShadingRatePaletteNV const & rhs ) + { + memcpy( this, &rhs, sizeof( ShadingRatePaletteNV ) ); + return *this; + } + ShadingRatePaletteNV& setShadingRatePaletteEntryCount( uint32_t shadingRatePaletteEntryCount_ ) + { + shadingRatePaletteEntryCount = shadingRatePaletteEntryCount_; + return *this; + } + + ShadingRatePaletteNV& setPShadingRatePaletteEntries( const ShadingRatePaletteEntryNV* pShadingRatePaletteEntries_ ) + { + pShadingRatePaletteEntries = pShadingRatePaletteEntries_; + return *this; + } + + operator VkShadingRatePaletteNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkShadingRatePaletteNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( ShadingRatePaletteNV const& rhs ) const + { + return ( shadingRatePaletteEntryCount == rhs.shadingRatePaletteEntryCount ) + && ( pShadingRatePaletteEntries == rhs.pShadingRatePaletteEntries ); + } + + bool operator!=( ShadingRatePaletteNV const& rhs ) const + { + return !operator==( rhs ); + } + + uint32_t shadingRatePaletteEntryCount; + const ShadingRatePaletteEntryNV* pShadingRatePaletteEntries; + }; + static_assert( sizeof( ShadingRatePaletteNV ) == sizeof( VkShadingRatePaletteNV ), "struct and wrapper have different size!" ); + + struct PipelineViewportShadingRateImageStateCreateInfoNV + { + PipelineViewportShadingRateImageStateCreateInfoNV( Bool32 shadingRateImageEnable_ = 0, + uint32_t viewportCount_ = 0, + const ShadingRatePaletteNV* pShadingRatePalettes_ = nullptr ) + : shadingRateImageEnable( shadingRateImageEnable_ ) + , viewportCount( viewportCount_ ) + , pShadingRatePalettes( pShadingRatePalettes_ ) + { + } + + PipelineViewportShadingRateImageStateCreateInfoNV( VkPipelineViewportShadingRateImageStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineViewportShadingRateImageStateCreateInfoNV ) ); + } + + PipelineViewportShadingRateImageStateCreateInfoNV& operator=( VkPipelineViewportShadingRateImageStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineViewportShadingRateImageStateCreateInfoNV ) ); + return *this; + } + PipelineViewportShadingRateImageStateCreateInfoNV& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PipelineViewportShadingRateImageStateCreateInfoNV& setShadingRateImageEnable( Bool32 shadingRateImageEnable_ ) + { + shadingRateImageEnable = shadingRateImageEnable_; + return *this; + } + + PipelineViewportShadingRateImageStateCreateInfoNV& setViewportCount( uint32_t viewportCount_ ) + { + viewportCount = viewportCount_; + return *this; + } + + PipelineViewportShadingRateImageStateCreateInfoNV& setPShadingRatePalettes( const ShadingRatePaletteNV* pShadingRatePalettes_ ) + { + pShadingRatePalettes = pShadingRatePalettes_; + return *this; + } + + operator VkPipelineViewportShadingRateImageStateCreateInfoNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPipelineViewportShadingRateImageStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PipelineViewportShadingRateImageStateCreateInfoNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( shadingRateImageEnable == rhs.shadingRateImageEnable ) + && ( viewportCount == rhs.viewportCount ) + && ( pShadingRatePalettes == rhs.pShadingRatePalettes ); + } + + bool operator!=( PipelineViewportShadingRateImageStateCreateInfoNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePipelineViewportShadingRateImageStateCreateInfoNV; + + public: + const void* pNext = nullptr; + Bool32 shadingRateImageEnable; + uint32_t viewportCount; + const ShadingRatePaletteNV* pShadingRatePalettes; + }; + static_assert( sizeof( PipelineViewportShadingRateImageStateCreateInfoNV ) == sizeof( VkPipelineViewportShadingRateImageStateCreateInfoNV ), "struct and wrapper have different size!" ); + + struct CoarseSampleOrderCustomNV + { + CoarseSampleOrderCustomNV( ShadingRatePaletteEntryNV shadingRate_ = ShadingRatePaletteEntryNV::eNoInvocations, + uint32_t sampleCount_ = 0, + uint32_t sampleLocationCount_ = 0, + const CoarseSampleLocationNV* pSampleLocations_ = nullptr ) + : shadingRate( shadingRate_ ) + , sampleCount( sampleCount_ ) + , sampleLocationCount( sampleLocationCount_ ) + , pSampleLocations( pSampleLocations_ ) + { + } + + CoarseSampleOrderCustomNV( VkCoarseSampleOrderCustomNV const & rhs ) + { + memcpy( this, &rhs, sizeof( CoarseSampleOrderCustomNV ) ); + } + + CoarseSampleOrderCustomNV& operator=( VkCoarseSampleOrderCustomNV const & rhs ) + { + memcpy( this, &rhs, sizeof( CoarseSampleOrderCustomNV ) ); + return *this; + } + CoarseSampleOrderCustomNV& setShadingRate( ShadingRatePaletteEntryNV shadingRate_ ) + { + shadingRate = shadingRate_; + return *this; + } + + CoarseSampleOrderCustomNV& setSampleCount( uint32_t sampleCount_ ) + { + sampleCount = sampleCount_; + return *this; + } + + CoarseSampleOrderCustomNV& setSampleLocationCount( uint32_t sampleLocationCount_ ) + { + sampleLocationCount = sampleLocationCount_; + return *this; + } + + CoarseSampleOrderCustomNV& setPSampleLocations( const CoarseSampleLocationNV* pSampleLocations_ ) + { + pSampleLocations = pSampleLocations_; + return *this; + } + + operator VkCoarseSampleOrderCustomNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkCoarseSampleOrderCustomNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( CoarseSampleOrderCustomNV const& rhs ) const + { + return ( shadingRate == rhs.shadingRate ) + && ( sampleCount == rhs.sampleCount ) + && ( sampleLocationCount == rhs.sampleLocationCount ) + && ( pSampleLocations == rhs.pSampleLocations ); + } + + bool operator!=( CoarseSampleOrderCustomNV const& rhs ) const + { + return !operator==( rhs ); + } + + ShadingRatePaletteEntryNV shadingRate; + uint32_t sampleCount; + uint32_t sampleLocationCount; + const CoarseSampleLocationNV* pSampleLocations; + }; + static_assert( sizeof( CoarseSampleOrderCustomNV ) == sizeof( VkCoarseSampleOrderCustomNV ), "struct and wrapper have different size!" ); + + enum class CoarseSampleOrderTypeNV + { + eDefault = VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV, + eCustom = VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV, + ePixelMajor = VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV, + eSampleMajor = VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV + }; + + struct PipelineViewportCoarseSampleOrderStateCreateInfoNV + { + PipelineViewportCoarseSampleOrderStateCreateInfoNV( CoarseSampleOrderTypeNV sampleOrderType_ = CoarseSampleOrderTypeNV::eDefault, + uint32_t customSampleOrderCount_ = 0, + const CoarseSampleOrderCustomNV* pCustomSampleOrders_ = nullptr ) + : sampleOrderType( sampleOrderType_ ) + , customSampleOrderCount( customSampleOrderCount_ ) + , pCustomSampleOrders( pCustomSampleOrders_ ) + { + } + + PipelineViewportCoarseSampleOrderStateCreateInfoNV( VkPipelineViewportCoarseSampleOrderStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineViewportCoarseSampleOrderStateCreateInfoNV ) ); + } + + PipelineViewportCoarseSampleOrderStateCreateInfoNV& operator=( VkPipelineViewportCoarseSampleOrderStateCreateInfoNV const & rhs ) + { + memcpy( this, &rhs, sizeof( PipelineViewportCoarseSampleOrderStateCreateInfoNV ) ); + return *this; + } + PipelineViewportCoarseSampleOrderStateCreateInfoNV& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + PipelineViewportCoarseSampleOrderStateCreateInfoNV& setSampleOrderType( CoarseSampleOrderTypeNV sampleOrderType_ ) + { + sampleOrderType = sampleOrderType_; + return *this; + } + + PipelineViewportCoarseSampleOrderStateCreateInfoNV& setCustomSampleOrderCount( uint32_t customSampleOrderCount_ ) + { + customSampleOrderCount = customSampleOrderCount_; + return *this; + } + + PipelineViewportCoarseSampleOrderStateCreateInfoNV& setPCustomSampleOrders( const CoarseSampleOrderCustomNV* pCustomSampleOrders_ ) + { + pCustomSampleOrders = pCustomSampleOrders_; + return *this; + } + + operator VkPipelineViewportCoarseSampleOrderStateCreateInfoNV const&() const + { + return *reinterpret_cast(this); + } + + operator VkPipelineViewportCoarseSampleOrderStateCreateInfoNV &() + { + return *reinterpret_cast(this); + } + + bool operator==( PipelineViewportCoarseSampleOrderStateCreateInfoNV const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( sampleOrderType == rhs.sampleOrderType ) + && ( customSampleOrderCount == rhs.customSampleOrderCount ) + && ( pCustomSampleOrders == rhs.pCustomSampleOrders ); + } + + bool operator!=( PipelineViewportCoarseSampleOrderStateCreateInfoNV const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::ePipelineViewportCoarseSampleOrderStateCreateInfoNV; + + public: + const void* pNext = nullptr; + CoarseSampleOrderTypeNV sampleOrderType; + uint32_t customSampleOrderCount; + const CoarseSampleOrderCustomNV* pCustomSampleOrders; + }; + static_assert( sizeof( PipelineViewportCoarseSampleOrderStateCreateInfoNV ) == sizeof( VkPipelineViewportCoarseSampleOrderStateCreateInfoNV ), "struct and wrapper have different size!" ); + + enum class GeometryInstanceFlagBitsNVX + { + eTriangleCullDisable = VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NVX, + eTriangleCullFlipWinding = VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_FLIP_WINDING_BIT_NVX, + eForceOpaque = VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NVX, + eForceNoOpaque = VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NVX + }; + + using GeometryInstanceFlagsNVX = Flags; + + VULKAN_HPP_INLINE GeometryInstanceFlagsNVX operator|( GeometryInstanceFlagBitsNVX bit0, GeometryInstanceFlagBitsNVX bit1 ) + { + return GeometryInstanceFlagsNVX( bit0 ) | bit1; + } + + VULKAN_HPP_INLINE GeometryInstanceFlagsNVX operator~( GeometryInstanceFlagBitsNVX bits ) + { + return ~( GeometryInstanceFlagsNVX( bits ) ); + } + + template <> struct FlagTraits + { + enum + { + allFlags = VkFlags(GeometryInstanceFlagBitsNVX::eTriangleCullDisable) | VkFlags(GeometryInstanceFlagBitsNVX::eTriangleCullFlipWinding) | VkFlags(GeometryInstanceFlagBitsNVX::eForceOpaque) | VkFlags(GeometryInstanceFlagBitsNVX::eForceNoOpaque) + }; + }; + + enum class GeometryFlagBitsNVX + { + eOpaque = VK_GEOMETRY_OPAQUE_BIT_NVX, + eNoDuplicateAnyHitInvocation = VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NVX + }; + + using GeometryFlagsNVX = Flags; + + VULKAN_HPP_INLINE GeometryFlagsNVX operator|( GeometryFlagBitsNVX bit0, GeometryFlagBitsNVX bit1 ) + { + return GeometryFlagsNVX( bit0 ) | bit1; + } + + VULKAN_HPP_INLINE GeometryFlagsNVX operator~( GeometryFlagBitsNVX bits ) + { + return ~( GeometryFlagsNVX( bits ) ); + } + + template <> struct FlagTraits + { + enum + { + allFlags = VkFlags(GeometryFlagBitsNVX::eOpaque) | VkFlags(GeometryFlagBitsNVX::eNoDuplicateAnyHitInvocation) + }; + }; + + enum class BuildAccelerationStructureFlagBitsNVX + { + eAllowUpdate = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NVX, + eAllowCompaction = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVX, + ePreferFastTrace = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NVX, + ePreferFastBuild = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NVX, + eLowMemory = VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NVX + }; + + using BuildAccelerationStructureFlagsNVX = Flags; + + VULKAN_HPP_INLINE BuildAccelerationStructureFlagsNVX operator|( BuildAccelerationStructureFlagBitsNVX bit0, BuildAccelerationStructureFlagBitsNVX bit1 ) + { + return BuildAccelerationStructureFlagsNVX( bit0 ) | bit1; + } + + VULKAN_HPP_INLINE BuildAccelerationStructureFlagsNVX operator~( BuildAccelerationStructureFlagBitsNVX bits ) + { + return ~( BuildAccelerationStructureFlagsNVX( bits ) ); + } + + template <> struct FlagTraits + { + enum + { + allFlags = VkFlags(BuildAccelerationStructureFlagBitsNVX::eAllowUpdate) | VkFlags(BuildAccelerationStructureFlagBitsNVX::eAllowCompaction) | VkFlags(BuildAccelerationStructureFlagBitsNVX::ePreferFastTrace) | VkFlags(BuildAccelerationStructureFlagBitsNVX::ePreferFastBuild) | VkFlags(BuildAccelerationStructureFlagBitsNVX::eLowMemory) + }; + }; + + enum class CopyAccelerationStructureModeNVX + { + eClone = VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NVX, + eCompact = VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVX + }; + + enum class AccelerationStructureTypeNVX + { + eTopLevel = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NVX, + eBottomLevel = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NVX + }; + + enum class GeometryTypeNVX + { + eTriangles = VK_GEOMETRY_TYPE_TRIANGLES_NVX, + eAabbs = VK_GEOMETRY_TYPE_AABBS_NVX + }; + + struct GeometryNVX + { + GeometryNVX( GeometryTypeNVX geometryType_ = GeometryTypeNVX::eTriangles, + GeometryDataNVX geometry_ = GeometryDataNVX(), + GeometryFlagsNVX flags_ = GeometryFlagsNVX() ) + : geometryType( geometryType_ ) + , geometry( geometry_ ) + , flags( flags_ ) + { + } + + GeometryNVX( VkGeometryNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryNVX ) ); + } + + GeometryNVX& operator=( VkGeometryNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( GeometryNVX ) ); + return *this; + } + GeometryNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + GeometryNVX& setGeometryType( GeometryTypeNVX geometryType_ ) + { + geometryType = geometryType_; + return *this; + } + + GeometryNVX& setGeometry( GeometryDataNVX geometry_ ) + { + geometry = geometry_; + return *this; + } + + GeometryNVX& setFlags( GeometryFlagsNVX flags_ ) + { + flags = flags_; + return *this; + } + + operator VkGeometryNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkGeometryNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( GeometryNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( geometryType == rhs.geometryType ) + && ( geometry == rhs.geometry ) + && ( flags == rhs.flags ); + } + + bool operator!=( GeometryNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eGeometryNVX; + + public: + const void* pNext = nullptr; + GeometryTypeNVX geometryType; + GeometryDataNVX geometry; + GeometryFlagsNVX flags; + }; + static_assert( sizeof( GeometryNVX ) == sizeof( VkGeometryNVX ), "struct and wrapper have different size!" ); + + struct AccelerationStructureCreateInfoNVX + { + AccelerationStructureCreateInfoNVX( AccelerationStructureTypeNVX type_ = AccelerationStructureTypeNVX::eTopLevel, + BuildAccelerationStructureFlagsNVX flags_ = BuildAccelerationStructureFlagsNVX(), + DeviceSize compactedSize_ = 0, + uint32_t instanceCount_ = 0, + uint32_t geometryCount_ = 0, + const GeometryNVX* pGeometries_ = nullptr ) + : type( type_ ) + , flags( flags_ ) + , compactedSize( compactedSize_ ) + , instanceCount( instanceCount_ ) + , geometryCount( geometryCount_ ) + , pGeometries( pGeometries_ ) + { + } + + AccelerationStructureCreateInfoNVX( VkAccelerationStructureCreateInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( AccelerationStructureCreateInfoNVX ) ); + } + + AccelerationStructureCreateInfoNVX& operator=( VkAccelerationStructureCreateInfoNVX const & rhs ) + { + memcpy( this, &rhs, sizeof( AccelerationStructureCreateInfoNVX ) ); + return *this; + } + AccelerationStructureCreateInfoNVX& setPNext( const void* pNext_ ) + { + pNext = pNext_; + return *this; + } + + AccelerationStructureCreateInfoNVX& setType( AccelerationStructureTypeNVX type_ ) + { + type = type_; + return *this; + } + + AccelerationStructureCreateInfoNVX& setFlags( BuildAccelerationStructureFlagsNVX flags_ ) + { + flags = flags_; + return *this; + } + + AccelerationStructureCreateInfoNVX& setCompactedSize( DeviceSize compactedSize_ ) + { + compactedSize = compactedSize_; + return *this; + } + + AccelerationStructureCreateInfoNVX& setInstanceCount( uint32_t instanceCount_ ) + { + instanceCount = instanceCount_; + return *this; + } + + AccelerationStructureCreateInfoNVX& setGeometryCount( uint32_t geometryCount_ ) + { + geometryCount = geometryCount_; + return *this; + } + + AccelerationStructureCreateInfoNVX& setPGeometries( const GeometryNVX* pGeometries_ ) + { + pGeometries = pGeometries_; + return *this; + } + + operator VkAccelerationStructureCreateInfoNVX const&() const + { + return *reinterpret_cast(this); + } + + operator VkAccelerationStructureCreateInfoNVX &() + { + return *reinterpret_cast(this); + } + + bool operator==( AccelerationStructureCreateInfoNVX const& rhs ) const + { + return ( sType == rhs.sType ) + && ( pNext == rhs.pNext ) + && ( type == rhs.type ) + && ( flags == rhs.flags ) + && ( compactedSize == rhs.compactedSize ) + && ( instanceCount == rhs.instanceCount ) + && ( geometryCount == rhs.geometryCount ) + && ( pGeometries == rhs.pGeometries ); + } + + bool operator!=( AccelerationStructureCreateInfoNVX const& rhs ) const + { + return !operator==( rhs ); + } + + private: + StructureType sType = StructureType::eAccelerationStructureCreateInfoNVX; + + public: + const void* pNext = nullptr; + AccelerationStructureTypeNVX type; + BuildAccelerationStructureFlagsNVX flags; + DeviceSize compactedSize; + uint32_t instanceCount; + uint32_t geometryCount; + const GeometryNVX* pGeometries; + }; + static_assert( sizeof( AccelerationStructureCreateInfoNVX ) == sizeof( VkAccelerationStructureCreateInfoNVX ), "struct and wrapper have different size!" ); + template Result enumerateInstanceVersion( uint32_t* pApiVersion, Dispatch const &d = Dispatch() ); #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE @@ -33862,6 +36839,55 @@ public: template void setCheckpointNV( const void* pCheckpointMarker, Dispatch const &d = Dispatch() ) const; + template + void setExclusiveScissorNV( uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const Rect2D* pExclusiveScissors, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + void setExclusiveScissorNV( uint32_t firstExclusiveScissor, ArrayProxy exclusiveScissors, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void bindShadingRateImageNV( ImageView imageView, ImageLayout imageLayout, Dispatch const &d = Dispatch() ) const; + + template + void setViewportShadingRatePaletteNV( uint32_t firstViewport, uint32_t viewportCount, const ShadingRatePaletteNV* pShadingRatePalettes, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + void setViewportShadingRatePaletteNV( uint32_t firstViewport, ArrayProxy shadingRatePalettes, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void setCoarseSampleOrderNV( CoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const CoarseSampleOrderCustomNV* pCustomSampleOrders, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + void setCoarseSampleOrderNV( CoarseSampleOrderTypeNV sampleOrderType, ArrayProxy customSampleOrders, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void drawMeshTasksNV( uint32_t taskCount, uint32_t firstTask, Dispatch const &d = Dispatch() ) const; + + template + void drawMeshTasksIndirectNV( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride, Dispatch const &d = Dispatch() ) const; + + template + void drawMeshTasksIndirectCountNV( Buffer buffer, DeviceSize offset, Buffer countBuffer, DeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride, Dispatch const &d = Dispatch() ) const; + + template + void copyAccelerationStructureNVX( AccelerationStructureNVX dst, AccelerationStructureNVX src, CopyAccelerationStructureModeNVX mode, Dispatch const &d = Dispatch() ) const; + + template + void writeAccelerationStructurePropertiesNVX( AccelerationStructureNVX accelerationStructure, QueryType queryType, QueryPool queryPool, uint32_t query, Dispatch const &d = Dispatch() ) const; + + template + void buildAccelerationStructureNVX( AccelerationStructureTypeNVX type, uint32_t instanceCount, Buffer instanceData, DeviceSize instanceOffset, uint32_t geometryCount, const GeometryNVX* pGeometries, BuildAccelerationStructureFlagsNVX flags, Bool32 update, AccelerationStructureNVX dst, AccelerationStructureNVX src, Buffer scratch, DeviceSize scratchOffset, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + void buildAccelerationStructureNVX( AccelerationStructureTypeNVX type, uint32_t instanceCount, Buffer instanceData, DeviceSize instanceOffset, ArrayProxy geometries, BuildAccelerationStructureFlagsNVX flags, Bool32 update, AccelerationStructureNVX dst, AccelerationStructureNVX src, Buffer scratch, DeviceSize scratchOffset, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void traceRaysNVX( Buffer raygenShaderBindingTableBuffer, DeviceSize raygenShaderBindingOffset, Buffer missShaderBindingTableBuffer, DeviceSize missShaderBindingOffset, DeviceSize missShaderBindingStride, Buffer hitShaderBindingTableBuffer, DeviceSize hitShaderBindingOffset, DeviceSize hitShaderBindingStride, uint32_t width, uint32_t height, Dispatch const &d = Dispatch() ) const; + VULKAN_HPP_TYPESAFE_EXPLICIT operator VkCommandBuffer() const @@ -34912,6 +37938,156 @@ public: } #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + template + VULKAN_HPP_INLINE void CommandBuffer::setExclusiveScissorNV( uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const Rect2D* pExclusiveScissors, Dispatch const &d) const + { + d.vkCmdSetExclusiveScissorNV( m_commandBuffer, firstExclusiveScissor, exclusiveScissorCount, reinterpret_cast( pExclusiveScissors ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::setExclusiveScissorNV( uint32_t firstExclusiveScissor, ArrayProxy exclusiveScissors, Dispatch const &d ) const + { + d.vkCmdSetExclusiveScissorNV( m_commandBuffer, firstExclusiveScissor, exclusiveScissors.size() , reinterpret_cast( exclusiveScissors.data() ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::bindShadingRateImageNV( ImageView imageView, ImageLayout imageLayout, Dispatch const &d) const + { + d.vkCmdBindShadingRateImageNV( m_commandBuffer, static_cast( imageView ), static_cast( imageLayout ) ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::bindShadingRateImageNV( ImageView imageView, ImageLayout imageLayout, Dispatch const &d ) const + { + d.vkCmdBindShadingRateImageNV( m_commandBuffer, static_cast( imageView ), static_cast( imageLayout ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void CommandBuffer::setViewportShadingRatePaletteNV( uint32_t firstViewport, uint32_t viewportCount, const ShadingRatePaletteNV* pShadingRatePalettes, Dispatch const &d) const + { + d.vkCmdSetViewportShadingRatePaletteNV( m_commandBuffer, firstViewport, viewportCount, reinterpret_cast( pShadingRatePalettes ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::setViewportShadingRatePaletteNV( uint32_t firstViewport, ArrayProxy shadingRatePalettes, Dispatch const &d ) const + { + d.vkCmdSetViewportShadingRatePaletteNV( m_commandBuffer, firstViewport, shadingRatePalettes.size() , reinterpret_cast( shadingRatePalettes.data() ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void CommandBuffer::setCoarseSampleOrderNV( CoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const CoarseSampleOrderCustomNV* pCustomSampleOrders, Dispatch const &d) const + { + d.vkCmdSetCoarseSampleOrderNV( m_commandBuffer, static_cast( sampleOrderType ), customSampleOrderCount, reinterpret_cast( pCustomSampleOrders ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::setCoarseSampleOrderNV( CoarseSampleOrderTypeNV sampleOrderType, ArrayProxy customSampleOrders, Dispatch const &d ) const + { + d.vkCmdSetCoarseSampleOrderNV( m_commandBuffer, static_cast( sampleOrderType ), customSampleOrders.size() , reinterpret_cast( customSampleOrders.data() ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::drawMeshTasksNV( uint32_t taskCount, uint32_t firstTask, Dispatch const &d) const + { + d.vkCmdDrawMeshTasksNV( m_commandBuffer, taskCount, firstTask ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::drawMeshTasksNV( uint32_t taskCount, uint32_t firstTask, Dispatch const &d ) const + { + d.vkCmdDrawMeshTasksNV( m_commandBuffer, taskCount, firstTask ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::drawMeshTasksIndirectNV( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride, Dispatch const &d) const + { + d.vkCmdDrawMeshTasksIndirectNV( m_commandBuffer, static_cast( buffer ), offset, drawCount, stride ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::drawMeshTasksIndirectNV( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride, Dispatch const &d ) const + { + d.vkCmdDrawMeshTasksIndirectNV( m_commandBuffer, static_cast( buffer ), offset, drawCount, stride ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::drawMeshTasksIndirectCountNV( Buffer buffer, DeviceSize offset, Buffer countBuffer, DeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride, Dispatch const &d) const + { + d.vkCmdDrawMeshTasksIndirectCountNV( m_commandBuffer, static_cast( buffer ), offset, static_cast( countBuffer ), countBufferOffset, maxDrawCount, stride ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::drawMeshTasksIndirectCountNV( Buffer buffer, DeviceSize offset, Buffer countBuffer, DeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride, Dispatch const &d ) const + { + d.vkCmdDrawMeshTasksIndirectCountNV( m_commandBuffer, static_cast( buffer ), offset, static_cast( countBuffer ), countBufferOffset, maxDrawCount, stride ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::copyAccelerationStructureNVX( AccelerationStructureNVX dst, AccelerationStructureNVX src, CopyAccelerationStructureModeNVX mode, Dispatch const &d) const + { + d.vkCmdCopyAccelerationStructureNVX( m_commandBuffer, static_cast( dst ), static_cast( src ), static_cast( mode ) ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::copyAccelerationStructureNVX( AccelerationStructureNVX dst, AccelerationStructureNVX src, CopyAccelerationStructureModeNVX mode, Dispatch const &d ) const + { + d.vkCmdCopyAccelerationStructureNVX( m_commandBuffer, static_cast( dst ), static_cast( src ), static_cast( mode ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::writeAccelerationStructurePropertiesNVX( AccelerationStructureNVX accelerationStructure, QueryType queryType, QueryPool queryPool, uint32_t query, Dispatch const &d) const + { + d.vkCmdWriteAccelerationStructurePropertiesNVX( m_commandBuffer, static_cast( accelerationStructure ), static_cast( queryType ), static_cast( queryPool ), query ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::writeAccelerationStructurePropertiesNVX( AccelerationStructureNVX accelerationStructure, QueryType queryType, QueryPool queryPool, uint32_t query, Dispatch const &d ) const + { + d.vkCmdWriteAccelerationStructurePropertiesNVX( m_commandBuffer, static_cast( accelerationStructure ), static_cast( queryType ), static_cast( queryPool ), query ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void CommandBuffer::buildAccelerationStructureNVX( AccelerationStructureTypeNVX type, uint32_t instanceCount, Buffer instanceData, DeviceSize instanceOffset, uint32_t geometryCount, const GeometryNVX* pGeometries, BuildAccelerationStructureFlagsNVX flags, Bool32 update, AccelerationStructureNVX dst, AccelerationStructureNVX src, Buffer scratch, DeviceSize scratchOffset, Dispatch const &d) const + { + d.vkCmdBuildAccelerationStructureNVX( m_commandBuffer, static_cast( type ), instanceCount, static_cast( instanceData ), instanceOffset, geometryCount, reinterpret_cast( pGeometries ), static_cast( flags ), update, static_cast( dst ), static_cast( src ), static_cast( scratch ), scratchOffset ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::buildAccelerationStructureNVX( AccelerationStructureTypeNVX type, uint32_t instanceCount, Buffer instanceData, DeviceSize instanceOffset, ArrayProxy geometries, BuildAccelerationStructureFlagsNVX flags, Bool32 update, AccelerationStructureNVX dst, AccelerationStructureNVX src, Buffer scratch, DeviceSize scratchOffset, Dispatch const &d ) const + { + d.vkCmdBuildAccelerationStructureNVX( m_commandBuffer, static_cast( type ), instanceCount, static_cast( instanceData ), instanceOffset, geometries.size() , reinterpret_cast( geometries.data() ), static_cast( flags ), update, static_cast( dst ), static_cast( src ), static_cast( scratch ), scratchOffset ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void CommandBuffer::traceRaysNVX( Buffer raygenShaderBindingTableBuffer, DeviceSize raygenShaderBindingOffset, Buffer missShaderBindingTableBuffer, DeviceSize missShaderBindingOffset, DeviceSize missShaderBindingStride, Buffer hitShaderBindingTableBuffer, DeviceSize hitShaderBindingOffset, DeviceSize hitShaderBindingStride, uint32_t width, uint32_t height, Dispatch const &d) const + { + d.vkCmdTraceRaysNVX( m_commandBuffer, static_cast( raygenShaderBindingTableBuffer ), raygenShaderBindingOffset, static_cast( missShaderBindingTableBuffer ), missShaderBindingOffset, missShaderBindingStride, static_cast( hitShaderBindingTableBuffer ), hitShaderBindingOffset, hitShaderBindingStride, width, height ); + } +#else + template + VULKAN_HPP_INLINE void CommandBuffer::traceRaysNVX( Buffer raygenShaderBindingTableBuffer, DeviceSize raygenShaderBindingOffset, Buffer missShaderBindingTableBuffer, DeviceSize missShaderBindingOffset, DeviceSize missShaderBindingStride, Buffer hitShaderBindingTableBuffer, DeviceSize hitShaderBindingOffset, DeviceSize hitShaderBindingStride, uint32_t width, uint32_t height, Dispatch const &d ) const + { + d.vkCmdTraceRaysNVX( m_commandBuffer, static_cast( raygenShaderBindingTableBuffer ), raygenShaderBindingOffset, static_cast( missShaderBindingTableBuffer ), missShaderBindingOffset, missShaderBindingStride, static_cast( hitShaderBindingTableBuffer ), hitShaderBindingOffset, hitShaderBindingStride, width, height ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + struct SubmitInfo { SubmitInfo( uint32_t waitSemaphoreCount_ = 0, @@ -35270,6 +38446,8 @@ public: #ifndef VULKAN_HPP_NO_SMART_HANDLE class Device; + template class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; + using UniqueAccelerationStructureNVX = UniqueHandle; template class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueBuffer = UniqueHandle; template class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; @@ -36728,6 +39906,89 @@ public: #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VK_USE_PLATFORM_ANDROID_ANDROID*/ +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + Result compileDeferredNVX( Pipeline pipeline, uint32_t shader, Dispatch const &d = Dispatch() ) const; +#else + template + ResultValueType::type compileDeferredNVX( Pipeline pipeline, uint32_t shader, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + Result createAccelerationStructureNVX( const AccelerationStructureCreateInfoNVX* pCreateInfo, const AllocationCallbacks* pAllocator, AccelerationStructureNVX* pAccelerationStructure, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + ResultValueType::type createAccelerationStructureNVX( const AccelerationStructureCreateInfoNVX & createInfo, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_NO_SMART_HANDLE + template + typename ResultValueType>::type createAccelerationStructureNVXUnique( const AccelerationStructureCreateInfoNVX & createInfo, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_NO_SMART_HANDLE*/ +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void destroyAccelerationStructureNVX( AccelerationStructureNVX accelerationStructure, const AllocationCallbacks* pAllocator, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + void destroyAccelerationStructureNVX( AccelerationStructureNVX accelerationStructure, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void destroy( AccelerationStructureNVX accelerationStructure, const AllocationCallbacks* pAllocator, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + void destroy( AccelerationStructureNVX accelerationStructure, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void getAccelerationStructureMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX* pInfo, MemoryRequirements2KHR* pMemoryRequirements, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + MemoryRequirements2KHR getAccelerationStructureMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX & info, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + void getAccelerationStructureScratchMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX* pInfo, MemoryRequirements2KHR* pMemoryRequirements, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + MemoryRequirements2KHR getAccelerationStructureScratchMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX & info, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + Result bindAccelerationStructureMemoryNVX( uint32_t bindInfoCount, const BindAccelerationStructureMemoryInfoNVX* pBindInfos, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + ResultValueType::type bindAccelerationStructureMemoryNVX( ArrayProxy bindInfos, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + Result getRaytracingShaderHandlesNVX( Pipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + ResultValueType::type getRaytracingShaderHandlesNVX( Pipeline pipeline, uint32_t firstGroup, uint32_t groupCount, ArrayProxy data, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + Result getAccelerationStructureHandleNVX( AccelerationStructureNVX accelerationStructure, size_t dataSize, void* pData, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + ResultValueType::type getAccelerationStructureHandleNVX( AccelerationStructureNVX accelerationStructure, ArrayProxy data, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + Result createRaytracingPipelinesNVX( PipelineCache pipelineCache, uint32_t createInfoCount, const RaytracingPipelineCreateInfoNVX* pCreateInfos, const AllocationCallbacks* pAllocator, Pipeline* pPipelines, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template , typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type createRaytracingPipelinesNVX( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; + template , typename Dispatch = DispatchLoaderStatic> + ResultValueType::type createRaytracingPipelineNVX( PipelineCache pipelineCache, const RaytracingPipelineCreateInfoNVX & createInfo, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; +#ifndef VULKAN_HPP_NO_SMART_HANDLE + template , typename Dispatch = DispatchLoaderStatic> + typename ResultValueType,Allocator>>::type createRaytracingPipelinesNVXUnique( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; + template , typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type createRaytracingPipelineNVXUnique( PipelineCache pipelineCache, const RaytracingPipelineCreateInfoNVX & createInfo, Optional allocator = nullptr, Dispatch const &d = Dispatch() ) const; +#endif /*VULKAN_HPP_NO_SMART_HANDLE*/ +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + VULKAN_HPP_TYPESAFE_EXPLICIT operator VkDevice() const @@ -39808,6 +43069,195 @@ public: #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VK_USE_PLATFORM_ANDROID_ANDROID*/ +#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE Result Device::compileDeferredNVX( Pipeline pipeline, uint32_t shader, Dispatch const &d) const + { + return static_cast( d.vkCompileDeferredNVX( m_device, static_cast( pipeline ), shader ) ); + } +#else + template + VULKAN_HPP_INLINE ResultValueType::type Device::compileDeferredNVX( Pipeline pipeline, uint32_t shader, Dispatch const &d ) const + { + Result result = static_cast( d.vkCompileDeferredNVX( m_device, static_cast( pipeline ), shader ) ); + return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING"::Device::compileDeferredNVX" ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE Result Device::createAccelerationStructureNVX( const AccelerationStructureCreateInfoNVX* pCreateInfo, const AllocationCallbacks* pAllocator, AccelerationStructureNVX* pAccelerationStructure, Dispatch const &d) const + { + return static_cast( d.vkCreateAccelerationStructureNVX( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pAccelerationStructure ) ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE ResultValueType::type Device::createAccelerationStructureNVX( const AccelerationStructureCreateInfoNVX & createInfo, Optional allocator, Dispatch const &d ) const + { + AccelerationStructureNVX accelerationStructure; + Result result = static_cast( d.vkCreateAccelerationStructureNVX( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &accelerationStructure ) ) ); + return createResultValue( result, accelerationStructure, VULKAN_HPP_NAMESPACE_STRING"::Device::createAccelerationStructureNVX" ); + } +#ifndef VULKAN_HPP_NO_SMART_HANDLE + template + VULKAN_HPP_INLINE typename ResultValueType>::type Device::createAccelerationStructureNVXUnique( const AccelerationStructureCreateInfoNVX & createInfo, Optional allocator, Dispatch const &d ) const + { + AccelerationStructureNVX accelerationStructure; + Result result = static_cast( d.vkCreateAccelerationStructureNVX( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &accelerationStructure ) ) ); + + ObjectDestroy deleter( *this, allocator, d ); + return createResultValue( result, accelerationStructure, VULKAN_HPP_NAMESPACE_STRING"::Device::createAccelerationStructureNVXUnique", deleter ); + } +#endif /*VULKAN_HPP_NO_SMART_HANDLE*/ +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void Device::destroyAccelerationStructureNVX( AccelerationStructureNVX accelerationStructure, const AllocationCallbacks* pAllocator, Dispatch const &d) const + { + d.vkDestroyAccelerationStructureNVX( m_device, static_cast( accelerationStructure ), reinterpret_cast( pAllocator ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void Device::destroyAccelerationStructureNVX( AccelerationStructureNVX accelerationStructure, Optional allocator, Dispatch const &d ) const + { + d.vkDestroyAccelerationStructureNVX( m_device, static_cast( accelerationStructure ), reinterpret_cast( static_cast( allocator ) ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void Device::destroy( AccelerationStructureNVX accelerationStructure, const AllocationCallbacks* pAllocator, Dispatch const &d) const + { + d.vkDestroyAccelerationStructureNVX( m_device, static_cast( accelerationStructure ), reinterpret_cast( pAllocator ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE void Device::destroy( AccelerationStructureNVX accelerationStructure, Optional allocator, Dispatch const &d ) const + { + d.vkDestroyAccelerationStructureNVX( m_device, static_cast( accelerationStructure ), reinterpret_cast( static_cast( allocator ) ) ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void Device::getAccelerationStructureMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX* pInfo, MemoryRequirements2KHR* pMemoryRequirements, Dispatch const &d) const + { + d.vkGetAccelerationStructureMemoryRequirementsNVX( m_device, reinterpret_cast( pInfo ), reinterpret_cast( pMemoryRequirements ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE MemoryRequirements2KHR Device::getAccelerationStructureMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX & info, Dispatch const &d ) const + { + MemoryRequirements2KHR memoryRequirements; + d.vkGetAccelerationStructureMemoryRequirementsNVX( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); + return memoryRequirements; + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE void Device::getAccelerationStructureScratchMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX* pInfo, MemoryRequirements2KHR* pMemoryRequirements, Dispatch const &d) const + { + d.vkGetAccelerationStructureScratchMemoryRequirementsNVX( m_device, reinterpret_cast( pInfo ), reinterpret_cast( pMemoryRequirements ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE MemoryRequirements2KHR Device::getAccelerationStructureScratchMemoryRequirementsNVX( const AccelerationStructureMemoryRequirementsInfoNVX & info, Dispatch const &d ) const + { + MemoryRequirements2KHR memoryRequirements; + d.vkGetAccelerationStructureScratchMemoryRequirementsNVX( m_device, reinterpret_cast( &info ), reinterpret_cast( &memoryRequirements ) ); + return memoryRequirements; + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE Result Device::bindAccelerationStructureMemoryNVX( uint32_t bindInfoCount, const BindAccelerationStructureMemoryInfoNVX* pBindInfos, Dispatch const &d) const + { + return static_cast( d.vkBindAccelerationStructureMemoryNVX( m_device, bindInfoCount, reinterpret_cast( pBindInfos ) ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE ResultValueType::type Device::bindAccelerationStructureMemoryNVX( ArrayProxy bindInfos, Dispatch const &d ) const + { + Result result = static_cast( d.vkBindAccelerationStructureMemoryNVX( m_device, bindInfos.size() , reinterpret_cast( bindInfos.data() ) ) ); + return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING"::Device::bindAccelerationStructureMemoryNVX" ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE Result Device::getRaytracingShaderHandlesNVX( Pipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData, Dispatch const &d) const + { + return static_cast( d.vkGetRaytracingShaderHandlesNVX( m_device, static_cast( pipeline ), firstGroup, groupCount, dataSize, pData ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE ResultValueType::type Device::getRaytracingShaderHandlesNVX( Pipeline pipeline, uint32_t firstGroup, uint32_t groupCount, ArrayProxy data, Dispatch const &d ) const + { + Result result = static_cast( d.vkGetRaytracingShaderHandlesNVX( m_device, static_cast( pipeline ), firstGroup, groupCount, data.size() * sizeof( T ) , reinterpret_cast( data.data() ) ) ); + return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING"::Device::getRaytracingShaderHandlesNVX" ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE Result Device::getAccelerationStructureHandleNVX( AccelerationStructureNVX accelerationStructure, size_t dataSize, void* pData, Dispatch const &d) const + { + return static_cast( d.vkGetAccelerationStructureHandleNVX( m_device, static_cast( accelerationStructure ), dataSize, pData ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE ResultValueType::type Device::getAccelerationStructureHandleNVX( AccelerationStructureNVX accelerationStructure, ArrayProxy data, Dispatch const &d ) const + { + Result result = static_cast( d.vkGetAccelerationStructureHandleNVX( m_device, static_cast( accelerationStructure ), data.size() * sizeof( T ) , reinterpret_cast( data.data() ) ) ); + return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING"::Device::getAccelerationStructureHandleNVX" ); + } +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + + template + VULKAN_HPP_INLINE Result Device::createRaytracingPipelinesNVX( PipelineCache pipelineCache, uint32_t createInfoCount, const RaytracingPipelineCreateInfoNVX* pCreateInfos, const AllocationCallbacks* pAllocator, Pipeline* pPipelines, Dispatch const &d) const + { + return static_cast( d.vkCreateRaytracingPipelinesNVX( m_device, static_cast( pipelineCache ), createInfoCount, reinterpret_cast( pCreateInfos ), reinterpret_cast( pAllocator ), reinterpret_cast( pPipelines ) ) ); + } +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + VULKAN_HPP_INLINE typename ResultValueType>::type Device::createRaytracingPipelinesNVX( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator, Dispatch const &d ) const + { + std::vector pipelines( createInfos.size() ); + Result result = static_cast( d.vkCreateRaytracingPipelinesNVX( m_device, static_cast( pipelineCache ), createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( pipelines.data() ) ) ); + return createResultValue( result, pipelines, VULKAN_HPP_NAMESPACE_STRING"::Device::createRaytracingPipelinesNVX" ); + } + template + VULKAN_HPP_INLINE ResultValueType::type Device::createRaytracingPipelineNVX( PipelineCache pipelineCache, const RaytracingPipelineCreateInfoNVX & createInfo, Optional allocator, Dispatch const &d ) const + { + Pipeline pipeline; + Result result = static_cast( d.vkCreateRaytracingPipelinesNVX( m_device, static_cast( pipelineCache ), 1 , reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &pipeline ) ) ); + return createResultValue( result, pipeline, VULKAN_HPP_NAMESPACE_STRING"::Device::createRaytracingPipelineNVX" ); + } +#ifndef VULKAN_HPP_NO_SMART_HANDLE + template + VULKAN_HPP_INLINE typename ResultValueType,Allocator>>::type Device::createRaytracingPipelinesNVXUnique( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator, Dispatch const &d ) const + { + static_assert( sizeof( Pipeline ) <= sizeof( UniquePipeline ), "Pipeline is greater than UniquePipeline!" ); + std::vector pipelines; + pipelines.reserve( createInfos.size() ); + Pipeline* buffer = reinterpret_cast( reinterpret_cast( pipelines.data() ) + createInfos.size() * ( sizeof( UniquePipeline ) - sizeof( Pipeline ) ) ); + Result result = static_cast(d.vkCreateRaytracingPipelinesNVX( m_device, static_cast( pipelineCache ), createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( buffer ) ) ); + + ObjectDestroy deleter( *this, allocator, d ); + for ( size_t i=0 ; i + VULKAN_HPP_INLINE typename ResultValueType>::type Device::createRaytracingPipelineNVXUnique( PipelineCache pipelineCache, const RaytracingPipelineCreateInfoNVX & createInfo, Optional allocator, Dispatch const &d ) const + { + Pipeline pipeline; + Result result = static_cast( d.vkCreateRaytracingPipelinesNVX( m_device, static_cast( pipelineCache ), 1 , reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &pipeline ) ) ); + + ObjectDestroy deleter( *this, allocator, d ); + return createResultValue( result, pipeline, VULKAN_HPP_NAMESPACE_STRING"::Device::createRaytracingPipelineNVXUnique", deleter ); + } +#endif /*VULKAN_HPP_NO_SMART_HANDLE*/ +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ + #ifndef VULKAN_HPP_NO_SMART_HANDLE template class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; @@ -39863,6 +43313,8 @@ public: #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template PhysicalDeviceProperties getProperties(Dispatch const &d = Dispatch() ) const; + template + StructureChain getProperties(Dispatch const &d = Dispatch() ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -40336,6 +43788,14 @@ public: d.vkGetPhysicalDeviceProperties( m_physicalDevice, reinterpret_cast( &properties ) ); return properties; } + template + VULKAN_HPP_INLINE StructureChain PhysicalDevice::getProperties(Dispatch const &d ) const + { + StructureChain structureChain; + PhysicalDeviceProperties& properties = structureChain.template get(); + d.vkGetPhysicalDeviceProperties( m_physicalDevice, reinterpret_cast( &properties ) ); + return structureChain; + } #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -42787,11 +46247,18 @@ public: template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; @@ -42817,6 +46284,35 @@ public: template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; @@ -42868,6 +46364,8 @@ public: template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; + template <> struct isStructureChainValid{ enum { value = true }; }; template <> struct isStructureChainValid{ enum { value = true }; }; VULKAN_HPP_INLINE std::string to_string(FramebufferCreateFlagBits) { @@ -43382,6 +46880,7 @@ public: case ImageLayout::eDepthAttachmentStencilReadOnlyOptimal: return "DepthAttachmentStencilReadOnlyOptimal"; case ImageLayout::ePresentSrcKHR: return "PresentSrcKHR"; case ImageLayout::eSharedPresentKHR: return "SharedPresentKHR"; + case ImageLayout::eShadingRateOptimalNV: return "ShadingRateOptimalNV"; default: return "invalid"; } } @@ -43483,6 +46982,8 @@ public: case DescriptorType::eUniformBufferDynamic: return "UniformBufferDynamic"; case DescriptorType::eStorageBufferDynamic: return "StorageBufferDynamic"; case DescriptorType::eInputAttachment: return "InputAttachment"; + case DescriptorType::eInlineUniformBlockEXT: return "InlineUniformBlockEXT"; + case DescriptorType::eAccelerationStructureNVX: return "AccelerationStructureNVX"; default: return "invalid"; } } @@ -43494,6 +46995,7 @@ public: case QueryType::eOcclusion: return "Occlusion"; case QueryType::ePipelineStatistics: return "PipelineStatistics"; case QueryType::eTimestamp: return "Timestamp"; + case QueryType::eCompactedSizeNVX: return "CompactedSizeNVX"; default: return "invalid"; } } @@ -43518,6 +47020,7 @@ public: { case PipelineBindPoint::eGraphics: return "Graphics"; case PipelineBindPoint::eCompute: return "Compute"; + case PipelineBindPoint::eRaytracingNVX: return "RaytracingNVX"; default: return "invalid"; } } @@ -44215,6 +47718,7 @@ public: case StructureType::eDedicatedAllocationBufferCreateInfoNV: return "DedicatedAllocationBufferCreateInfoNV"; case StructureType::eDedicatedAllocationMemoryAllocateInfoNV: return "DedicatedAllocationMemoryAllocateInfoNV"; case StructureType::eTextureLodGatherFormatPropertiesAMD: return "TextureLodGatherFormatPropertiesAMD"; + case StructureType::ePhysicalDeviceCornerSampledImageFeaturesNV: return "PhysicalDeviceCornerSampledImageFeaturesNV"; case StructureType::eExternalMemoryImageCreateInfoNV: return "ExternalMemoryImageCreateInfoNV"; case StructureType::eExportMemoryAllocateInfoNV: return "ExportMemoryAllocateInfoNV"; case StructureType::eImportMemoryWin32HandleInfoNV: return "ImportMemoryWin32HandleInfoNV"; @@ -44222,6 +47726,8 @@ public: case StructureType::eWin32KeyedMutexAcquireReleaseInfoNV: return "Win32KeyedMutexAcquireReleaseInfoNV"; case StructureType::eValidationFlagsEXT: return "ValidationFlagsEXT"; case StructureType::eViSurfaceCreateInfoNN: return "ViSurfaceCreateInfoNN"; + case StructureType::eImageViewAstcDecodeModeEXT: return "ImageViewAstcDecodeModeEXT"; + case StructureType::ePhysicalDeviceAstcDecodeFeaturesEXT: return "PhysicalDeviceAstcDecodeFeaturesEXT"; case StructureType::eImportMemoryWin32HandleInfoKHR: return "ImportMemoryWin32HandleInfoKHR"; case StructureType::eExportMemoryWin32HandleInfoKHR: return "ExportMemoryWin32HandleInfoKHR"; case StructureType::eMemoryWin32HandlePropertiesKHR: return "MemoryWin32HandlePropertiesKHR"; @@ -44297,6 +47803,10 @@ public: case StructureType::eExternalFormatANDROID: return "ExternalFormatANDROID"; case StructureType::ePhysicalDeviceSamplerFilterMinmaxPropertiesEXT: return "PhysicalDeviceSamplerFilterMinmaxPropertiesEXT"; case StructureType::eSamplerReductionModeCreateInfoEXT: return "SamplerReductionModeCreateInfoEXT"; + case StructureType::ePhysicalDeviceInlineUniformBlockFeaturesEXT: return "PhysicalDeviceInlineUniformBlockFeaturesEXT"; + case StructureType::ePhysicalDeviceInlineUniformBlockPropertiesEXT: return "PhysicalDeviceInlineUniformBlockPropertiesEXT"; + case StructureType::eWriteDescriptorSetInlineUniformBlockEXT: return "WriteDescriptorSetInlineUniformBlockEXT"; + case StructureType::eDescriptorPoolInlineUniformBlockCreateInfoEXT: return "DescriptorPoolInlineUniformBlockCreateInfoEXT"; case StructureType::eSampleLocationsInfoEXT: return "SampleLocationsInfoEXT"; case StructureType::eRenderPassSampleLocationsBeginInfoEXT: return "RenderPassSampleLocationsBeginInfoEXT"; case StructureType::ePipelineSampleLocationsStateCreateInfoEXT: return "PipelineSampleLocationsStateCreateInfoEXT"; @@ -44315,6 +47825,23 @@ public: case StructureType::ePhysicalDeviceDescriptorIndexingPropertiesEXT: return "PhysicalDeviceDescriptorIndexingPropertiesEXT"; case StructureType::eDescriptorSetVariableDescriptorCountAllocateInfoEXT: return "DescriptorSetVariableDescriptorCountAllocateInfoEXT"; case StructureType::eDescriptorSetVariableDescriptorCountLayoutSupportEXT: return "DescriptorSetVariableDescriptorCountLayoutSupportEXT"; + case StructureType::ePipelineViewportShadingRateImageStateCreateInfoNV: return "PipelineViewportShadingRateImageStateCreateInfoNV"; + case StructureType::ePhysicalDeviceShadingRateImageFeaturesNV: return "PhysicalDeviceShadingRateImageFeaturesNV"; + case StructureType::ePhysicalDeviceShadingRateImagePropertiesNV: return "PhysicalDeviceShadingRateImagePropertiesNV"; + case StructureType::ePipelineViewportCoarseSampleOrderStateCreateInfoNV: return "PipelineViewportCoarseSampleOrderStateCreateInfoNV"; + case StructureType::eRaytracingPipelineCreateInfoNVX: return "RaytracingPipelineCreateInfoNVX"; + case StructureType::eAccelerationStructureCreateInfoNVX: return "AccelerationStructureCreateInfoNVX"; + case StructureType::eGeometryInstanceNVX: return "GeometryInstanceNVX"; + case StructureType::eGeometryNVX: return "GeometryNVX"; + case StructureType::eGeometryTrianglesNVX: return "GeometryTrianglesNVX"; + case StructureType::eGeometryAabbNVX: return "GeometryAabbNVX"; + case StructureType::eBindAccelerationStructureMemoryInfoNVX: return "BindAccelerationStructureMemoryInfoNVX"; + case StructureType::eDescriptorAccelerationStructureInfoNVX: return "DescriptorAccelerationStructureInfoNVX"; + case StructureType::eAccelerationStructureMemoryRequirementsInfoNVX: return "AccelerationStructureMemoryRequirementsInfoNVX"; + case StructureType::ePhysicalDeviceRaytracingPropertiesNVX: return "PhysicalDeviceRaytracingPropertiesNVX"; + case StructureType::eHitShaderModuleCreateInfoNVX: return "HitShaderModuleCreateInfoNVX"; + case StructureType::ePhysicalDeviceRepresentativeFragmentTestFeaturesNV: return "PhysicalDeviceRepresentativeFragmentTestFeaturesNV"; + case StructureType::ePipelineRepresentativeFragmentTestStateCreateInfoNV: return "PipelineRepresentativeFragmentTestStateCreateInfoNV"; case StructureType::eDeviceQueueGlobalPriorityCreateInfoEXT: return "DeviceQueueGlobalPriorityCreateInfoEXT"; case StructureType::ePhysicalDevice8BitStorageFeaturesKHR: return "PhysicalDevice8BitStorageFeaturesKHR"; case StructureType::eImportMemoryHostPointerInfoEXT: return "ImportMemoryHostPointerInfoEXT"; @@ -44323,8 +47850,17 @@ public: case StructureType::ePhysicalDeviceShaderCorePropertiesAMD: return "PhysicalDeviceShaderCorePropertiesAMD"; case StructureType::ePhysicalDeviceVertexAttributeDivisorPropertiesEXT: return "PhysicalDeviceVertexAttributeDivisorPropertiesEXT"; case StructureType::ePipelineVertexInputDivisorStateCreateInfoEXT: return "PipelineVertexInputDivisorStateCreateInfoEXT"; + case StructureType::ePhysicalDeviceVertexAttributeDivisorFeaturesEXT: return "PhysicalDeviceVertexAttributeDivisorFeaturesEXT"; + case StructureType::ePhysicalDeviceComputeShaderDerivativesFeaturesNV: return "PhysicalDeviceComputeShaderDerivativesFeaturesNV"; + case StructureType::ePhysicalDeviceMeshShaderFeaturesNV: return "PhysicalDeviceMeshShaderFeaturesNV"; + case StructureType::ePhysicalDeviceMeshShaderPropertiesNV: return "PhysicalDeviceMeshShaderPropertiesNV"; + case StructureType::ePhysicalDeviceFragmentShaderBarycentricFeaturesNV: return "PhysicalDeviceFragmentShaderBarycentricFeaturesNV"; + case StructureType::ePhysicalDeviceShaderImageFootprintFeaturesNV: return "PhysicalDeviceShaderImageFootprintFeaturesNV"; + case StructureType::ePipelineViewportExclusiveScissorStateCreateInfoNV: return "PipelineViewportExclusiveScissorStateCreateInfoNV"; + case StructureType::ePhysicalDeviceExclusiveScissorFeaturesNV: return "PhysicalDeviceExclusiveScissorFeaturesNV"; case StructureType::eCheckpointDataNV: return "CheckpointDataNV"; case StructureType::eQueueFamilyCheckpointPropertiesNV: return "QueueFamilyCheckpointPropertiesNV"; + case StructureType::ePhysicalDeviceVulkanMemoryModelFeaturesKHR: return "PhysicalDeviceVulkanMemoryModelFeaturesKHR"; default: return "invalid"; } } @@ -44355,6 +47891,9 @@ public: case DynamicState::eViewportWScalingNV: return "ViewportWScalingNV"; case DynamicState::eDiscardRectangleEXT: return "DiscardRectangleEXT"; case DynamicState::eSampleLocationsEXT: return "SampleLocationsEXT"; + case DynamicState::eViewportShadingRatePaletteNV: return "ViewportShadingRatePaletteNV"; + case DynamicState::eViewportCoarseSampleOrderNV: return "ViewportCoarseSampleOrderNV"; + case DynamicState::eExclusiveScissorNV: return "ExclusiveScissorNV"; default: return "invalid"; } } @@ -44410,6 +47949,7 @@ public: case ObjectType::eIndirectCommandsLayoutNVX: return "IndirectCommandsLayoutNVX"; case ObjectType::eDebugUtilsMessengerEXT: return "DebugUtilsMessengerEXT"; case ObjectType::eValidationCacheEXT: return "ValidationCacheEXT"; + case ObjectType::eAccelerationStructureNVX: return "AccelerationStructureNVX"; default: return "invalid"; } } @@ -44527,6 +48067,9 @@ public: case AccessFlagBits::eCommandProcessReadNVX: return "CommandProcessReadNVX"; case AccessFlagBits::eCommandProcessWriteNVX: return "CommandProcessWriteNVX"; case AccessFlagBits::eColorAttachmentReadNoncoherentEXT: return "ColorAttachmentReadNoncoherentEXT"; + case AccessFlagBits::eShadingRateImageReadNV: return "ShadingRateImageReadNV"; + case AccessFlagBits::eAccelerationStructureReadNVX: return "AccelerationStructureReadNVX"; + case AccessFlagBits::eAccelerationStructureWriteNVX: return "AccelerationStructureWriteNVX"; default: return "invalid"; } } @@ -44556,6 +48099,9 @@ public: if (value & AccessFlagBits::eCommandProcessReadNVX) result += "CommandProcessReadNVX | "; if (value & AccessFlagBits::eCommandProcessWriteNVX) result += "CommandProcessWriteNVX | "; if (value & AccessFlagBits::eColorAttachmentReadNoncoherentEXT) result += "ColorAttachmentReadNoncoherentEXT | "; + if (value & AccessFlagBits::eShadingRateImageReadNV) result += "ShadingRateImageReadNV | "; + if (value & AccessFlagBits::eAccelerationStructureReadNVX) result += "AccelerationStructureReadNVX | "; + if (value & AccessFlagBits::eAccelerationStructureWriteNVX) result += "AccelerationStructureWriteNVX | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -44573,6 +48119,7 @@ public: case BufferUsageFlagBits::eVertexBuffer: return "VertexBuffer"; case BufferUsageFlagBits::eIndirectBuffer: return "IndirectBuffer"; case BufferUsageFlagBits::eConditionalRenderingEXT: return "ConditionalRenderingEXT"; + case BufferUsageFlagBits::eRaytracingNVX: return "RaytracingNVX"; default: return "invalid"; } } @@ -44591,6 +48138,7 @@ public: if (value & BufferUsageFlagBits::eVertexBuffer) result += "VertexBuffer | "; if (value & BufferUsageFlagBits::eIndirectBuffer) result += "IndirectBuffer | "; if (value & BufferUsageFlagBits::eConditionalRenderingEXT) result += "ConditionalRenderingEXT | "; + if (value & BufferUsageFlagBits::eRaytracingNVX) result += "RaytracingNVX | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -44629,6 +48177,14 @@ public: case ShaderStageFlagBits::eCompute: return "Compute"; case ShaderStageFlagBits::eAllGraphics: return "AllGraphics"; case ShaderStageFlagBits::eAll: return "All"; + case ShaderStageFlagBits::eRaygenNVX: return "RaygenNVX"; + case ShaderStageFlagBits::eAnyHitNVX: return "AnyHitNVX"; + case ShaderStageFlagBits::eClosestHitNVX: return "ClosestHitNVX"; + case ShaderStageFlagBits::eMissNVX: return "MissNVX"; + case ShaderStageFlagBits::eIntersectionNVX: return "IntersectionNVX"; + case ShaderStageFlagBits::eCallableNVX: return "CallableNVX"; + case ShaderStageFlagBits::eTaskNV: return "TaskNV"; + case ShaderStageFlagBits::eMeshNV: return "MeshNV"; default: return "invalid"; } } @@ -44645,6 +48201,14 @@ public: if (value & ShaderStageFlagBits::eCompute) result += "Compute | "; if (value & ShaderStageFlagBits::eAllGraphics) result += "AllGraphics | "; if (value & ShaderStageFlagBits::eAll) result += "All | "; + if (value & ShaderStageFlagBits::eRaygenNVX) result += "RaygenNVX | "; + if (value & ShaderStageFlagBits::eAnyHitNVX) result += "AnyHitNVX | "; + if (value & ShaderStageFlagBits::eClosestHitNVX) result += "ClosestHitNVX | "; + if (value & ShaderStageFlagBits::eMissNVX) result += "MissNVX | "; + if (value & ShaderStageFlagBits::eIntersectionNVX) result += "IntersectionNVX | "; + if (value & ShaderStageFlagBits::eCallableNVX) result += "CallableNVX | "; + if (value & ShaderStageFlagBits::eTaskNV) result += "TaskNV | "; + if (value & ShaderStageFlagBits::eMeshNV) result += "MeshNV | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -44660,6 +48224,7 @@ public: case ImageUsageFlagBits::eDepthStencilAttachment: return "DepthStencilAttachment"; case ImageUsageFlagBits::eTransientAttachment: return "TransientAttachment"; case ImageUsageFlagBits::eInputAttachment: return "InputAttachment"; + case ImageUsageFlagBits::eShadingRateImageNV: return "ShadingRateImageNV"; default: return "invalid"; } } @@ -44676,6 +48241,7 @@ public: if (value & ImageUsageFlagBits::eDepthStencilAttachment) result += "DepthStencilAttachment | "; if (value & ImageUsageFlagBits::eTransientAttachment) result += "TransientAttachment | "; if (value & ImageUsageFlagBits::eInputAttachment) result += "InputAttachment | "; + if (value & ImageUsageFlagBits::eShadingRateImageNV) result += "ShadingRateImageNV | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -44695,6 +48261,7 @@ public: case ImageCreateFlagBits::eExtendedUsage: return "ExtendedUsage"; case ImageCreateFlagBits::eProtected: return "Protected"; case ImageCreateFlagBits::eDisjoint: return "Disjoint"; + case ImageCreateFlagBits::eCornerSampledNV: return "CornerSampledNV"; case ImageCreateFlagBits::eSampleLocationsCompatibleDepthEXT: return "SampleLocationsCompatibleDepthEXT"; default: return "invalid"; } @@ -44716,6 +48283,7 @@ public: if (value & ImageCreateFlagBits::eExtendedUsage) result += "ExtendedUsage | "; if (value & ImageCreateFlagBits::eProtected) result += "Protected | "; if (value & ImageCreateFlagBits::eDisjoint) result += "Disjoint | "; + if (value & ImageCreateFlagBits::eCornerSampledNV) result += "CornerSampledNV | "; if (value & ImageCreateFlagBits::eSampleLocationsCompatibleDepthEXT) result += "SampleLocationsCompatibleDepthEXT | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -44729,6 +48297,7 @@ public: case PipelineCreateFlagBits::eDerivative: return "Derivative"; case PipelineCreateFlagBits::eViewIndexFromDeviceIndex: return "ViewIndexFromDeviceIndex"; case PipelineCreateFlagBits::eDispatchBase: return "DispatchBase"; + case PipelineCreateFlagBits::eDeferCompileNVX: return "DeferCompileNVX"; default: return "invalid"; } } @@ -44742,6 +48311,7 @@ public: if (value & PipelineCreateFlagBits::eDerivative) result += "Derivative | "; if (value & PipelineCreateFlagBits::eViewIndexFromDeviceIndex) result += "ViewIndexFromDeviceIndex | "; if (value & PipelineCreateFlagBits::eDispatchBase) result += "DispatchBase | "; + if (value & PipelineCreateFlagBits::eDeferCompileNVX) result += "DeferCompileNVX | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -45036,6 +48606,10 @@ public: case PipelineStageFlagBits::eAllCommands: return "AllCommands"; case PipelineStageFlagBits::eConditionalRenderingEXT: return "ConditionalRenderingEXT"; case PipelineStageFlagBits::eCommandProcessNVX: return "CommandProcessNVX"; + case PipelineStageFlagBits::eShadingRateImageNV: return "ShadingRateImageNV"; + case PipelineStageFlagBits::eRaytracingNVX: return "RaytracingNVX"; + case PipelineStageFlagBits::eTaskShaderNV: return "TaskShaderNV"; + case PipelineStageFlagBits::eMeshShaderNV: return "MeshShaderNV"; default: return "invalid"; } } @@ -45063,6 +48637,10 @@ public: if (value & PipelineStageFlagBits::eAllCommands) result += "AllCommands | "; if (value & PipelineStageFlagBits::eConditionalRenderingEXT) result += "ConditionalRenderingEXT | "; if (value & PipelineStageFlagBits::eCommandProcessNVX) result += "CommandProcessNVX | "; + if (value & PipelineStageFlagBits::eShadingRateImageNV) result += "ShadingRateImageNV | "; + if (value & PipelineStageFlagBits::eRaytracingNVX) result += "RaytracingNVX | "; + if (value & PipelineStageFlagBits::eTaskShaderNV) result += "TaskShaderNV | "; + if (value & PipelineStageFlagBits::eMeshShaderNV) result += "MeshShaderNV | "; return "{" + result.substr(0, result.size() - 3) + "}"; } @@ -45409,6 +48987,7 @@ public: case DebugReportObjectTypeEXT::eValidationCacheExt: return "ValidationCacheExt"; case DebugReportObjectTypeEXT::eSamplerYcbcrConversion: return "SamplerYcbcrConversion"; case DebugReportObjectTypeEXT::eDescriptorUpdateTemplate: return "DescriptorUpdateTemplate"; + case DebugReportObjectTypeEXT::eAccelerationStructureNVX: return "AccelerationStructureNVX"; default: return "invalid"; } } @@ -46176,6 +49755,135 @@ public: return "{" + result.substr(0, result.size() - 3) + "}"; } + VULKAN_HPP_INLINE std::string to_string(ShadingRatePaletteEntryNV value) + { + switch (value) + { + case ShadingRatePaletteEntryNV::eNoInvocations: return "NoInvocations"; + case ShadingRatePaletteEntryNV::e16InvocationsPerPixel: return "16InvocationsPerPixel"; + case ShadingRatePaletteEntryNV::e8InvocationsPerPixel: return "8InvocationsPerPixel"; + case ShadingRatePaletteEntryNV::e4InvocationsPerPixel: return "4InvocationsPerPixel"; + case ShadingRatePaletteEntryNV::e2InvocationsPerPixel: return "2InvocationsPerPixel"; + case ShadingRatePaletteEntryNV::e1InvocationPerPixel: return "1InvocationPerPixel"; + case ShadingRatePaletteEntryNV::e1InvocationPer2X1Pixels: return "1InvocationPer2X1Pixels"; + case ShadingRatePaletteEntryNV::e1InvocationPer1X2Pixels: return "1InvocationPer1X2Pixels"; + case ShadingRatePaletteEntryNV::e1InvocationPer2X2Pixels: return "1InvocationPer2X2Pixels"; + case ShadingRatePaletteEntryNV::e1InvocationPer4X2Pixels: return "1InvocationPer4X2Pixels"; + case ShadingRatePaletteEntryNV::e1InvocationPer2X4Pixels: return "1InvocationPer2X4Pixels"; + case ShadingRatePaletteEntryNV::e1InvocationPer4X4Pixels: return "1InvocationPer4X4Pixels"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(CoarseSampleOrderTypeNV value) + { + switch (value) + { + case CoarseSampleOrderTypeNV::eDefault: return "Default"; + case CoarseSampleOrderTypeNV::eCustom: return "Custom"; + case CoarseSampleOrderTypeNV::ePixelMajor: return "PixelMajor"; + case CoarseSampleOrderTypeNV::eSampleMajor: return "SampleMajor"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(GeometryInstanceFlagBitsNVX value) + { + switch (value) + { + case GeometryInstanceFlagBitsNVX::eTriangleCullDisable: return "TriangleCullDisable"; + case GeometryInstanceFlagBitsNVX::eTriangleCullFlipWinding: return "TriangleCullFlipWinding"; + case GeometryInstanceFlagBitsNVX::eForceOpaque: return "ForceOpaque"; + case GeometryInstanceFlagBitsNVX::eForceNoOpaque: return "ForceNoOpaque"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(GeometryInstanceFlagsNVX value) + { + if (!value) return "{}"; + std::string result; + if (value & GeometryInstanceFlagBitsNVX::eTriangleCullDisable) result += "TriangleCullDisable | "; + if (value & GeometryInstanceFlagBitsNVX::eTriangleCullFlipWinding) result += "TriangleCullFlipWinding | "; + if (value & GeometryInstanceFlagBitsNVX::eForceOpaque) result += "ForceOpaque | "; + if (value & GeometryInstanceFlagBitsNVX::eForceNoOpaque) result += "ForceNoOpaque | "; + return "{" + result.substr(0, result.size() - 3) + "}"; + } + + VULKAN_HPP_INLINE std::string to_string(GeometryFlagBitsNVX value) + { + switch (value) + { + case GeometryFlagBitsNVX::eOpaque: return "Opaque"; + case GeometryFlagBitsNVX::eNoDuplicateAnyHitInvocation: return "NoDuplicateAnyHitInvocation"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(GeometryFlagsNVX value) + { + if (!value) return "{}"; + std::string result; + if (value & GeometryFlagBitsNVX::eOpaque) result += "Opaque | "; + if (value & GeometryFlagBitsNVX::eNoDuplicateAnyHitInvocation) result += "NoDuplicateAnyHitInvocation | "; + return "{" + result.substr(0, result.size() - 3) + "}"; + } + + VULKAN_HPP_INLINE std::string to_string(BuildAccelerationStructureFlagBitsNVX value) + { + switch (value) + { + case BuildAccelerationStructureFlagBitsNVX::eAllowUpdate: return "AllowUpdate"; + case BuildAccelerationStructureFlagBitsNVX::eAllowCompaction: return "AllowCompaction"; + case BuildAccelerationStructureFlagBitsNVX::ePreferFastTrace: return "PreferFastTrace"; + case BuildAccelerationStructureFlagBitsNVX::ePreferFastBuild: return "PreferFastBuild"; + case BuildAccelerationStructureFlagBitsNVX::eLowMemory: return "LowMemory"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(BuildAccelerationStructureFlagsNVX value) + { + if (!value) return "{}"; + std::string result; + if (value & BuildAccelerationStructureFlagBitsNVX::eAllowUpdate) result += "AllowUpdate | "; + if (value & BuildAccelerationStructureFlagBitsNVX::eAllowCompaction) result += "AllowCompaction | "; + if (value & BuildAccelerationStructureFlagBitsNVX::ePreferFastTrace) result += "PreferFastTrace | "; + if (value & BuildAccelerationStructureFlagBitsNVX::ePreferFastBuild) result += "PreferFastBuild | "; + if (value & BuildAccelerationStructureFlagBitsNVX::eLowMemory) result += "LowMemory | "; + return "{" + result.substr(0, result.size() - 3) + "}"; + } + + VULKAN_HPP_INLINE std::string to_string(CopyAccelerationStructureModeNVX value) + { + switch (value) + { + case CopyAccelerationStructureModeNVX::eClone: return "Clone"; + case CopyAccelerationStructureModeNVX::eCompact: return "Compact"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(AccelerationStructureTypeNVX value) + { + switch (value) + { + case AccelerationStructureTypeNVX::eTopLevel: return "TopLevel"; + case AccelerationStructureTypeNVX::eBottomLevel: return "BottomLevel"; + default: return "invalid"; + } + } + + VULKAN_HPP_INLINE std::string to_string(GeometryTypeNVX value) + { + switch (value) + { + case GeometryTypeNVX::eTriangles: return "Triangles"; + case GeometryTypeNVX::eAabbs: return "Aabbs"; + default: return "invalid"; + } + } + class DispatchLoaderDynamic { public: @@ -46188,6 +49896,7 @@ public: PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets = 0; PFN_vkAllocateMemory vkAllocateMemory = 0; PFN_vkBeginCommandBuffer vkBeginCommandBuffer = 0; + PFN_vkBindAccelerationStructureMemoryNVX vkBindAccelerationStructureMemoryNVX = 0; PFN_vkBindBufferMemory vkBindBufferMemory = 0; PFN_vkBindBufferMemory2 vkBindBufferMemory2 = 0; PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR = 0; @@ -46202,11 +49911,14 @@ public: PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets = 0; PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer = 0; PFN_vkCmdBindPipeline vkCmdBindPipeline = 0; + PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV = 0; PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers = 0; PFN_vkCmdBlitImage vkCmdBlitImage = 0; + PFN_vkCmdBuildAccelerationStructureNVX vkCmdBuildAccelerationStructureNVX = 0; PFN_vkCmdClearAttachments vkCmdClearAttachments = 0; PFN_vkCmdClearColorImage vkCmdClearColorImage = 0; PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage = 0; + PFN_vkCmdCopyAccelerationStructureNVX vkCmdCopyAccelerationStructureNVX = 0; PFN_vkCmdCopyBuffer vkCmdCopyBuffer = 0; PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage = 0; PFN_vkCmdCopyImage vkCmdCopyImage = 0; @@ -46227,6 +49939,9 @@ public: PFN_vkCmdDrawIndirect vkCmdDrawIndirect = 0; PFN_vkCmdDrawIndirectCountAMD vkCmdDrawIndirectCountAMD = 0; PFN_vkCmdDrawIndirectCountKHR vkCmdDrawIndirectCountKHR = 0; + PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV = 0; + PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV = 0; + PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV = 0; PFN_vkCmdEndConditionalRenderingEXT vkCmdEndConditionalRenderingEXT = 0; PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT = 0; PFN_vkCmdEndQuery vkCmdEndQuery = 0; @@ -46248,12 +49963,14 @@ public: PFN_vkCmdResolveImage vkCmdResolveImage = 0; PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants = 0; PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV = 0; + PFN_vkCmdSetCoarseSampleOrderNV vkCmdSetCoarseSampleOrderNV = 0; PFN_vkCmdSetDepthBias vkCmdSetDepthBias = 0; PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds = 0; PFN_vkCmdSetDeviceMask vkCmdSetDeviceMask = 0; PFN_vkCmdSetDeviceMaskKHR vkCmdSetDeviceMaskKHR = 0; PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT = 0; PFN_vkCmdSetEvent vkCmdSetEvent = 0; + PFN_vkCmdSetExclusiveScissorNV vkCmdSetExclusiveScissorNV = 0; PFN_vkCmdSetLineWidth vkCmdSetLineWidth = 0; PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT = 0; PFN_vkCmdSetScissor vkCmdSetScissor = 0; @@ -46261,11 +49978,16 @@ public: PFN_vkCmdSetStencilReference vkCmdSetStencilReference = 0; PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask = 0; PFN_vkCmdSetViewport vkCmdSetViewport = 0; + PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV = 0; PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV = 0; + PFN_vkCmdTraceRaysNVX vkCmdTraceRaysNVX = 0; PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer = 0; PFN_vkCmdWaitEvents vkCmdWaitEvents = 0; + PFN_vkCmdWriteAccelerationStructurePropertiesNVX vkCmdWriteAccelerationStructurePropertiesNVX = 0; PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD = 0; PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp = 0; + PFN_vkCompileDeferredNVX vkCompileDeferredNVX = 0; + PFN_vkCreateAccelerationStructureNVX vkCreateAccelerationStructureNVX = 0; #ifdef VK_USE_PLATFORM_ANDROID_KHR PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR = 0; #endif /*VK_USE_PLATFORM_ANDROID_KHR*/ @@ -46303,6 +50025,7 @@ public: PFN_vkCreatePipelineCache vkCreatePipelineCache = 0; PFN_vkCreatePipelineLayout vkCreatePipelineLayout = 0; PFN_vkCreateQueryPool vkCreateQueryPool = 0; + PFN_vkCreateRaytracingPipelinesNVX vkCreateRaytracingPipelinesNVX = 0; PFN_vkCreateRenderPass vkCreateRenderPass = 0; PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR = 0; PFN_vkCreateSampler vkCreateSampler = 0; @@ -46331,6 +50054,7 @@ public: PFN_vkDebugMarkerSetObjectNameEXT vkDebugMarkerSetObjectNameEXT = 0; PFN_vkDebugMarkerSetObjectTagEXT vkDebugMarkerSetObjectTagEXT = 0; PFN_vkDebugReportMessageEXT vkDebugReportMessageEXT = 0; + PFN_vkDestroyAccelerationStructureNVX vkDestroyAccelerationStructureNVX = 0; PFN_vkDestroyBuffer vkDestroyBuffer = 0; PFN_vkDestroyBufferView vkDestroyBufferView = 0; PFN_vkDestroyCommandPool vkDestroyCommandPool = 0; @@ -46377,6 +50101,9 @@ public: PFN_vkFreeCommandBuffers vkFreeCommandBuffers = 0; PFN_vkFreeDescriptorSets vkFreeDescriptorSets = 0; PFN_vkFreeMemory vkFreeMemory = 0; + PFN_vkGetAccelerationStructureHandleNVX vkGetAccelerationStructureHandleNVX = 0; + PFN_vkGetAccelerationStructureMemoryRequirementsNVX vkGetAccelerationStructureMemoryRequirementsNVX = 0; + PFN_vkGetAccelerationStructureScratchMemoryRequirementsNVX vkGetAccelerationStructureScratchMemoryRequirementsNVX = 0; #ifdef VK_USE_PLATFORM_ANDROID_ANDROID PFN_vkGetAndroidHardwareBufferPropertiesANDROID vkGetAndroidHardwareBufferPropertiesANDROID = 0; #endif /*VK_USE_PLATFORM_ANDROID_ANDROID*/ @@ -46491,6 +50218,7 @@ public: #ifdef VK_USE_PLATFORM_XLIB_XRANDR_NV PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT = 0; #endif /*VK_USE_PLATFORM_XLIB_XRANDR_NV*/ + PFN_vkGetRaytracingShaderHandlesNVX vkGetRaytracingShaderHandlesNVX = 0; PFN_vkGetRefreshCycleDurationGOOGLE vkGetRefreshCycleDurationGOOGLE = 0; PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity = 0; PFN_vkGetSemaphoreFdKHR vkGetSemaphoreFdKHR = 0; @@ -46563,6 +50291,7 @@ public: vkAllocateDescriptorSets = PFN_vkAllocateDescriptorSets(device ? device.getProcAddr( "vkAllocateDescriptorSets") : instance.getProcAddr( "vkAllocateDescriptorSets")); vkAllocateMemory = PFN_vkAllocateMemory(device ? device.getProcAddr( "vkAllocateMemory") : instance.getProcAddr( "vkAllocateMemory")); vkBeginCommandBuffer = PFN_vkBeginCommandBuffer(device ? device.getProcAddr( "vkBeginCommandBuffer") : instance.getProcAddr( "vkBeginCommandBuffer")); + vkBindAccelerationStructureMemoryNVX = PFN_vkBindAccelerationStructureMemoryNVX(device ? device.getProcAddr( "vkBindAccelerationStructureMemoryNVX") : instance.getProcAddr( "vkBindAccelerationStructureMemoryNVX")); vkBindBufferMemory = PFN_vkBindBufferMemory(device ? device.getProcAddr( "vkBindBufferMemory") : instance.getProcAddr( "vkBindBufferMemory")); vkBindBufferMemory2 = PFN_vkBindBufferMemory2(device ? device.getProcAddr( "vkBindBufferMemory2") : instance.getProcAddr( "vkBindBufferMemory2")); vkBindBufferMemory2KHR = PFN_vkBindBufferMemory2KHR(device ? device.getProcAddr( "vkBindBufferMemory2KHR") : instance.getProcAddr( "vkBindBufferMemory2KHR")); @@ -46577,11 +50306,14 @@ public: vkCmdBindDescriptorSets = PFN_vkCmdBindDescriptorSets(device ? device.getProcAddr( "vkCmdBindDescriptorSets") : instance.getProcAddr( "vkCmdBindDescriptorSets")); vkCmdBindIndexBuffer = PFN_vkCmdBindIndexBuffer(device ? device.getProcAddr( "vkCmdBindIndexBuffer") : instance.getProcAddr( "vkCmdBindIndexBuffer")); vkCmdBindPipeline = PFN_vkCmdBindPipeline(device ? device.getProcAddr( "vkCmdBindPipeline") : instance.getProcAddr( "vkCmdBindPipeline")); + vkCmdBindShadingRateImageNV = PFN_vkCmdBindShadingRateImageNV(device ? device.getProcAddr( "vkCmdBindShadingRateImageNV") : instance.getProcAddr( "vkCmdBindShadingRateImageNV")); vkCmdBindVertexBuffers = PFN_vkCmdBindVertexBuffers(device ? device.getProcAddr( "vkCmdBindVertexBuffers") : instance.getProcAddr( "vkCmdBindVertexBuffers")); vkCmdBlitImage = PFN_vkCmdBlitImage(device ? device.getProcAddr( "vkCmdBlitImage") : instance.getProcAddr( "vkCmdBlitImage")); + vkCmdBuildAccelerationStructureNVX = PFN_vkCmdBuildAccelerationStructureNVX(device ? device.getProcAddr( "vkCmdBuildAccelerationStructureNVX") : instance.getProcAddr( "vkCmdBuildAccelerationStructureNVX")); vkCmdClearAttachments = PFN_vkCmdClearAttachments(device ? device.getProcAddr( "vkCmdClearAttachments") : instance.getProcAddr( "vkCmdClearAttachments")); vkCmdClearColorImage = PFN_vkCmdClearColorImage(device ? device.getProcAddr( "vkCmdClearColorImage") : instance.getProcAddr( "vkCmdClearColorImage")); vkCmdClearDepthStencilImage = PFN_vkCmdClearDepthStencilImage(device ? device.getProcAddr( "vkCmdClearDepthStencilImage") : instance.getProcAddr( "vkCmdClearDepthStencilImage")); + vkCmdCopyAccelerationStructureNVX = PFN_vkCmdCopyAccelerationStructureNVX(device ? device.getProcAddr( "vkCmdCopyAccelerationStructureNVX") : instance.getProcAddr( "vkCmdCopyAccelerationStructureNVX")); vkCmdCopyBuffer = PFN_vkCmdCopyBuffer(device ? device.getProcAddr( "vkCmdCopyBuffer") : instance.getProcAddr( "vkCmdCopyBuffer")); vkCmdCopyBufferToImage = PFN_vkCmdCopyBufferToImage(device ? device.getProcAddr( "vkCmdCopyBufferToImage") : instance.getProcAddr( "vkCmdCopyBufferToImage")); vkCmdCopyImage = PFN_vkCmdCopyImage(device ? device.getProcAddr( "vkCmdCopyImage") : instance.getProcAddr( "vkCmdCopyImage")); @@ -46602,6 +50334,9 @@ public: vkCmdDrawIndirect = PFN_vkCmdDrawIndirect(device ? device.getProcAddr( "vkCmdDrawIndirect") : instance.getProcAddr( "vkCmdDrawIndirect")); vkCmdDrawIndirectCountAMD = PFN_vkCmdDrawIndirectCountAMD(device ? device.getProcAddr( "vkCmdDrawIndirectCountAMD") : instance.getProcAddr( "vkCmdDrawIndirectCountAMD")); vkCmdDrawIndirectCountKHR = PFN_vkCmdDrawIndirectCountKHR(device ? device.getProcAddr( "vkCmdDrawIndirectCountKHR") : instance.getProcAddr( "vkCmdDrawIndirectCountKHR")); + vkCmdDrawMeshTasksIndirectCountNV = PFN_vkCmdDrawMeshTasksIndirectCountNV(device ? device.getProcAddr( "vkCmdDrawMeshTasksIndirectCountNV") : instance.getProcAddr( "vkCmdDrawMeshTasksIndirectCountNV")); + vkCmdDrawMeshTasksIndirectNV = PFN_vkCmdDrawMeshTasksIndirectNV(device ? device.getProcAddr( "vkCmdDrawMeshTasksIndirectNV") : instance.getProcAddr( "vkCmdDrawMeshTasksIndirectNV")); + vkCmdDrawMeshTasksNV = PFN_vkCmdDrawMeshTasksNV(device ? device.getProcAddr( "vkCmdDrawMeshTasksNV") : instance.getProcAddr( "vkCmdDrawMeshTasksNV")); vkCmdEndConditionalRenderingEXT = PFN_vkCmdEndConditionalRenderingEXT(device ? device.getProcAddr( "vkCmdEndConditionalRenderingEXT") : instance.getProcAddr( "vkCmdEndConditionalRenderingEXT")); vkCmdEndDebugUtilsLabelEXT = PFN_vkCmdEndDebugUtilsLabelEXT(device ? device.getProcAddr( "vkCmdEndDebugUtilsLabelEXT") : instance.getProcAddr( "vkCmdEndDebugUtilsLabelEXT")); vkCmdEndQuery = PFN_vkCmdEndQuery(device ? device.getProcAddr( "vkCmdEndQuery") : instance.getProcAddr( "vkCmdEndQuery")); @@ -46623,12 +50358,14 @@ public: vkCmdResolveImage = PFN_vkCmdResolveImage(device ? device.getProcAddr( "vkCmdResolveImage") : instance.getProcAddr( "vkCmdResolveImage")); vkCmdSetBlendConstants = PFN_vkCmdSetBlendConstants(device ? device.getProcAddr( "vkCmdSetBlendConstants") : instance.getProcAddr( "vkCmdSetBlendConstants")); vkCmdSetCheckpointNV = PFN_vkCmdSetCheckpointNV(device ? device.getProcAddr( "vkCmdSetCheckpointNV") : instance.getProcAddr( "vkCmdSetCheckpointNV")); + vkCmdSetCoarseSampleOrderNV = PFN_vkCmdSetCoarseSampleOrderNV(device ? device.getProcAddr( "vkCmdSetCoarseSampleOrderNV") : instance.getProcAddr( "vkCmdSetCoarseSampleOrderNV")); vkCmdSetDepthBias = PFN_vkCmdSetDepthBias(device ? device.getProcAddr( "vkCmdSetDepthBias") : instance.getProcAddr( "vkCmdSetDepthBias")); vkCmdSetDepthBounds = PFN_vkCmdSetDepthBounds(device ? device.getProcAddr( "vkCmdSetDepthBounds") : instance.getProcAddr( "vkCmdSetDepthBounds")); vkCmdSetDeviceMask = PFN_vkCmdSetDeviceMask(device ? device.getProcAddr( "vkCmdSetDeviceMask") : instance.getProcAddr( "vkCmdSetDeviceMask")); vkCmdSetDeviceMaskKHR = PFN_vkCmdSetDeviceMaskKHR(device ? device.getProcAddr( "vkCmdSetDeviceMaskKHR") : instance.getProcAddr( "vkCmdSetDeviceMaskKHR")); vkCmdSetDiscardRectangleEXT = PFN_vkCmdSetDiscardRectangleEXT(device ? device.getProcAddr( "vkCmdSetDiscardRectangleEXT") : instance.getProcAddr( "vkCmdSetDiscardRectangleEXT")); vkCmdSetEvent = PFN_vkCmdSetEvent(device ? device.getProcAddr( "vkCmdSetEvent") : instance.getProcAddr( "vkCmdSetEvent")); + vkCmdSetExclusiveScissorNV = PFN_vkCmdSetExclusiveScissorNV(device ? device.getProcAddr( "vkCmdSetExclusiveScissorNV") : instance.getProcAddr( "vkCmdSetExclusiveScissorNV")); vkCmdSetLineWidth = PFN_vkCmdSetLineWidth(device ? device.getProcAddr( "vkCmdSetLineWidth") : instance.getProcAddr( "vkCmdSetLineWidth")); vkCmdSetSampleLocationsEXT = PFN_vkCmdSetSampleLocationsEXT(device ? device.getProcAddr( "vkCmdSetSampleLocationsEXT") : instance.getProcAddr( "vkCmdSetSampleLocationsEXT")); vkCmdSetScissor = PFN_vkCmdSetScissor(device ? device.getProcAddr( "vkCmdSetScissor") : instance.getProcAddr( "vkCmdSetScissor")); @@ -46636,11 +50373,16 @@ public: vkCmdSetStencilReference = PFN_vkCmdSetStencilReference(device ? device.getProcAddr( "vkCmdSetStencilReference") : instance.getProcAddr( "vkCmdSetStencilReference")); vkCmdSetStencilWriteMask = PFN_vkCmdSetStencilWriteMask(device ? device.getProcAddr( "vkCmdSetStencilWriteMask") : instance.getProcAddr( "vkCmdSetStencilWriteMask")); vkCmdSetViewport = PFN_vkCmdSetViewport(device ? device.getProcAddr( "vkCmdSetViewport") : instance.getProcAddr( "vkCmdSetViewport")); + vkCmdSetViewportShadingRatePaletteNV = PFN_vkCmdSetViewportShadingRatePaletteNV(device ? device.getProcAddr( "vkCmdSetViewportShadingRatePaletteNV") : instance.getProcAddr( "vkCmdSetViewportShadingRatePaletteNV")); vkCmdSetViewportWScalingNV = PFN_vkCmdSetViewportWScalingNV(device ? device.getProcAddr( "vkCmdSetViewportWScalingNV") : instance.getProcAddr( "vkCmdSetViewportWScalingNV")); + vkCmdTraceRaysNVX = PFN_vkCmdTraceRaysNVX(device ? device.getProcAddr( "vkCmdTraceRaysNVX") : instance.getProcAddr( "vkCmdTraceRaysNVX")); vkCmdUpdateBuffer = PFN_vkCmdUpdateBuffer(device ? device.getProcAddr( "vkCmdUpdateBuffer") : instance.getProcAddr( "vkCmdUpdateBuffer")); vkCmdWaitEvents = PFN_vkCmdWaitEvents(device ? device.getProcAddr( "vkCmdWaitEvents") : instance.getProcAddr( "vkCmdWaitEvents")); + vkCmdWriteAccelerationStructurePropertiesNVX = PFN_vkCmdWriteAccelerationStructurePropertiesNVX(device ? device.getProcAddr( "vkCmdWriteAccelerationStructurePropertiesNVX") : instance.getProcAddr( "vkCmdWriteAccelerationStructurePropertiesNVX")); vkCmdWriteBufferMarkerAMD = PFN_vkCmdWriteBufferMarkerAMD(device ? device.getProcAddr( "vkCmdWriteBufferMarkerAMD") : instance.getProcAddr( "vkCmdWriteBufferMarkerAMD")); vkCmdWriteTimestamp = PFN_vkCmdWriteTimestamp(device ? device.getProcAddr( "vkCmdWriteTimestamp") : instance.getProcAddr( "vkCmdWriteTimestamp")); + vkCompileDeferredNVX = PFN_vkCompileDeferredNVX(device ? device.getProcAddr( "vkCompileDeferredNVX") : instance.getProcAddr( "vkCompileDeferredNVX")); + vkCreateAccelerationStructureNVX = PFN_vkCreateAccelerationStructureNVX(device ? device.getProcAddr( "vkCreateAccelerationStructureNVX") : instance.getProcAddr( "vkCreateAccelerationStructureNVX")); #ifdef VK_USE_PLATFORM_ANDROID_KHR vkCreateAndroidSurfaceKHR = PFN_vkCreateAndroidSurfaceKHR(instance.getProcAddr( "vkCreateAndroidSurfaceKHR")); #endif /*VK_USE_PLATFORM_ANDROID_KHR*/ @@ -46678,6 +50420,7 @@ public: vkCreatePipelineCache = PFN_vkCreatePipelineCache(device ? device.getProcAddr( "vkCreatePipelineCache") : instance.getProcAddr( "vkCreatePipelineCache")); vkCreatePipelineLayout = PFN_vkCreatePipelineLayout(device ? device.getProcAddr( "vkCreatePipelineLayout") : instance.getProcAddr( "vkCreatePipelineLayout")); vkCreateQueryPool = PFN_vkCreateQueryPool(device ? device.getProcAddr( "vkCreateQueryPool") : instance.getProcAddr( "vkCreateQueryPool")); + vkCreateRaytracingPipelinesNVX = PFN_vkCreateRaytracingPipelinesNVX(device ? device.getProcAddr( "vkCreateRaytracingPipelinesNVX") : instance.getProcAddr( "vkCreateRaytracingPipelinesNVX")); vkCreateRenderPass = PFN_vkCreateRenderPass(device ? device.getProcAddr( "vkCreateRenderPass") : instance.getProcAddr( "vkCreateRenderPass")); vkCreateRenderPass2KHR = PFN_vkCreateRenderPass2KHR(device ? device.getProcAddr( "vkCreateRenderPass2KHR") : instance.getProcAddr( "vkCreateRenderPass2KHR")); vkCreateSampler = PFN_vkCreateSampler(device ? device.getProcAddr( "vkCreateSampler") : instance.getProcAddr( "vkCreateSampler")); @@ -46706,6 +50449,7 @@ public: vkDebugMarkerSetObjectNameEXT = PFN_vkDebugMarkerSetObjectNameEXT(device ? device.getProcAddr( "vkDebugMarkerSetObjectNameEXT") : instance.getProcAddr( "vkDebugMarkerSetObjectNameEXT")); vkDebugMarkerSetObjectTagEXT = PFN_vkDebugMarkerSetObjectTagEXT(device ? device.getProcAddr( "vkDebugMarkerSetObjectTagEXT") : instance.getProcAddr( "vkDebugMarkerSetObjectTagEXT")); vkDebugReportMessageEXT = PFN_vkDebugReportMessageEXT(instance.getProcAddr( "vkDebugReportMessageEXT")); + vkDestroyAccelerationStructureNVX = PFN_vkDestroyAccelerationStructureNVX(device ? device.getProcAddr( "vkDestroyAccelerationStructureNVX") : instance.getProcAddr( "vkDestroyAccelerationStructureNVX")); vkDestroyBuffer = PFN_vkDestroyBuffer(device ? device.getProcAddr( "vkDestroyBuffer") : instance.getProcAddr( "vkDestroyBuffer")); vkDestroyBufferView = PFN_vkDestroyBufferView(device ? device.getProcAddr( "vkDestroyBufferView") : instance.getProcAddr( "vkDestroyBufferView")); vkDestroyCommandPool = PFN_vkDestroyCommandPool(device ? device.getProcAddr( "vkDestroyCommandPool") : instance.getProcAddr( "vkDestroyCommandPool")); @@ -46752,6 +50496,9 @@ public: vkFreeCommandBuffers = PFN_vkFreeCommandBuffers(device ? device.getProcAddr( "vkFreeCommandBuffers") : instance.getProcAddr( "vkFreeCommandBuffers")); vkFreeDescriptorSets = PFN_vkFreeDescriptorSets(device ? device.getProcAddr( "vkFreeDescriptorSets") : instance.getProcAddr( "vkFreeDescriptorSets")); vkFreeMemory = PFN_vkFreeMemory(device ? device.getProcAddr( "vkFreeMemory") : instance.getProcAddr( "vkFreeMemory")); + vkGetAccelerationStructureHandleNVX = PFN_vkGetAccelerationStructureHandleNVX(device ? device.getProcAddr( "vkGetAccelerationStructureHandleNVX") : instance.getProcAddr( "vkGetAccelerationStructureHandleNVX")); + vkGetAccelerationStructureMemoryRequirementsNVX = PFN_vkGetAccelerationStructureMemoryRequirementsNVX(device ? device.getProcAddr( "vkGetAccelerationStructureMemoryRequirementsNVX") : instance.getProcAddr( "vkGetAccelerationStructureMemoryRequirementsNVX")); + vkGetAccelerationStructureScratchMemoryRequirementsNVX = PFN_vkGetAccelerationStructureScratchMemoryRequirementsNVX(device ? device.getProcAddr( "vkGetAccelerationStructureScratchMemoryRequirementsNVX") : instance.getProcAddr( "vkGetAccelerationStructureScratchMemoryRequirementsNVX")); #ifdef VK_USE_PLATFORM_ANDROID_ANDROID vkGetAndroidHardwareBufferPropertiesANDROID = PFN_vkGetAndroidHardwareBufferPropertiesANDROID(device ? device.getProcAddr( "vkGetAndroidHardwareBufferPropertiesANDROID") : instance.getProcAddr( "vkGetAndroidHardwareBufferPropertiesANDROID")); #endif /*VK_USE_PLATFORM_ANDROID_ANDROID*/ @@ -46866,6 +50613,7 @@ public: #ifdef VK_USE_PLATFORM_XLIB_XRANDR_NV vkGetRandROutputDisplayEXT = PFN_vkGetRandROutputDisplayEXT(device ? device.getProcAddr( "vkGetRandROutputDisplayEXT") : instance.getProcAddr( "vkGetRandROutputDisplayEXT")); #endif /*VK_USE_PLATFORM_XLIB_XRANDR_NV*/ + vkGetRaytracingShaderHandlesNVX = PFN_vkGetRaytracingShaderHandlesNVX(device ? device.getProcAddr( "vkGetRaytracingShaderHandlesNVX") : instance.getProcAddr( "vkGetRaytracingShaderHandlesNVX")); vkGetRefreshCycleDurationGOOGLE = PFN_vkGetRefreshCycleDurationGOOGLE(device ? device.getProcAddr( "vkGetRefreshCycleDurationGOOGLE") : instance.getProcAddr( "vkGetRefreshCycleDurationGOOGLE")); vkGetRenderAreaGranularity = PFN_vkGetRenderAreaGranularity(device ? device.getProcAddr( "vkGetRenderAreaGranularity") : instance.getProcAddr( "vkGetRenderAreaGranularity")); vkGetSemaphoreFdKHR = PFN_vkGetSemaphoreFdKHR(device ? device.getProcAddr( "vkGetSemaphoreFdKHR") : instance.getProcAddr( "vkGetSemaphoreFdKHR")); From e4447ba76e178a6169cc6d5ea3e2f4883a19577f Mon Sep 17 00:00:00 2001 From: WubiCookie Date: Tue, 25 Sep 2018 10:53:37 +0200 Subject: [PATCH 7/8] Fix instance-level functions being loaded with vkGetDeviceProcAddr in vk::DispatchLoaderDynamic::init (#257) --- VulkanHppGenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 215cc5e..6675fe0 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -5122,7 +5122,8 @@ void VulkanHppGenerator::writeDelegationClassDynamic(std::ostream &os) enterProtect(os, command.second.protect); if (!command.second.params.empty() && m_handles.find(command.second.params[0].type) != m_handles.end() - && command.second.params[0].type != "Instance") + && command.second.params[0].type != "Instance" + && command.second.params[0].type != "PhysicalDevice") { os << " vk" << startUpperCase(command.second.fullName) << " = PFN_vk" << startUpperCase(command.second.fullName) << "(device ? device.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\") : instance.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\"));" << std::endl; From b5af45219bfd8da0f8fe1966c6bcff4205fda02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 25 Sep 2018 11:23:27 +0200 Subject: [PATCH 8/8] Resolve a couple of warnings. (#255) --- VulkanHppGenerator.cpp | 10653 ++++++++++++++++++++------------------- 1 file changed, 5327 insertions(+), 5326 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 6675fe0..fd4a86b 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1,5326 +1,5327 @@ -// Copyright(c) 2015-2016, NVIDIA CORPORATION. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "VulkanHppGenerator.hpp" - -const std::string vkNamespace = R"( -#if !defined(VULKAN_HPP_NAMESPACE) -#define VULKAN_HPP_NAMESPACE vk -#endif - -#define VULKAN_HPP_STRINGIFY2(text) #text -#define VULKAN_HPP_STRINGIFY(text) VULKAN_HPP_STRINGIFY2(text) -#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY(VULKAN_HPP_NAMESPACE) - -namespace VULKAN_HPP_NAMESPACE -{ -)"; - -const std::string constExprHeader = R"( -#if defined(_MSC_VER) && (_MSC_VER <= 1800) -# define VULKAN_HPP_CONSTEXPR -#else -# define VULKAN_HPP_CONSTEXPR constexpr -#endif -)"; - -const std::string exceptionHeader = R"( -#if defined(_MSC_VER) && (_MSC_VER == 1800) -# define noexcept _NOEXCEPT -#endif - - class ErrorCategoryImpl : public std::error_category - { - public: - virtual const char* name() const noexcept override { return VULKAN_HPP_NAMESPACE_STRING"::Result"; } - virtual std::string message(int ev) const override { return to_string(static_cast(ev)); } - }; - -#if defined(_MSC_VER) && (_MSC_VER == 1800) -# undef noexcept -#endif - - VULKAN_HPP_INLINE const std::error_category& errorCategory() - { - static ErrorCategoryImpl instance; - return instance; - } - - VULKAN_HPP_INLINE std::error_code make_error_code(Result e) - { - return std::error_code(static_cast(e), errorCategory()); - } - - VULKAN_HPP_INLINE std::error_condition make_error_condition(Result e) - { - return std::error_condition(static_cast(e), errorCategory()); - } -)"; - -const std::string exceptionClassesHeader = R"( -#if defined(_MSC_VER) && (_MSC_VER == 1800) -# define noexcept _NOEXCEPT -#endif - - class Error - { - public: - virtual ~Error() = default; - - virtual const char* what() const noexcept = 0; - }; - - class LogicError : public Error, public std::logic_error - { - public: - explicit LogicError( const std::string& what ) - : Error(), std::logic_error(what) {} - explicit LogicError( char const * what ) - : Error(), std::logic_error(what) {} - virtual ~LogicError() = default; - - virtual const char* what() const noexcept { return std::logic_error::what(); } - }; - - class SystemError : public Error, public std::system_error - { - public: - SystemError( std::error_code ec ) - : Error(), std::system_error(ec) {} - SystemError( std::error_code ec, std::string const& what ) - : Error(), std::system_error(ec, what) {} - SystemError( std::error_code ec, char const * what ) - : Error(), std::system_error(ec, what) {} - SystemError( int ev, std::error_category const& ecat ) - : Error(), std::system_error(ev, ecat) {} - SystemError( int ev, std::error_category const& ecat, std::string const& what) - : Error(), std::system_error(ev, ecat, what) {} - SystemError( int ev, std::error_category const& ecat, char const * what) - : Error(), std::system_error(ev, ecat, what) {} - virtual ~SystemError() = default; - - virtual const char* what() const noexcept { return std::system_error::what(); } - }; - -#if defined(_MSC_VER) && (_MSC_VER == 1800) -# undef noexcept -#endif - -)"; - -const std::string flagsHeader = R"( - template struct FlagTraits - { - enum { allFlags = 0 }; - }; - - template - class Flags - { - public: - VULKAN_HPP_CONSTEXPR Flags() - : m_mask(0) - { - } - - Flags(BitType bit) - : m_mask(static_cast(bit)) - { - } - - Flags(Flags const& rhs) - : m_mask(rhs.m_mask) - { - } - - explicit Flags(MaskType flags) - : m_mask(flags) - { - } - - Flags & operator=(Flags const& rhs) - { - m_mask = rhs.m_mask; - return *this; - } - - Flags & operator|=(Flags const& rhs) - { - m_mask |= rhs.m_mask; - return *this; - } - - Flags & operator&=(Flags const& rhs) - { - m_mask &= rhs.m_mask; - return *this; - } - - Flags & operator^=(Flags const& rhs) - { - m_mask ^= rhs.m_mask; - return *this; - } - - Flags operator|(Flags const& rhs) const - { - Flags result(*this); - result |= rhs; - return result; - } - - Flags operator&(Flags const& rhs) const - { - Flags result(*this); - result &= rhs; - return result; - } - - Flags operator^(Flags const& rhs) const - { - Flags result(*this); - result ^= rhs; - return result; - } - - bool operator!() const - { - return !m_mask; - } - - Flags operator~() const - { - Flags result(*this); - result.m_mask ^= FlagTraits::allFlags; - return result; - } - - bool operator==(Flags const& rhs) const - { - return m_mask == rhs.m_mask; - } - - bool operator!=(Flags const& rhs) const - { - return m_mask != rhs.m_mask; - } - - explicit operator bool() const - { - return !!m_mask; - } - - explicit operator MaskType() const - { - return m_mask; - } - - private: - MaskType m_mask; - }; - - template - Flags operator|(BitType bit, Flags const& flags) - { - return flags | bit; - } - - template - Flags operator&(BitType bit, Flags const& flags) - { - return flags & bit; - } - - template - Flags operator^(BitType bit, Flags const& flags) - { - return flags ^ bit; - } - -)"; - -const std::string optionalClassHeader = R"( - template - class Optional - { - public: - Optional(RefType & reference) { m_ptr = &reference; } - Optional(RefType * ptr) { m_ptr = ptr; } - Optional(std::nullptr_t) { m_ptr = nullptr; } - - operator RefType*() const { return m_ptr; } - RefType const* operator->() const { return m_ptr; } - explicit operator bool() const { return !!m_ptr; } - - private: - RefType *m_ptr; - }; -)"; - -const std::string arrayProxyHeader = R"( -#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE - template - class ArrayProxy - { - public: - VULKAN_HPP_CONSTEXPR ArrayProxy(std::nullptr_t) - : m_count(0) - , m_ptr(nullptr) - {} - - ArrayProxy(T & ptr) - : m_count(1) - , m_ptr(&ptr) - {} - - ArrayProxy(uint32_t count, T * ptr) - : m_count(count) - , m_ptr(ptr) - {} - - template - ArrayProxy(std::array::type, N> & data) - : m_count(N) - , m_ptr(data.data()) - {} - - template - ArrayProxy(std::array::type, N> const& data) - : m_count(N) - , m_ptr(data.data()) - {} - - template ::type>> - ArrayProxy(std::vector::type, Allocator> & data) - : m_count(static_cast(data.size())) - , m_ptr(data.data()) - {} - - template ::type>> - ArrayProxy(std::vector::type, Allocator> const& data) - : m_count(static_cast(data.size())) - , m_ptr(data.data()) - {} - - ArrayProxy(std::initializer_list const& data) - : m_count(static_cast(data.end() - data.begin())) - , m_ptr(data.begin()) - {} - - const T * begin() const - { - return m_ptr; - } - - const T * end() const - { - return m_ptr + m_count; - } - - const T & front() const - { - VULKAN_HPP_ASSERT(m_count && m_ptr); - return *m_ptr; - } - - const T & back() const - { - VULKAN_HPP_ASSERT(m_count && m_ptr); - return *(m_ptr + m_count - 1); - } - - bool empty() const - { - return (m_count == 0); - } - - uint32_t size() const - { - return m_count; - } - - T * data() const - { - return m_ptr; - } - - private: - uint32_t m_count; - T * m_ptr; - }; -#endif -)"; - -const std::string structureChainHeader = R"( - - template struct isStructureChainValid { enum { value = false }; }; - - template - struct TypeList - { - using list = P; - using last = T; - }; - - template - struct extendCheck - { - static const bool valid = isStructureChainValid::value || extendCheck::valid; - }; - - template - struct extendCheck,X> - { - static const bool valid = isStructureChainValid::value; - }; - - template - struct extendCheck - { - static const bool valid = true; - }; - - template - class StructureChainElement - { - public: - explicit operator Element&() { return value; } - explicit operator const Element&() const { return value; } - private: - Element value; - }; - - template - class StructureChain : private StructureChainElement... - { - public: - StructureChain() - { - link(); - } - - StructureChain(StructureChain const &rhs) - { - linkAndCopy(rhs); - } - - StructureChain(StructureElements const &... elems) - { - linkAndCopyElements(elems...); - } - - StructureChain& operator=(StructureChain const &rhs) - { - linkAndCopy(rhs); - return *this; - } - - template ClassType& get() { return static_cast(*this);} - - private: - template - void link() - { - static_assert(extendCheck::valid, "The structure chain is not valid!"); - } - - template - void link() - { - static_assert(extendCheck::valid, "The structure chain is not valid!"); - X& x = static_cast(*this); - Y& y = static_cast(*this); - x.pNext = &y; - link, Y, Z...>(); - } - - template - void linkAndCopy(StructureChain const &rhs) - { - static_assert(extendCheck::valid, "The structure chain is not valid!"); - static_cast(*this) = static_cast(rhs); - } - - template - void linkAndCopy(StructureChain const &rhs) - { - static_assert(extendCheck::valid, "The structure chain is not valid!"); - X& x = static_cast(*this); - Y& y = static_cast(*this); - x = static_cast(rhs); - x.pNext = &y; - linkAndCopy, Y, Z...>(rhs); - } - - template - void linkAndCopyElements(X const &xelem) - { - static_assert(extendCheck::valid, "The structure chain is not valid!"); - static_cast(*this) = xelem; - } - - template - void linkAndCopyElements(X const &xelem, Y const &yelem, Z const &... zelem) - { - static_assert(extendCheck::valid, "The structure chain is not valid!"); - X& x = static_cast(*this); - Y& y = static_cast(*this); - x = xelem; - x.pNext = &y; - linkAndCopyElements, Y, Z...>(yelem, zelem...); - } - }; - -)"; - -const std::string versionCheckHeader = R"( -#if !defined(VULKAN_HPP_HAS_UNRESTRICTED_UNIONS) -# if defined(__clang__) -# if __has_feature(cxx_unrestricted_unions) -# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS -# endif -# elif defined(__GNUC__) -# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) -# if 40600 <= GCC_VERSION -# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS -# endif -# elif defined(_MSC_VER) -# if 1900 <= _MSC_VER -# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS -# endif -# endif -#endif -)"; - -const std::string inlineHeader = R"( -#if !defined(VULKAN_HPP_INLINE) -# if defined(__clang___) -# if __has_attribute(always_inline) -# define VULKAN_HPP_INLINE __attribute__((always_inline)) __inline__ -# else -# define VULKAN_HPP_INLINE inline -# endif -# elif defined(__GNUC__) -# define VULKAN_HPP_INLINE __attribute__((always_inline)) __inline__ -# elif defined(_MSC_VER) -# define VULKAN_HPP_INLINE inline -# else -# define VULKAN_HPP_INLINE inline -# endif -#endif -)"; - -const std::string explicitHeader = R"( -#if defined(VULKAN_HPP_TYPESAFE_CONVERSION) -# define VULKAN_HPP_TYPESAFE_EXPLICIT -#else -# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit -#endif -)"; - -const std::string resultValueHeader = R"( - template - struct ResultValue - { - ResultValue( Result r, T & v ) - : result( r ) - , value( v ) - {} - - ResultValue( Result r, T && v ) - : result( r ) - , value( std::move( v ) ) - {} - - Result result; - T value; - - operator std::tuple() { return std::tuple(result, value); } - }; - - template - struct ResultValueType - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - typedef ResultValue type; -#else - typedef T type; -#endif - }; - - template <> - struct ResultValueType - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - typedef Result type; -#else - typedef void type; -#endif - }; -)"; - -const std::string createResultValueHeader = R"( - VULKAN_HPP_INLINE ResultValueType::type createResultValue( Result result, char const * message ) - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( result == Result::eSuccess ); - return result; -#else - if ( result != Result::eSuccess ) - { - throwResultException( result, message ); - } -#endif - } - - template - VULKAN_HPP_INLINE typename ResultValueType::type createResultValue( Result result, T & data, char const * message ) - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( result == Result::eSuccess ); - return ResultValue( result, data ); -#else - if ( result != Result::eSuccess ) - { - throwResultException( result, message ); - } - return std::move( data ); -#endif - } - - VULKAN_HPP_INLINE Result createResultValue( Result result, char const * message, std::initializer_list successCodes ) - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); -#else - if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) - { - throwResultException( result, message ); - } -#endif - return result; - } - - template - VULKAN_HPP_INLINE ResultValue createResultValue( Result result, T & data, char const * message, std::initializer_list successCodes ) - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); -#else - if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) - { - throwResultException( result, message ); - } -#endif - return ResultValue( result, data ); - } - -#ifndef VULKAN_HPP_NO_SMART_HANDLE - template - VULKAN_HPP_INLINE typename ResultValueType>::type createResultValue( Result result, T & data, char const * message, typename UniqueHandleTraits::deleter const& deleter ) - { -#ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( result == Result::eSuccess ); - return ResultValue>( result, UniqueHandle(data, deleter) ); -#else - if ( result != Result::eSuccess ) - { - throwResultException( result, message ); - } - return UniqueHandle(data, deleter); -#endif - } -#endif - -)"; - -const std::string uniqueHandleHeader = R"( -#ifndef VULKAN_HPP_NO_SMART_HANDLE - - template class UniqueHandleTraits; - - template - class UniqueHandle : public UniqueHandleTraits::deleter - { - private: - using Deleter = typename UniqueHandleTraits::deleter; - public: - explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() ) - : Deleter( deleter) - , m_value( value ) - {} - - UniqueHandle( UniqueHandle const& ) = delete; - - UniqueHandle( UniqueHandle && other ) - : Deleter( std::move( static_cast( other ) ) ) - , m_value( other.release() ) - {} - - ~UniqueHandle() - { - if ( m_value ) this->destroy( m_value ); - } - - UniqueHandle & operator=( UniqueHandle const& ) = delete; - - UniqueHandle & operator=( UniqueHandle && other ) - { - reset( other.release() ); - *static_cast(this) = std::move( static_cast(other) ); - return *this; - } - - explicit operator bool() const - { - return m_value.operator bool(); - } - - Type const* operator->() const - { - return &m_value; - } - - Type * operator->() - { - return &m_value; - } - - Type const& operator*() const - { - return m_value; - } - - Type & operator*() - { - return m_value; - } - - const Type & get() const - { - return m_value; - } - - Type & get() - { - return m_value; - } - - void reset( Type const& value = Type() ) - { - if ( m_value != value ) - { - if ( m_value ) this->destroy( m_value ); - m_value = value; - } - } - - Type release() - { - Type value = m_value; - m_value = nullptr; - return value; - } - - void swap( UniqueHandle & rhs ) - { - std::swap(m_value, rhs.m_value); - std::swap(static_cast(*this), static_cast(rhs)); - } - - private: - Type m_value; - }; - - template - VULKAN_HPP_INLINE void swap( UniqueHandle & lhs, UniqueHandle & rhs ) - { - lhs.swap( rhs ); - } -#endif - -)"; - -const std::string deleterClassString = R"( - struct AllocationCallbacks; - - template - class ObjectDestroy - { - public: - ObjectDestroy( OwnerType owner = OwnerType(), Optional allocator = nullptr, Dispatch const &dispatch = Dispatch() ) - : m_owner( owner ) - , m_allocator( allocator ) - , m_dispatch( &dispatch ) - {} - - OwnerType getOwner() const { return m_owner; } - Optional getAllocator() const { return m_allocator; } - - protected: - template - void destroy(T t) - { - m_owner.destroy( t, m_allocator, *m_dispatch ); - } - - private: - OwnerType m_owner; - Optional m_allocator; - Dispatch const* m_dispatch; - }; - - class NoParent; - - template - class ObjectDestroy - { - public: - ObjectDestroy( Optional allocator = nullptr, Dispatch const &dispatch = Dispatch() ) - : m_allocator( allocator ) - , m_dispatch( &dispatch ) - {} - - Optional getAllocator() const { return m_allocator; } - - protected: - template - void destroy(T t) - { - t.destroy( m_allocator, *m_dispatch ); - } - - private: - Optional m_allocator; - Dispatch const* m_dispatch; - }; - - template - class ObjectFree - { - public: - ObjectFree( OwnerType owner = OwnerType(), Optional allocator = nullptr, Dispatch const &dispatch = Dispatch() ) - : m_owner( owner ) - , m_allocator( allocator ) - , m_dispatch( &dispatch ) - {} - - OwnerType getOwner() const { return m_owner; } - Optional getAllocator() const { return m_allocator; } - - protected: - template - void destroy(T t) - { - m_owner.free( t, m_allocator, *m_dispatch ); - } - - private: - OwnerType m_owner; - Optional m_allocator; - Dispatch const* m_dispatch; - }; - - template - class PoolFree - { - public: - PoolFree( OwnerType owner = OwnerType(), PoolType pool = PoolType(), Dispatch const &dispatch = Dispatch() ) - : m_owner( owner ) - , m_pool( pool ) - , m_dispatch( &dispatch ) - {} - - OwnerType getOwner() const { return m_owner; } - PoolType getPool() const { return m_pool; } - - protected: - template - void destroy(T t) - { - m_owner.free( m_pool, t, *m_dispatch ); - } - - private: - OwnerType m_owner; - PoolType m_pool; - Dispatch const* m_dispatch; - }; - -)"; - - -std::string replaceWithMap(std::string const &input, std::map replacements) -{ - // This will match ${someVariable} and contain someVariable in match group 1 - std::regex re(R"(\$\{([^\}]+)\})"); - auto it = std::sregex_iterator(input.begin(), input.end(), re); - auto end = std::sregex_iterator(); - - // No match, just return the original string - if (it == end) - { - return input; - } - - std::string result = ""; - while (it != end) - { - std::smatch match = *it; - auto itReplacement = replacements.find(match[1].str()); - assert(itReplacement != replacements.end()); - - result += match.prefix().str() + ((itReplacement != replacements.end()) ? itReplacement->second : match[0].str()); - ++it; - - // we've passed the last match. Append the rest of the orignal string - if (it == end) - { - result += match.suffix().str(); - } - } - return result; -} - - -bool beginsWith(std::string const& text, std::string const& prefix); -void checkAttributes(std::map const& attributes, int line, std::map> const& required, std::map> const& optional); -void checkElements(std::vector const& elements, std::set const& values); -void checkEmptyElement(tinyxml2::XMLElement const* element); -void checkOrderedElements(std::vector const& elements, std::vector const& values); -std::string createEnumValueName(std::string const& name, std::string const& prefix, std::string const& postfix, bool bitmask, std::string const& tag); -bool endsWith(std::string const& text, std::string const& postfix); -void enterProtect(std::ostream &os, std::string const& protect); -std::string extractTag(std::string const& name); -std::string findTag(std::string const& name, std::set const& tags); -std::string generateEnumNameForFlags(std::string const& name); -std::map getAttributes(tinyxml2::XMLElement const* element); -std::vector getChildElements(tinyxml2::XMLElement const* element); -bool isErrorEnum(std::string const& enumName); -void leaveProtect(std::ostream &os, std::string const& protect); -std::string readArraySize(tinyxml2::XMLNode const* node, std::string& name); -std::string startUpperCase(std::string const& input); -std::string startLowerCase(std::string const& input); -std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix = std::string()); -std::string stripErrorEnumPrefix(std::string const& enumName); -std::string stripPluralS(std::string const& name); -std::vector tokenize(std::string tokenString, char separator); -std::string trim(std::string const& input); -std::string trimEnd(std::string const& input); -std::string toCamelCase(std::string const& value); -std::string toUpperCase(std::string const& name); -void writeFunctionHeaderName(std::ostream & os, std::string const& name, bool singular, bool unique); -void writeReinterpretCast(std::ostream & os, bool leadingConst, bool vulkanType, std::string const& type, bool trailingPointerToConst); -void writeStandardOrEnhanced(std::ostream & os, std::string const& standard, std::string const& enhanced); -void writeTypesafeCheck(std::ostream & os, std::string const& typesafeCheck); -void writeVersionCheck(std::ostream & os, std::string const& version); -#if !defined(NDEBUG) -void skipFeatureRequire(tinyxml2::XMLElement const* element); -void skipImplicitExternSyncParams(tinyxml2::XMLElement const* element); -void skipTypeEnum(tinyxml2::XMLElement const* element, std::map const& attributes); -void skipTypeInclude(tinyxml2::XMLElement const* element); -#endif - -bool beginsWith(std::string const& text, std::string const& prefix) -{ - return !prefix.empty() && text.substr(0, prefix.length()) == prefix; -} - -// check the validity of an attributes map -// attributes : the map of name/value pairs of the encountered attributes -// line : the line in the xml file where the attributes are listed -// required : the required attributes, with a set of allowed values per attribute -// optional : the optional attributes, with a set of allowed values per attribute -void checkAttributes(std::map const& attributes, int line, std::map> const& required, std::map> const& optional) -{ - std::stringstream ss; - ss << line; - std::string lineNumber = ss.str(); - - // check if all required attributes are included and if there is a set of allowed values, check if the actual value is part of that set - for (auto const& r : required) - { - auto attributesIt = attributes.find(r.first); - if (attributesIt == attributes.end()) - { - throw std::runtime_error("Spec error on line " + lineNumber + ": missing attribute <" + r.first + ">"); - } - if (!r.second.empty() && (r.second.find(attributesIt->second) == r.second.end())) - { - throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected attribute value <" + attributesIt->second + "> in attribute <" + r.first + ">"); - } - } - // check if all not required attributes or optional, and if there is a set of allowed values, check if the actual value is part of that set - for (auto const& a : attributes) - { - if (required.find(a.first) == required.end()) - { - auto optionalIt = optional.find(a.first); - if (optionalIt == optional.end()) - { - std::cerr << "warning: " << "Unknown attribute " + a.first + " in line " + lineNumber + "!" << std::endl; - continue; - } - if (!optionalIt->second.empty()) - { - std::vector values = tokenize(a.second, ','); - for (auto const& v : values) - { - if (optionalIt->second.find(v) == optionalIt->second.end()) - { - throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected attribute value <" + v + "> in attribute <" + a.first + ">"); - } - } - } - } - } -} - -void checkElements(std::vector const& elements, std::set const& values) -{ - for (auto e : elements) - { - if (values.find(e->Value()) == values.end()) - { - std::stringstream ss; - ss << e->GetLineNum(); - std::string lineNumber = ss.str(); - std::cerr << "warning: Unknown element in spec on line: " << lineNumber << " " << e->Value() << "!" << std::endl; - } - } -} - -void checkEmptyElement(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); - checkElements(getChildElements(element), {}); -} - -void checkOrderedElements(std::vector const& elements, std::vector const& values) -{ - for (size_t i = 0; i < elements.size(); i++) - { - std::stringstream ss; - ss << elements[i]->GetLineNum(); - std::string lineNumber = ss.str(); - - if (values.size() <= i) - { - throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected surplus element <" + elements[i]->Value() + ">"); - } - if (values[i] != elements[i]->Value()) - { - throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected element <" + elements[i]->Value() + ">, expected <" + values[i] + ">"); - } - } -} - -std::string createEnumValueName(std::string const& name, std::string const& prefix, std::string const& postfix, bool bitmask, std::string const& tag) -{ - std::string result = "e" + toCamelCase(strip(name, prefix, postfix)); - if (bitmask) - { - size_t pos = result.find("Bit"); - if (pos != std::string::npos) - { - result.erase(pos, 3); - } - } - if (!tag.empty() && (result.substr(result.length() - tag.length()) == toCamelCase(tag))) - { - result = result.substr(0, result.length() - tag.length()) + tag; - } - return result; -} - -bool endsWith(std::string const& text, std::string const& postfix) -{ - return !postfix.empty() && (postfix.length() < text.length()) && (text.substr(text.length() - postfix.length()) == postfix); -} - -void enterProtect(std::ostream &os, std::string const& protect) -{ - if (!protect.empty()) - { - os << "#ifdef " << protect << std::endl; - } -} - -std::string extractTag(std::string const& name) -{ - // the name is supposed to look like: VK__ - size_t start = name.find('_'); - assert((start != std::string::npos) && (name.substr(0, start) == "VK")); - size_t end = name.find('_', start + 1); - assert(end != std::string::npos); - return name.substr(start + 1, end - start - 1); -} - -std::string findTag(std::string const& name, std::set const& tags) -{ - // find the tag in a name, return that tag or an empty string - auto tagIt = std::find_if(tags.begin(), tags.end(), [&name](std::string const& t) - { - size_t pos = name.find(t); - return (pos != std::string::npos) && (pos == name.length() - t.length()); - }); - return tagIt != tags.end() ? *tagIt : ""; -} - -std::string generateEnumNameForFlags(std::string const& name) -{ - // create a string, where the substring "Flags" is replaced by "FlagBits" - std::string generatedName = name; - size_t pos = generatedName.rfind("Flags"); - assert(pos != std::string::npos); - generatedName.replace(pos, 5, "FlagBits"); - return generatedName; -} - -std::map getAttributes(tinyxml2::XMLElement const* element) -{ - std::map attributes; - for (auto attribute = element->FirstAttribute(); attribute; attribute = attribute->Next()) - { - assert(attributes.find(attribute->Name()) == attributes.end()); - attributes[attribute->Name()] = attribute->Value(); - } - return attributes; -} - -std::vector getChildElements(tinyxml2::XMLElement const* element) -{ - std::vector childElements; - for (tinyxml2::XMLElement const* childElement = element->FirstChildElement(); childElement; childElement = childElement->NextSiblingElement()) - { - childElements.push_back(childElement); - } - return childElements; -} - -bool isErrorEnum(std::string const& enumName) -{ - return (enumName.substr(0, 6) == "eError"); -} - -void leaveProtect(std::ostream &os, std::string const& protect) -{ - if (!protect.empty()) - { - os << "#endif /*" << protect << "*/" << std::endl; - } -} - -std::string readArraySize(tinyxml2::XMLNode const* node, std::string& name) -{ - std::string arraySize; - if (name.back() == ']') - { - // if the parameter has '[' and ']' in its name, get the stuff inbetween those as the array size and erase that part from the parameter name - assert(!node->NextSibling()); - size_t pos = name.find('['); - assert(pos != std::string::npos); - arraySize = name.substr(pos + 1, name.length() - 2 - pos); - name.erase(pos); - } - else - { - // otherwise look for a sibling of this node - node = node->NextSibling(); - if (node && node->ToText()) - { - assert(node->Value()); - std::string value = trimEnd(node->Value()); - if (value == "[") - { - // if this node has '[' as its value, the next node holds the array size, and the node after that needs to hold ']', and there should be no more siblings - node = node->NextSibling(); - assert(node && node->ToElement() && (strcmp(node->Value(), "enum") == 0)); - arraySize = node->ToElement()->GetText(); - node = node->NextSibling(); - assert(node && node->ToText() && (trimEnd(node->Value()) == "]")); - } - else - { - // otherwise, the node holds '[' and ']', so get the stuff in between those as the array size - assert((value.front() == '[') && (value.back() == ']')); - arraySize = value.substr(1, value.length() - 2); - } - assert(!node->NextSibling() || ((strcmp(node->NextSibling()->Value(), "comment") == 0) && !node->NextSibling()->NextSibling())); - } - } - return arraySize; -} - -std::string startUpperCase(std::string const& input) -{ - return static_cast(toupper(input[0])) + input.substr(1); -} - -std::string startLowerCase(std::string const& input) -{ - return input.empty() ? "" : static_cast(tolower(input[0])) + input.substr(1); -} - -std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix) -{ - std::string strippedValue = value; - if (beginsWith(strippedValue, prefix)) - { - strippedValue.erase(0, prefix.length()); - } - if (endsWith(strippedValue, postfix)) - { - strippedValue.erase(strippedValue.length() - postfix.length()); - } - return strippedValue; -} - -std::string stripErrorEnumPrefix(std::string const& enumName) -{ - assert(isErrorEnum(enumName)); - return strip(enumName, "eError"); -} - -std::string stripPluralS(std::string const& name) -{ - std::string strippedName(name); - size_t pos = strippedName.rfind('s'); - assert(pos != std::string::npos); - strippedName.erase(pos, 1); - return strippedName; -} - -std::vector tokenize(std::string tokenString, char separator) -{ - std::vector tokens; - size_t start = 0, end; - do - { - end = tokenString.find(separator, start); - tokens.push_back(tokenString.substr(start, end - start)); - start = end + 1; - } while (end != std::string::npos); - return tokens; -} - -std::string trim(std::string const& input) -{ - std::string result = input; - result.erase(result.begin(), std::find_if(result.begin(), result.end(), [](char c) { return !std::isspace(c); })); - result.erase(std::find_if(result.rbegin(), result.rend(), [](char c) { return !std::isspace(c); }).base(), result.end()); - return result; -} - -std::string trimEnd(std::string const& input) -{ - std::string result = input; - result.erase(std::find_if(result.rbegin(), result.rend(), [](char c) { return !std::isspace(c); }).base(), result.end()); - return result; -} - -std::string toCamelCase(std::string const& value) -{ - assert(!value.empty() && (isupper(value[0]) || isdigit(value[0]))); - std::string result; - result.reserve(value.size()); - result.push_back(value[0]); - for (size_t i = 1; i < value.size(); i++) - { - if (value[i] != '_') - { - if ((value[i - 1] == '_') || isdigit(value[i - 1])) - { - result.push_back(value[i]); - } - else - { - result.push_back(static_cast(tolower(value[i]))); - } - } - } - return result; -} - -std::string toUpperCase(std::string const& name) -{ - std::string convertedName; - - for (size_t i = 0; i(toupper(name[i]))); - } - return convertedName; -} - -void writeFunctionHeaderName(std::ostream & os, std::string const& name, bool singular, bool unique) -{ - os << (singular ? stripPluralS(name) : name); - if (unique) - { - os << "Unique"; - } -} - -void writeReinterpretCast(std::ostream & os, bool leadingConst, bool vulkanType, std::string const& type, bool trailingPointerToConst) -{ - os << "reinterpret_cast<"; - if (leadingConst) - { - os << "const "; - } - if (vulkanType) - { - os << "Vk"; - } - os << type; - if (trailingPointerToConst) - { - os << "* const"; - } - os << "*>"; -} - -void writeStandardOrEnhanced(std::ostream & os, std::string const& standard, std::string const& enhanced) -{ - if (standard == enhanced) - { - // standard and enhanced string are equal -> just use one of them and we're done - os << standard; - } - else - { - // standard and enhanced string differ -> use both, wrapping the enhanced by !VULKAN_HPP_DISABLE_ENHANCED_MODE - // determine the argument list of that standard, and compare it with that of the enhanced - // if they are equal -> need to have just one; if they differ -> need to have both - size_t standardStart = standard.find('('); - size_t standardCount = standard.find(')', standardStart) - standardStart; - size_t enhancedStart = enhanced.find('('); - bool unchangedInterface = (standard.substr(standardStart, standardCount) == enhanced.substr(enhancedStart, standardCount)); - if (unchangedInterface) - { - os << "#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE" << std::endl; - } - os << standard - << (unchangedInterface ? "#else" : "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE") << std::endl - << enhanced - << "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/" << std::endl; - } -} - -void writeTypesafeCheck(std::ostream & os, std::string const& typesafeCheck) -{ - os << "// 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default." << std::endl - << "// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION" << std::endl - << typesafeCheck << std::endl - << "# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )" << std::endl - << "# define VULKAN_HPP_TYPESAFE_CONVERSION" << std::endl - << "# endif" << std::endl - << "#endif" << std::endl; -} - -void writeVersionCheck(std::ostream & os, std::string const& version) -{ - os << "static_assert( VK_HEADER_VERSION == " << version << " , \"Wrong VK_HEADER_VERSION!\" );" << std::endl - << std::endl; -} - -#if !defined(NDEBUG) -void skipFeatureRequire(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, { { "name",{} } }); - checkElements(getChildElements(element), {}); -} - -void skipImplicitExternSyncParams(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); - std::vector children = getChildElements(element); - checkOrderedElements(children, { "param" }); - checkEmptyElement(children[0]); -} - -void skipTypeEnum(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "category",{ "enum" } } }, { { "alias", {} }, { "name",{} } }); - checkElements(getChildElements(element), {}); -} - -void skipTypeInclude(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), { { "category",{ "include" } } }, { { "name",{} } }); - std::vector children = getChildElements(element); - checkElements(children, { "name" }); - - for (auto child : children) - { - checkEmptyElement(child); - } -} -#endif - -template -void VulkanHppGenerator::checkAlias(std::map const& data, std::string const& name, int line) -{ - if (data.find(name) == data.end()) - { - std::stringstream ss; - ss << line; - std::string lineNumber = ss.str(); - - throw std::runtime_error("Spec error on line " + lineNumber + ": missing alias <" + name + ">"); - } -} - -bool VulkanHppGenerator::containsUnion(std::string const& type, std::map const& structs) -{ - // a simple recursive check if a type is or contains a union - std::map::const_iterator sit = structs.find(type); - bool found = (sit != structs.end()); - if (found) - { - found = sit->second.isUnion; - for (std::vector::const_iterator mit = sit->second.members.begin(); mit != sit->second.members.end() && !found; ++mit) - { - found = (mit->type == mit->pureType) && containsUnion(mit->type, structs); - } - } - return found; -} - -std::map VulkanHppGenerator::createDefaults() -{ - std::map defaultValues; - for (auto const& dependency : m_dependencies) - { - assert(defaultValues.find(dependency.name) == defaultValues.end()); - switch (dependency.category) - { - case DependencyData::Category::BITMASK: - case DependencyData::Category::HANDLE: - case DependencyData::Category::STRUCT: - case DependencyData::Category::UNION: // just call the default constructor for bitmasks, handles, structs, and unions (which are mapped to classes) - defaultValues[dependency.name] = dependency.name + "()"; - break; - case DependencyData::Category::COMMAND: // commands should never be asked for defaults - break; - case DependencyData::Category::ENUM: - assert(m_enums.find(dependency.name) != m_enums.end()); - setDefault(dependency.name, defaultValues, m_enums.find(dependency.name)->second); - break; - case DependencyData::Category::FUNC_POINTER: // func_pointers default to nullptr - defaultValues[dependency.name] = "nullptr"; - break; - case DependencyData::Category::REQUIRED: // all required default to "0" - case DependencyData::Category::SCALAR: // all scalars default to "0" - defaultValues[dependency.name] = "0"; - break; - default: - assert(false && "Unhandled exception category"); - break; - } - } - return defaultValues; -} - -void VulkanHppGenerator::determineEnhancedReturnType(CommandData & commandData) -{ - std::string returnType; - // if there is a return parameter of type void or Result, and if it's of type Result it either has just one success code - // or two success codes, where the second one is of type eIncomplete and it's a two-step process - // -> we can return that parameter - if ((commandData.returnParam != ~0) - && ((commandData.returnType == "void") - || ((commandData.returnType == "Result") - && ((commandData.successCodes.size() == 1) - || ((commandData.successCodes.size() == 2) - && (commandData.successCodes[1] == "eIncomplete") - && commandData.twoStep))))) - { - if (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end()) - { - // the return parameter is a vector-type parameter - if (commandData.params[commandData.returnParam].pureType == "void") - { - // for a vector of void, we use a vector of uint8_t, instead - commandData.enhancedReturnType = "std::vector"; - } - else - { - // for the other parameters, we use a vector of the pure type - commandData.enhancedReturnType = "std::vector<" + commandData.params[commandData.returnParam].pureType + ",Allocator>"; - } - } - else - { - // it's a simple parameter -> get the type and just remove the trailing '*' (originally, it's a pointer) - assert(commandData.params[commandData.returnParam].type.back() == '*'); - assert(commandData.params[commandData.returnParam].type.find("const") == std::string::npos); - commandData.enhancedReturnType = commandData.params[commandData.returnParam].type; - commandData.enhancedReturnType.pop_back(); - } - } - else if ((commandData.returnType == "Result") && (commandData.successCodes.size() == 1)) - { - // an original return of type "Result" with just one successCode is changed to void, errors throw an exception - commandData.enhancedReturnType = "void"; - } - else - { - // the return type just stays the original return type - commandData.enhancedReturnType = commandData.returnType; - } -} - -void VulkanHppGenerator::determineReducedName(CommandData & commandData) -{ - commandData.reducedName = commandData.fullName; - std::string searchName = commandData.params[0].pureType; - size_t pos = commandData.fullName.find(searchName); - if ((pos == std::string::npos) && isupper(searchName[0])) - { - searchName[0] = static_cast(tolower(searchName[0])); - pos = commandData.fullName.find(searchName); - } - if (pos != std::string::npos) - { - commandData.reducedName.erase(pos, searchName.length()); - } - else if ((searchName == "commandBuffer") && (commandData.fullName.find("cmd") == 0)) - { - commandData.reducedName.erase(0, 3); - pos = 0; - } - if ((pos == 0) && isupper(commandData.reducedName[0])) - { - commandData.reducedName[0] = static_cast(tolower(commandData.reducedName[0])); - } -} - -void VulkanHppGenerator::determineReturnParam(CommandData & commandData) -{ - // for return types of type Result or void, we can replace determine a parameter to return - if ((commandData.returnType == "Result") || (commandData.returnType == "void")) - { - for (size_t i = 0; i < commandData.params.size(); i++) - { - if ((commandData.params[i].type.find('*') != std::string::npos) - && (commandData.params[i].type.find("const") == std::string::npos) - && std::find_if(commandData.vectorParams.begin(), commandData.vectorParams.end(), [i](std::pair const& vp) { return vp.second == i; }) == commandData.vectorParams.end()) - { - // it's a non-const pointer and not a vector-size parameter - std::map::const_iterator vpit = commandData.vectorParams.find(i); - if ((vpit == commandData.vectorParams.end()) || commandData.twoStep || (commandData.vectorParams.size() > 1) || (vpit->second == size_t(~0)) || (commandData.params[vpit->second].type.find('*') != std::string::npos)) - { - // it's not a vector parameter, or a two-step process, or there is at least one more vector parameter, or the size argument of this vector parameter is not an argument, or the size argument of this vector parameter is provided by a pointer - // -> look for another non-cost pointer argument - auto paramIt = std::find_if(commandData.params.begin() + i + 1, commandData.params.end(), [](ParamData const& pd) - { - return (pd.type.find('*') != std::string::npos) && (pd.type.find("const") == std::string::npos); - }); - // if there is another such argument, we can't decide which one to return -> return none (~0) - // otherwise return the index of the selcted parameter - commandData.returnParam = paramIt != commandData.params.end() ? ~0 : i; - } - } - } - } -} - -void VulkanHppGenerator::determineSkippedParams(CommandData & commandData) -{ - // the size-parameters of vector parameters are not explicitly used in the enhanced API - std::for_each(commandData.vectorParams.begin(), commandData.vectorParams.end(), [&commandData](std::pair const& vp) { if (vp.second != ~0) commandData.skippedParams.insert(vp.second); }); - // and the return parameter is also skipped - if (commandData.returnParam != ~0) - { - commandData.skippedParams.insert(commandData.returnParam); - } -} - -void VulkanHppGenerator::determineTemplateParam(CommandData & commandData) -{ - for (size_t i = 0; i < commandData.params.size(); i++) - { - // any vector parameter on the pure type void is templatized in the enhanced API - if ((commandData.vectorParams.find(i) != commandData.vectorParams.end()) && (commandData.params[i].pureType == "void")) - { -#if !defined(NDEBUG) - for (size_t j = i + 1; j < commandData.params.size(); j++) - { - assert((commandData.vectorParams.find(j) == commandData.vectorParams.end()) || (commandData.params[j].pureType != "void")); - } -#endif - commandData.templateParam = i; - break; - } - } - assert((commandData.templateParam == ~0) || (commandData.vectorParams.find(commandData.templateParam) != commandData.vectorParams.end())); -} - -void VulkanHppGenerator::determineVectorParams(CommandData & commandData) -{ - // look for the parameters whose len equals the name of an other parameter - for (auto it = commandData.params.begin(), begin = it, end = commandData.params.end(); it != end; ++it) - { - if (!it->len.empty()) - { - auto findLambda = [it](ParamData const& pd) { return pd.name == it->len; }; - auto findIt = std::find_if(begin, it, findLambda); // look for a parameter named as the len of this parameter - assert((std::count_if(begin, end, findLambda) == 0) || (findIt < it)); // make sure, there is no other parameter like that - - // add this parameter as a vector parameter, using the len-name parameter as the second value (or ~0 if there is nothing like that) - commandData.vectorParams.insert(std::make_pair(std::distance(begin, it), findIt < it ? std::distance(begin, findIt) : ~0)); - assert((commandData.vectorParams[std::distance(begin, it)] != ~0) - || (it->len == "null-terminated") - || (it->len == "pAllocateInfo::descriptorSetCount") - || (it->len == "pAllocateInfo::commandBufferCount")); - } - } -} - -std::string VulkanHppGenerator::generateCall(CommandData const& commandData, bool firstCall, bool singular) -{ - std::ostringstream call; - writeCall(call, commandData, firstCall, singular); - return call.str(); -} - -std::string const& VulkanHppGenerator::getTypesafeCheck() const -{ - return m_typesafeCheck; -} - -std::string const& VulkanHppGenerator::getVersion() const -{ - return m_version; -} - -std::string const& VulkanHppGenerator::getVulkanLicenseHeader() const -{ - return m_vulkanLicenseHeader; -} - -bool VulkanHppGenerator::isSubStruct(std::pair const& nsd, std::string const& name, StructData const& structData) -{ - if ((nsd.first != name) && (nsd.second.members.size() < structData.members.size()) && (structData.members[0].name != "sType")) - { - bool equal = true; - for (size_t i = 0; i < nsd.second.members.size() && equal; i++) - { - equal = (nsd.second.members[i].type == structData.members[i].type) && (nsd.second.members[i].name == structData.members[i].name); - } - if (equal) - { - return true; - } - } - return false; -} - -void VulkanHppGenerator::linkCommandToHandle(CommandData & commandData) -{ - // first, find the handle named like the type of the first argument - // if there is no such handle, look for the unnamed "handle", that gathers all the functions not tied to a specific handle - assert(!commandData.params.empty()); - std::map::iterator hit = m_handles.find(commandData.params[0].pureType); - if (hit == m_handles.end()) - { - hit = m_handles.find(""); - } - assert(hit != m_handles.end()); - - // put the command into the handle's list of commands, and store the handle in the commands className - hit->second.commands.push_back(commandData.fullName); - commandData.className = hit->first; - - // add the dependencies of the command to the dependencies of the handle - DependencyData const& commandDD = m_dependencies.back(); - std::list::iterator handleDD = std::find_if(m_dependencies.begin(), m_dependencies.end(), [hit](DependencyData const& dd) { return dd.name == hit->first; }); - assert((handleDD != m_dependencies.end()) || hit->first.empty()); - if (handleDD != m_dependencies.end()) - { - std::copy_if(commandDD.dependencies.begin(), commandDD.dependencies.end(), std::inserter(handleDD->dependencies, handleDD->dependencies.end()), [hit](std::string const& d) { return d != hit->first; }); - } -} - -bool VulkanHppGenerator::readCommandParam(tinyxml2::XMLElement const* element, std::set & dependencies, std::vector & params) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, { { "externsync",{} },{ "len",{} },{ "noautovalidity",{ "true" } },{ "optional",{ "false", "true" } } }); - checkElements(getChildElements(element), { "name", "type" }); - - ParamData param; - - bool isTwoStep = false; - auto lenAttribute = attributes.find("len"); - if (lenAttribute != attributes.end()) - { - param.len = lenAttribute->second; - auto pit = std::find_if(params.begin(), params.end(), [¶m](ParamData const& pd) { return param.len == pd.name; }); - if (pit != params.end()) - { - isTwoStep = (pit->type.find('*') != std::string::npos); - } - } - - // get the type of the parameter, and put it into the list of dependencies - tinyxml2::XMLNode const* child = readCommandParamType(element->FirstChild(), param); - dependencies.insert(param.pureType); - - assert(child->ToElement()); - tinyxml2::XMLElement const* nameElement = child->ToElement(); - checkEmptyElement(nameElement); - param.name = child->ToElement()->GetText(); - - param.arraySize = readArraySize(child, param.name); - - auto optionalAttribute = attributes.find("optional"); - param.optional = (optionalAttribute != attributes.end()) && (optionalAttribute->second == "true"); - - params.push_back(param); - - assert(!isTwoStep || (param.type.substr(0, 6) != "const ")); - return isTwoStep; -} - -tinyxml2::XMLNode const* VulkanHppGenerator::readCommandParamType(tinyxml2::XMLNode const* node, ParamData& param) -{ - assert(node); - if (node->ToText()) - { - // start type with "const" or "struct", if needed - std::string value = trim(node->Value()); - assert((value == "const") || (value == "struct") || (value == "const struct")); - param.type = value + " "; - node = node->NextSibling(); - assert(node); - } - - // get the pure type - assert(node->ToElement()); - tinyxml2::XMLElement const* typeElement = node->ToElement(); - checkEmptyElement(typeElement); - std::string type = strip(node->ToElement()->GetText(), "Vk"); - param.unchangedType = param.type + node->ToElement()->GetText(); - param.type += type; - param.pureType = type; - - // end with "*", "**", or "* const*", if needed - node = node->NextSibling(); - assert(node); - if (node->ToText()) - { - std::string value = trimEnd(node->Value()); - assert((value == "*") || (value == "**") || (value == "* const*")); - param.type += value; - param.unchangedType += value; - node = node->NextSibling(); - } - - return node; -} - -void VulkanHppGenerator::readCommands(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, { { "comment",{} } }); - std::vector children = getChildElements(element); - checkElements(children, { "command" }); - - for (auto child : children) - { - readCommandsCommand(child); - } -} - -void VulkanHppGenerator::readCommandsCommand(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, - { { "alias", {} }, - { "cmdbufferlevel",{ "primary", "secondary" } }, - { "comment",{} }, - { "errorcodes",{} }, - { "name", {} }, - { "pipeline",{ "compute", "graphics", "transfer" } }, - { "queues",{ "compute", "graphics", "sparse_binding", "transfer" } }, - { "renderpass",{ "both", "inside", "outside" } }, - { "successcodes",{} } - }); - std::vector children = getChildElements(element); - - CommandData commandData; - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - // for command aliases, create a copy of the aliased command - checkAttributes(attributes, element->GetLineNum(), { { "alias",{} },{ "name",{} } }, {}); // re-check on alias type! - checkElements(children, {}); - - std::string alias = startLowerCase(strip(aliasIt->second, "vk")); - checkAlias(m_commands, alias, element->GetLineNum()); - - auto commandsIt = m_commands.find(alias); - assert(commandsIt != m_commands.end()); - commandData = commandsIt->second; - commandData.fullName = startLowerCase(strip(attributes.find("name")->second, "vk")); - commandData.isAlias = true; - determineReducedName(commandData); - linkCommandToHandle(commandData); - - // add a DependencyData to this name - m_dependencies.push_back(DependencyData(DependencyData::Category::COMMAND, commandData.fullName)); - m_dependencies.back().dependencies.insert(alias); - } - else - { - checkElements(children, { "implicitexternsyncparams", "param", "proto" }); - - // read the success codes - auto successcodesAttribute = attributes.find("successcodes"); - if (successcodesAttribute != attributes.end()) - { - commandData.successCodes = tokenize(successcodesAttribute->second, ','); - for (auto & code : commandData.successCodes) - { - std::string tag = findTag(code, m_tags); - // on each success code: prepend 'e', strip "VK_" and a tag, convert it to camel case, and add the tag again - code = std::string("e") + toCamelCase(strip(code, "VK_", tag)) + tag; - } - } - - for (auto child : children) - { - std::string value = child->Value(); - if (value == "param") - { - commandData.twoStep |= readCommandParam(child, m_dependencies.back().dependencies, commandData.params); - } - else if (value == "proto") - { - readCommandProto(child, commandData.returnType, commandData.unchangedReturnType, commandData.fullName); - } -#if !defined(NDEBUG) - else - { - assert(value == "implicitexternsyncparams"); - skipImplicitExternSyncParams(child); - } -#endif - } - - determineReducedName(commandData); - linkCommandToHandle(commandData); - registerDeleter(commandData); - determineVectorParams(commandData); - determineReturnParam(commandData); - determineTemplateParam(commandData); - determineEnhancedReturnType(commandData); - determineSkippedParams(commandData); - } - - // insert the commandData into the commands-map, - assert(m_commands.find(commandData.fullName) == m_commands.end()); - m_commands.insert(std::make_pair(commandData.fullName, commandData)); -} - -void VulkanHppGenerator::readCommandProto(tinyxml2::XMLElement const* element, std::string & returnType, std::string & unchangedReturnType, std::string & fullName) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); - std::vector children = getChildElements(element); - checkOrderedElements(children, { "type", "name" }); - - // get return type and name of the command - returnType = strip(children[0]->GetText(), "Vk"); - unchangedReturnType = children[0]->GetText(); - fullName = startLowerCase(strip(children[1]->GetText(), "vk")); - - // add an empty DependencyData to this name - m_dependencies.push_back(DependencyData(DependencyData::Category::COMMAND, fullName)); -} - -void VulkanHppGenerator::readComment(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); - checkElements(getChildElements(element), {}); - - assert(element->GetText()); - std::string text = element->GetText(); - if (text.find("\nCopyright") == 0) - { - assert(m_vulkanLicenseHeader.empty()); - m_vulkanLicenseHeader = text; - - // erase the part after the Copyright text - size_t pos = m_vulkanLicenseHeader.find("\n\n------------------------------------------------------------------------"); - if (pos != std::string::npos) { - m_vulkanLicenseHeader.erase(pos); - } - - // replace any '\n' with "\n// " - for (pos = m_vulkanLicenseHeader.find('\n'); pos != std::string::npos; pos = m_vulkanLicenseHeader.find('\n', pos + 1)) - { - m_vulkanLicenseHeader.replace(pos, 1, "\n// "); - } - - // and add a little message on our own - m_vulkanLicenseHeader += "\n\n// This header is generated from the Khronos Vulkan XML API Registry."; - } - - m_vulkanLicenseHeader.erase(m_vulkanLicenseHeader.begin(), std::find_if(m_vulkanLicenseHeader.begin(), m_vulkanLicenseHeader.end(), [](char c) { return !std::isspace(c); })); -} - -void VulkanHppGenerator::readDisabledExtensionRequire(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); - std::vector children = getChildElements(element); - checkElements(children, { "command", "enum", "type" }); - - for (auto child : children) - { - checkElements(getChildElements(child), {}); - - std::string value = child->Value(); - if ((value == "command") || (value == "type")) - { - std::map attributes = getAttributes(child); - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, {}); - - // disable a command or a type ! - auto nameAttribute = attributes.find("name"); - std::string name = (value == "command") ? startLowerCase(strip(nameAttribute->second, "vk")) : strip(nameAttribute->second, "Vk"); - - // search this name in the dependencies list and remove it - std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&name](DependencyData const& dd) { return(dd.name == name); }); - assert(depIt != m_dependencies.end()); - m_dependencies.erase(depIt); - - // erase it from all dependency sets - for (auto & dep : m_dependencies) - { - dep.dependencies.erase(name); - } - - if (value == "command") - { - // first unlink the command from its class - auto commandsIt = m_commands.find(name); - assert(commandsIt != m_commands.end()); - assert(!commandsIt->second.className.empty()); - auto handlesIt = m_handles.find(commandsIt->second.className); - assert(handlesIt != m_handles.end()); - auto it = std::find(handlesIt->second.commands.begin(), handlesIt->second.commands.end(), name); - assert(it != handlesIt->second.commands.end()); - handlesIt->second.commands.erase(it); - - // then remove the command - m_commands.erase(name); - } - else - { - // a type simply needs to be removed from the structs and vkTypes sets - assert((m_structs.find(name) != m_structs.end()) && (m_vkTypes.find(name) != m_vkTypes.end())); - m_structs.erase(name); - m_vkTypes.erase(name); - } - } - else - { - assert(value == "enum"); - std::map attributes = getAttributes(child); - checkAttributes(attributes, child->GetLineNum(), { { "name",{} } }, { { "bitpos", {} }, { "extends",{} },{ "offset",{} },{ "value",{} } }); - } - } -} - -void VulkanHppGenerator::readEnums(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { { "comment",{} },{ "type",{ "bitmask", "enum" } } }); - std::vector children = getChildElements(element); - checkElements(children, { "comment", "enum", "unused" }); - - std::string name = strip(attributes.find("name")->second, "Vk"); - - if (name == "API Constants") - { - for (auto child : children) - { - assert(strcmp(child->Value(), "enum") == 0); - readEnumsConstant(child); - } - } - else - { - checkAttributes(attributes, element->GetLineNum(), { { "name",{} },{ "type",{ "bitmask", "enum" } } }, { { "comment",{} } }); // re-check with type as required - - if (std::find_if(m_dependencies.begin(), m_dependencies.end(), [&name](DependencyData const& dd) { return dd.name == name; }) == m_dependencies.end()) - { - // add an empty DependencyData on this name into the dependencies list - m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, name)); - - // add this enum to the set of Vulkan data types - assert(m_vkTypes.find(name) == m_vkTypes.end()); - m_vkTypes.insert(name); - } - - // ad an empty EnumData on this name into the enums map - std::map::iterator it = m_enums.insert(std::make_pair(name, EnumData(name))).first; - assert(it->second.postfix.empty() && it->second.prefix.empty() && it->second.protect.empty() && it->second.values.empty()); - - if (name == "Result") - { - // special handling for VKResult, as its enums just have VK_ in common - it->second.prefix = "VK_"; - } - else - { - std::string type = attributes.find("type")->second; - it->second.bitmask = (type == "bitmask"); - if (it->second.bitmask) - { - // for a bitmask enum, start with "VK", cut off the trailing "FlagBits", and convert that name to upper case - // end that with "Bit" - size_t pos = name.find("FlagBits"); - assert(pos != std::string::npos); - it->second.prefix = "VK" + toUpperCase(name.substr(0, pos)) + "_"; - } - else - { - // for a non-bitmask enum, start with "VK", and convert the name to upper case - it->second.prefix = "VK" + toUpperCase(name) + "_"; - } - - // if the enum name contains a tag move it from the prefix to the postfix to generate correct enum value names. - for (std::set::const_iterator tit = m_tags.begin(); tit != m_tags.end(); ++tit) - { - if ((tit->length() < it->second.prefix.length()) && (it->second.prefix.substr(it->second.prefix.length() - tit->length() - 1) == (*tit + "_"))) - { - it->second.prefix.erase(it->second.prefix.length() - tit->length() - 1); - it->second.postfix = "_" + *tit; - break; - } - else if ((tit->length() < it->second.name.length()) && (it->second.name.substr(it->second.name.length() - tit->length()) == *tit)) - { - it->second.postfix = "_" + *tit; - break; - } - } - } - - // read the names of the enum values - for (auto child : children) - { - std::string value = child->Value(); - if (value == "enum") - { - readEnumsEnum(child, it->second, ""); - } -#if !defined(NDEBUG) - else - { - assert((value == "comment") || (value == "unused")); - } -#endif - } - } -} - -void VulkanHppGenerator::readEnumsEnum(tinyxml2::XMLElement const* element, EnumData & enumData, std::string const& tag) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { {"alias", {} }, { "bitpos",{} },{ "comment",{} },{ "value",{} } }); - assert((attributes.find("alias") != attributes.end()) + (attributes.find("bitpos") != attributes.end()) + (attributes.find("value") != attributes.end()) == 1); - checkElements(getChildElements(element), {}); - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - auto enumIt = std::find_if(enumData.values.begin(), enumData.values.end(), [&aliasIt](EnumValueData const& evd) { return evd.value == aliasIt->second; }); - assert((enumIt != enumData.values.end()) && enumIt->alias.empty()); - enumIt->alias = createEnumValueName(attributes.find("name")->second, enumData.prefix, enumData.postfix, enumData.bitmask, tag); - } - else - { - enumData.addEnumValue(attributes.find("name")->second, tag, m_nameMap); - } -} - -void VulkanHppGenerator::readEnumsConstant(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { { "alias", {}}, { "comment",{} }, { "value",{} } }); - checkElements(getChildElements(element), {}); - std::string name = attributes.find("name")->second; - assert(m_constants.find(name) == m_constants.end()); - - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - checkAttributes(attributes, element->GetLineNum(), { {"alias", {}}, { "name", {}} }, {}); // re-check on alias type - checkAlias(m_constants, aliasIt->second, element->GetLineNum()); - m_constants[name] = m_constants.find(aliasIt->second)->second; - } - else - { - checkAttributes(attributes, element->GetLineNum(), { { "name",{} }, { "value", {}} }, { {"comment", {} } }); // re-check on non-alias type - m_constants[name] = attributes.find("value")->second; - } -} - -void VulkanHppGenerator::readExtensionCommand(tinyxml2::XMLElement const* element, std::string const& protect) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, {}); - checkElements(getChildElements(element), {}); - - // just add the protect string to the CommandData - if (!protect.empty()) - { - std::string name = startLowerCase(strip(attributes.find("name")->second, "vk")); - std::map::iterator cit = m_commands.find(name); - assert(cit != m_commands.end()); - cit->second.protect = protect; - } -} - -void VulkanHppGenerator::readExtensionEnum(tinyxml2::XMLElement const* element, std::string const& tag) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), - { - { "name", {} } - }, - { - { "alias", {} }, - { "bitpos", {} }, - { "comment", {} }, - { "dir", { "-" } }, - { "extends", {} }, - { "extnumber", {} }, - { "offset", {} }, - { "value", {} } - }); - checkElements(getChildElements(element), {}); - - // TODO process enums which don't extend existing enums - auto extendsIt = attributes.find("extends"); - if (extendsIt != attributes.end()) - { - std::string extends = strip(extendsIt->second, "Vk"); - auto enumIt = m_enums.find(extends); - assert(enumIt != m_enums.end()); - - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - checkAttributes(attributes, element->GetLineNum(), { { "alias", {} }, { "extends", {} }, { "name", {} } }, { { "comment",{} } }); - std::string alias = createEnumValueName(aliasIt->second, enumIt->second.prefix, enumIt->second.postfix, enumIt->second.bitmask, tag); - auto evdIt = std::find_if(enumIt->second.values.begin(), enumIt->second.values.end(), [&alias](EnumValueData const& evd) { return evd.name == alias; }); - assert(evdIt != enumIt->second.values.end()); - evdIt->alias = createEnumValueName(attributes.find("name")->second, enumIt->second.prefix, enumIt->second.postfix, enumIt->second.bitmask, tag); - if (evdIt->name == evdIt->alias) - { - // skip alias, that would result in the very same enum name - evdIt->alias.clear(); - } - } - else - { - assert((attributes.find("bitpos") != attributes.end()) + (attributes.find("offset") != attributes.end()) + (attributes.find("value") != attributes.end()) == 1); - enumIt->second.addEnumValue(attributes.find("name")->second, tag, m_nameMap); - } - } -} - -void VulkanHppGenerator::readExtensionRequire(tinyxml2::XMLElement const* element, std::string const& protect, std::string const& tag) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, { { "extension",{} },{ "feature",{} } }); - std::vector children = getChildElements(element); - checkElements(children, { "command", "comment", "enum", "type" }); - - for (auto child : children) - { - std::string value = child->Value(); - - if (value == "command") - { - readExtensionCommand(child, protect); - } - else if (value == "enum") - { - readExtensionEnum(child, tag); - } - else if (value == "type") - { - readExtensionType(child, protect); - } -#if !defined(NDEBUG) - else - { - assert(value == "comment"); - checkEmptyElement(child); - } -#endif - } -} - -void VulkanHppGenerator::readExtensions(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "comment",{} } }, {}); - std::vector children = getChildElements(element); - checkElements(children, { "extension" }); - - for (auto child : children) - { - readExtensionsExtension(child); - } -} - -void VulkanHppGenerator::readExtensionsExtension(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), - { - { "name",{} }, - { "number",{} }, - { "supported",{ "disabled", "vulkan" } } - }, - { - { "author",{} }, - { "comment", {} }, - { "contact",{} }, - { "deprecatedby", {} }, - { "obsoletedby", {} }, - { "platform",{} }, - { "promotedto", {} }, - { "provisional", {} }, - { "protect",{} }, - { "requires",{} }, - { "requiresCore",{} }, - { "type",{ "device", "instance" } } - }); - std::vector children = getChildElements(element); - checkElements(children, { "require" }); - - if (attributes.find("supported")->second == "disabled") - { - // kick out all the disabled stuff we've read before !! - for (tinyxml2::XMLElement const* child = element->FirstChildElement(); child; child = child->NextSiblingElement()) - { - assert(strcmp(child->Value(), "require") == 0); - readDisabledExtensionRequire(child); - } - } - else - { - std::string name = attributes.find("name")->second; - std::string tag = extractTag(name); - assert(m_tags.find(tag) != m_tags.end()); - - auto protectAttribute = attributes.find("protect"); - auto platformAttribute = attributes.find("platform"); - std::string protect; - if (protectAttribute != attributes.end()) - { - protect = protectAttribute->second; - } - else if (platformAttribute != attributes.end()) - { - auto authorAttribute = attributes.find("author"); - assert(authorAttribute != attributes.end()); - protect = "VK_USE_PLATFORM_" + toUpperCase(platformAttribute->second) + "_" + authorAttribute->second; - } - -#if !defined(NDEBUG) - assert(m_extensions.find(name) == m_extensions.end()); - ExtensionData & extension = m_extensions.insert(std::make_pair(name, ExtensionData())).first->second; - extension.protect = protect; - auto requiresAttribute = attributes.find("requires"); - if (requiresAttribute != attributes.end()) - { - extension.requires = tokenize(requiresAttribute->second, ','); - } -#endif - - for (auto child : children) - { - readExtensionRequire(child, protect, tag); - } - } -} - -void VulkanHppGenerator::readExtensionType(tinyxml2::XMLElement const* element, std::string const& protect) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, {}); - checkElements(getChildElements(element), {}); - - // add the protect-string to the appropriate type: enum, flag, handle, scalar, or struct - if (!protect.empty()) - { - std::string name = strip(attributes.find("name")->second, "Vk"); - std::map::iterator bitmasksIt = m_bitmasks.find(name); - if (bitmasksIt != m_bitmasks.end()) - { - bitmasksIt->second.protect = protect; - - // if the enum of this flags is auto-generated, protect it as well - std::string enumName = generateEnumNameForFlags(name); - std::map::iterator enumsIt = m_enums.find(enumName); - assert(enumsIt != m_enums.end()); - if (enumsIt->second.values.empty()) - { - enumsIt->second.protect = protect; - } - } - else - { - std::map::iterator eit = m_enums.find(name); - if (eit != m_enums.end()) - { - eit->second.protect = protect; - } - else - { - std::map::iterator hait = m_handles.find(name); - if (hait != m_handles.end()) - { - hait->second.protect = protect; - } - else - { - std::map::iterator scit = m_scalars.find(name); - if (scit != m_scalars.end()) - { - scit->second.protect = protect; - } - else - { - std::map::iterator stit = m_structs.find(name); - if (stit != m_structs.end()) - { - stit->second.protect = protect; - } - else - { - assert(m_defines.find(name) != m_defines.end()); - } - } - } - } - } - } -} - -void VulkanHppGenerator::readFeature(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "api",{ "vulkan" } },{ "comment",{} },{ "name",{} },{ "number",{} } }, {}); - std::vector children = getChildElements(element); - checkElements(children, { "require" }); - - for (auto child : children) - { - readFeatureRequire(child); - } -} - -void VulkanHppGenerator::readFeatureRequire(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, { { "comment",{} } }); - std::vector children = getChildElements(element); - checkElements(children, { "command", "comment", "enum", "type" }); - - for (auto child : children) - { - std::string value = child->Value(); - if (value == "enum") - { - readFeatureRequireEnum(child); - } -#if !defined(NDEBUG) - else - { - assert((value == "command") || (value == "comment") || (value == "type")); - skipFeatureRequire(child); - } -#endif - } -} - -void VulkanHppGenerator::readFeatureRequireEnum(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), - { - { "name",{} } - }, - { - { "bitpos",{} }, - { "comment",{} }, - { "dir", { "-" } }, - { "extends",{} }, - { "extnumber", {} }, - { "offset", {} }, - { "value",{} } - }); - checkElements(getChildElements(element), {}); - - auto extendsAttribute = attributes.find("extends"); - if (extendsAttribute != attributes.end()) - { - assert(strncmp(extendsAttribute->second.c_str(), "Vk", 2) == 0); - std::string extends = strip(extendsAttribute->second, "Vk"); - auto enumIt = m_enums.find(extends); - assert(enumIt != m_enums.end()); - enumIt->second.addEnumValue(attributes.find("name")->second, "", m_nameMap); - } -} - -void VulkanHppGenerator::readTags(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), { { "comment",{} } }, {}); - std::vector children = getChildElements(element); - checkElements(children, { "tag" }); - - for (auto child : children) - { - std::string value = child->Value(); - assert(value == "tag"); - readTag(child); - } -} - -void VulkanHppGenerator::readTag(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "author",{} },{ "contact",{} },{ "name",{} } }, {}); - checkElements(getChildElements(element), {}); - - for (auto const& attribute : attributes) - { - std::string name = attribute.first; - if (name == "name") - { - std::string value = attribute.second; - m_tags.insert(value); - } - else - { - assert((name == "author") || (name == "contact")); - } - } -} - -void VulkanHppGenerator::readType(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - - auto categoryIt = attributes.find("category"); - if (categoryIt != attributes.end()) - { - if (categoryIt->second == "basetype") - { - readTypeBasetype(element, attributes); - } - else if (categoryIt->second == "bitmask") - { - readTypeBitmask(element, attributes); - } - else if (categoryIt->second == "define") - { - readTypeDefine(element, attributes); - } - else if (categoryIt->second == "funcpointer") - { - readTypeFuncpointer(element, attributes); - } - else if (categoryIt->second == "handle") - { - readTypeHandle(element, attributes); - } - else if (categoryIt->second == "struct") - { - readTypeStruct(element, false, attributes); - } - else if (categoryIt->second == "union") - { - readTypeStruct(element, true, attributes); - } -#if !defined(NDEBUG) - else if (categoryIt->second == "enum") - { - skipTypeEnum(element, attributes); - } - else if (categoryIt->second == "include") - { - skipTypeInclude(element); - } - else -#else - else if ((categoryIt->second != "enum") && (categoryIt->second != "include")) -#endif - { - std::stringstream ss; - ss << element->GetLineNum(); - std::string lineNumber = ss.str(); - - throw std::runtime_error("Spec error on line " + lineNumber + ": unknown category <" + categoryIt->second + ">"); - } - } - else - { - assert(attributes.find("name") != attributes.end()); - readTypeName(element, attributes); - } -} - -void VulkanHppGenerator::readTypeBasetype(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "category",{ "basetype" } } }, {}); - std::vector children = getChildElements(element); - checkOrderedElements(children, { "type", "name" }); - checkEmptyElement(children[0]); - checkEmptyElement(children[1]); - - std::string type = children[0]->GetText(); - assert((type == "uint32_t") || (type == "uint64_t")); - - std::string name = strip(children[1]->GetText(), "Vk"); - - // skip "Flags", - if (name != "Flags") - { - m_dependencies.push_back(DependencyData(DependencyData::Category::SCALAR, name)); - m_dependencies.back().dependencies.insert(type); - } - else - { - assert(type == "uint32_t"); - } -} - -void VulkanHppGenerator::readTypeBitmask(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "category", { "bitmask" } } }, { { "alias", {} }, { "name", {}}, { "requires", {} } }); - std::vector children = getChildElements(element); - - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - checkAttributes(attributes, element->GetLineNum(), { { "alias", {} }, { "category", {"bitmask"} }, { "name", {} } }, {}); // re-check on alias type! - checkElements(children, {}); - - std::string alias = strip(aliasIt->second, "Vk"); - checkAlias(m_bitmasks, alias, element->GetLineNum()); - - std::string name = strip(attributes.find("name")->second, "Vk"); - - auto bitmasksIt = m_bitmasks.find(alias); - assert((bitmasksIt != m_bitmasks.end()) && bitmasksIt->second.alias.empty()); - bitmasksIt->second.alias = name; - } - else - { - checkOrderedElements(children, { "type", "name" }); - checkEmptyElement(children[0]); - checkEmptyElement(children[1]); - - assert(strcmp(children[0]->GetText(), "VkFlags") == 0); - - std::string name = strip(children[1]->GetText(), "Vk"); - - std::string requires; - auto requiresIt = attributes.find("requires"); - if (requiresIt != attributes.end()) - { - requires = strip(requiresIt->second, "Vk"); - } - else - { - // Generate FlagBits name, add a DependencyData for that name, and add it to the list of enums and vulkan types - requires = generateEnumNameForFlags(name); - assert(std::find_if(m_dependencies.begin(), m_dependencies.end(), [&requires](DependencyData const& dd) { return dd.name == requires; }) == m_dependencies.end()); - m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, requires)); - assert(m_enums.find(requires) == m_enums.end()); - m_enums.insert(std::make_pair(requires, EnumData(requires, true))); - assert(m_vkTypes.find(requires) == m_vkTypes.end()); - m_vkTypes.insert(requires); - } - - // add a DependencyData for the bitmask name, with the required type as its first dependency - m_dependencies.push_back(DependencyData(DependencyData::Category::BITMASK, name)); - m_dependencies.back().dependencies.insert(requires); - - m_bitmasks.insert(std::make_pair(name, BitmaskData())); - - assert(m_vkTypes.find(name) == m_vkTypes.end()); - m_vkTypes.insert(name); - } -} - -void VulkanHppGenerator::readTypeDefine(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "category",{ "define" } } }, { { "name",{} } }); - - auto nameIt = attributes.find("name"); - if (nameIt != attributes.end()) - { - assert(!element->FirstChildElement()); - assert(nameIt->second == "VK_DEFINE_NON_DISPATCHABLE_HANDLE"); - - // filter out the check for the different types of VK_DEFINE_NON_DISPATCHABLE_HANDLE - std::string text = element->LastChild()->ToText()->Value(); - size_t start = text.find("#if defined(__LP64__)"); - size_t end = text.find_first_of("\r\n", start + 1); - m_typesafeCheck = text.substr(start, end - start); - } - else if (element->GetText() && (trim(element->GetText()) == "struct")) - { - tinyxml2::XMLElement const* child = element->FirstChildElement(); - assert(child && (strcmp(child->Value(), "name") == 0) && child->GetText()); - m_defines.insert(child->GetText()); - m_dependencies.push_back(DependencyData(DependencyData::Category::REQUIRED, child->GetText())); - } - else - { - tinyxml2::XMLElement const* child = element->FirstChildElement(); - assert(child && !child->FirstAttribute() && (strcmp(child->Value(), "name") == 0) && child->GetText()); - std::string text = trim(child->GetText()); - if (text == "VK_HEADER_VERSION") - { - m_version = trimEnd(element->LastChild()->ToText()->Value()); - } - // ignore all the other defines - assert(!child->NextSiblingElement() || (child->NextSiblingElement() && !child->NextSiblingElement()->FirstAttribute() && (strcmp(child->NextSiblingElement()->Value(), "type") == 0) && !child->NextSiblingElement()->NextSiblingElement())); - } -} - -void VulkanHppGenerator::readTypeFuncpointer(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "category",{ "funcpointer" } } }, { { "requires",{} } }); - std::vector children = getChildElements(element); - checkElements(children, { "name", "type" }); - assert(!children.empty()); - checkEmptyElement(children[0]); - - assert((strcmp(children[0]->Value(), "name") == 0) && children[0]->GetText()); - m_dependencies.push_back(DependencyData(DependencyData::Category::FUNC_POINTER, children[0]->GetText())); - -#if !defined(NDEBUG) - for (size_t i = 1; i < children.size(); i++) - { - checkEmptyElement(children[i]); - } -#endif -} - -void VulkanHppGenerator::readTypeHandle(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "category",{ "handle" } } }, { { "alias",{} }, { "name",{} }, { "parent",{} } }); - std::vector children = getChildElements(element); - - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - checkAttributes(attributes, element->GetLineNum(), { { "alias",{} },{ "category",{ "handle" } },{ "name",{} } }, {}); // re-check on alias type! - checkElements(children, {}); - - std::string alias = strip(aliasIt->second, "Vk"); - checkAlias(m_handles, alias, element->GetLineNum()); - - std::string name = strip(attributes.find("name")->second, "Vk"); - - auto handlesIt = m_handles.find(alias); - assert((handlesIt != m_handles.end()) && handlesIt->second.alias.empty()); - handlesIt->second.alias = name; - } - else - { - checkOrderedElements(children, { "type", "name" }); - checkEmptyElement(children[0]); - checkEmptyElement(children[1]); - -#if !defined(NDEBUG) - std::string type = children[0]->GetText(); - assert((type.find("VK_DEFINE_HANDLE") == 0) || (type.find("VK_DEFINE_NON_DISPATCHABLE_HANDLE") == 0)); -#endif - - std::string name = strip(children[1]->GetText(), "Vk"); - - m_dependencies.push_back(DependencyData(DependencyData::Category::HANDLE, name)); - - assert(m_vkTypes.find(name) == m_vkTypes.end()); - m_vkTypes.insert(name); - assert(m_handles.find(name) == m_handles.end()); - m_handles.insert(std::make_pair(name, HandleData())); - } -} - -void VulkanHppGenerator::readTypeName(tinyxml2::XMLElement const* element, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { { "requires",{} } }); - checkElements(getChildElements(element), {}); - - auto nameIt = attributes.find("name"); - assert(nameIt != attributes.end()); - m_dependencies.push_back(DependencyData(DependencyData::Category::REQUIRED, nameIt->second)); -} - -void VulkanHppGenerator::readTypes(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), { { "comment",{} } }, {}); - std::vector children = getChildElements(element); - checkElements(children, { "comment", "type" }); - - for (auto child : children) - { - std::string value = child->Value(); - if (value == "type") - { - readType(child); - } -#if !defined(NDEBUG) - else - { - assert(value == "comment"); - checkEmptyElement(child); - } -#endif - } -} - -void VulkanHppGenerator::readTypeStruct(tinyxml2::XMLElement const* element, bool isUnion, std::map const& attributes) -{ - checkAttributes(attributes, element->GetLineNum(), - { - { "category",{ isUnion ? "union" : "struct" } }, - { "name",{} } - }, - { - { "alias", {} }, - { "comment",{} }, - { "returnedonly",{ "true" } }, - { "structextends",{} } - }); - std::vector children = getChildElements(element); - checkElements(children, { "comment", "member" }); - - std::string name = strip(attributes.find("name")->second, "Vk"); - - auto aliasIt = attributes.find("alias"); - if (aliasIt != attributes.end()) - { - checkAttributes(attributes, element->GetLineNum(), { { "alias", {}}, {"category", {"struct"}}, { "name", {}} }, {}); // re-check on alias type! - - std::string alias = strip(aliasIt->second, "Vk"); - checkAlias(m_structs, alias, element->GetLineNum()); - - auto structsIt = m_structs.find(alias); - assert((structsIt != m_structs.end()) && structsIt->second.alias.empty()); - structsIt->second.alias = name; - } - else - { - m_dependencies.push_back(DependencyData(isUnion ? DependencyData::Category::UNION : DependencyData::Category::STRUCT, name)); - - assert(m_structs.find(name) == m_structs.end()); - std::map::iterator it = m_structs.insert(std::make_pair(name, StructData())).first; - it->second.returnedOnly = (attributes.find("returnedonly") != attributes.end()); - it->second.isUnion = isUnion; - - auto attributesIt = attributes.find("structextends"); - if (attributesIt != attributes.end()) - { - std::vector structExtends = tokenize(attributesIt->second, ','); - for (auto const& s : structExtends) - { - assert(s.substr(0, 2) == "Vk"); - std::string strippedName = s.substr(2); - it->second.structExtends.push_back(strippedName); - m_extendedStructs.insert(strippedName); - } - assert(!it->second.structExtends.empty()); - } - - for (auto child : children) - { - assert(child->Value()); - std::string value = child->Value(); - if (value == "member") - { - readTypeStructMember(child, it->second); - } -#if !defined(NDEBUG) - else - { - assert(value == "comment"); - checkEmptyElement(child); - } -#endif - } - - for (auto const& s : m_structs) - { - if (isSubStruct(s, name, it->second)) - { - it->second.subStruct = s.first; - break; // just take the very first candidate as a subStruct, skip any possible others! - } - } - } - - assert(m_vkTypes.find(name) == m_vkTypes.end()); - m_vkTypes.insert(name); -} - -void VulkanHppGenerator::readTypeStructMember(tinyxml2::XMLElement const* element, StructData & structData) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), {}, - { - { "altlen",{} }, - { "externsync",{ "true" } }, - { "len",{} }, - { "noautovalidity",{ "true" } }, - { "optional",{ "false", "true" } }, - { "values",{} } - }); - std::vector children = getChildElements(element); - checkElements(children, { "comment", "enum", "name", "type" }); - for (auto child : children) - { - checkEmptyElement(child); - } - - structData.members.push_back(MemberData()); - MemberData & member = structData.members.back(); - - auto valuesAttribute = attributes.find("values"); - if (valuesAttribute != attributes.end()) - { - member.values = valuesAttribute->second; - } - - tinyxml2::XMLNode const* child = element->FirstChild(); - assert(child); - if (child->ToText()) - { - std::string value = trim(child->Value()); - assert((value == "const") || (value == "struct") || value == "const struct"); - member.type = value + " "; - child = child->NextSibling(); - assert(child); - } - - assert(child->ToElement()); - tinyxml2::XMLElement const* typeElement = child->ToElement(); - assert((strcmp(typeElement->Value(), "type") == 0) && typeElement->GetText()); - member.pureType = strip(typeElement->GetText(), "Vk"); - member.type += member.pureType; - - child = typeElement->NextSibling(); - assert(child); - if (child->ToText()) - { - std::string value = trimEnd(child->Value()); - assert((value == "*") || (value == "**") || (value == "* const*")); - member.type += value; - child = child->NextSibling(); - } - - m_dependencies.back().dependencies.insert(member.pureType); - - assert(child->ToElement()); - tinyxml2::XMLElement const* nameElement = child->ToElement(); - assert((strcmp(nameElement->Value(), "name") == 0) && nameElement->GetText()); - member.name = nameElement->GetText(); - - member.arraySize = readArraySize(nameElement, member.name); -} - -void VulkanHppGenerator::registerDeleter(CommandData const& commandData) -{ - if ((commandData.fullName.substr(0, 7) == "destroy") || (commandData.fullName.substr(0, 4) == "free")) - { - std::string key; - size_t valueIndex; - switch (commandData.params.size()) - { - case 2: - case 3: - assert(commandData.params.back().pureType == "AllocationCallbacks"); - key = (commandData.params.size() == 2) ? "" : commandData.params[0].pureType; - valueIndex = commandData.params.size() - 2; - break; - case 4: - key = commandData.params[0].pureType; - valueIndex = 3; - assert(m_deleters.find(commandData.params[valueIndex].pureType) == m_deleters.end()); - m_deleters[commandData.params[valueIndex].pureType].pool = commandData.params[1].pureType; - break; - default: - assert(false); - valueIndex = 0; - } - assert(m_deleterTypes[key].find(commandData.params[valueIndex].pureType) == m_deleterTypes[key].end()); - m_deleterTypes[key].insert(commandData.params[valueIndex].pureType); - m_deleters[commandData.params[valueIndex].pureType].call = commandData.reducedName; - } -} - -void VulkanHppGenerator::setDefault(std::string const& name, std::map & defaultValues, EnumData const& enumData) -{ - defaultValues[name] = name + (enumData.values.empty() ? "()" : ("::" + enumData.values.front().name)); -} - -void VulkanHppGenerator::sortDependencies() -{ - std::set listedTypes = { "VkFlags" }; - std::list sortedDependencies; - - while (!m_dependencies.empty()) - { - bool found = false; - for (std::list::iterator it = m_dependencies.begin(); it != m_dependencies.end(); ++it) - { - // check if all dependencies of it are already listed - if (std::find_if(it->dependencies.begin(), it->dependencies.end(), [&listedTypes](std::string const& d) { return listedTypes.find(d) == listedTypes.end(); }) == it->dependencies.end()) - { - // add it to the end of the sorted list and the set of listed types, remove it from the list of dependencies to handle and start over with the next dependency - sortedDependencies.push_back(*it); - listedTypes.insert(it->name); - - // if it is a struct, add any alias of it to the list of encountered types - if (it->category == DependencyData::Category::STRUCT) - { - std::map::const_iterator sit = m_structs.find(it->name); - assert(sit != m_structs.end()); - if (!sit->second.alias.empty()) - { - assert(listedTypes.find(sit->second.alias) == listedTypes.end()); - listedTypes.insert(sit->second.alias); - } - } - m_dependencies.erase(it); - found = true; - break; - } - } - if (!found) - { - // at least one dependency of it is not yet listed -> resolve direct circular dependencies - for (std::list::iterator it = m_dependencies.begin(); !found && it != m_dependencies.end(); ++it) - { - for (std::set::const_iterator dit = it->dependencies.begin(); dit != it->dependencies.end(); ++dit) - { - std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&dit](DependencyData const& dd) { return(dd.name == *dit); }); - if (depIt != m_dependencies.end()) - { - if (depIt->dependencies.find(it->name) != depIt->dependencies.end()) - { - // we only have two cases, for now! - assert((it->category == DependencyData::Category::HANDLE) && (depIt->category == DependencyData::Category::STRUCT) - || (it->category == DependencyData::Category::STRUCT) && (depIt->category == DependencyData::Category::STRUCT)); - it->forwardDependencies.insert(*dit); - it->dependencies.erase(*dit); - found = true; - break; - } - } -#if !defined(NDEBUG) - else - { - // here, only already sorted dependencies should occur, or structs that are aliased and sorted - std::list::const_iterator sdit = std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [&dit](DependencyData const& dd) { return(dd.name == *dit); }); - if (sdit == sortedDependencies.end()) - { - std::map::const_iterator sit = std::find_if(m_structs.begin(), m_structs.end(), [&dit](std::pair const& sd) { return sd.second.alias == *dit; }); - assert(sit != m_structs.end()); - assert(std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [name = sit->first](DependencyData const& dd) { return dd.name == name; }) != sortedDependencies.end()); - } - } -#endif - } - } - } - assert(found); - } - - m_dependencies.swap(sortedDependencies); -} - -void VulkanHppGenerator::writeArguments(std::ostream & os, CommandData const& commandData, bool firstCall, bool singular, size_t from, size_t to) -{ - assert(from <= to); - - // get the parameter indices of the counter for vector parameters - std::map countIndices; - for (std::map::const_iterator it = commandData.vectorParams.begin(); it != commandData.vectorParams.end(); ++it) - { - countIndices.insert(std::make_pair(it->second, it->first)); - } - - bool encounteredArgument = false; - for (size_t i = from; i < to; i++) - { - if (encounteredArgument) - { - os << ", "; - } - - std::map::const_iterator it = countIndices.find(i); - if (it != countIndices.end()) - { - writeCallCountParameter(os, commandData, singular, it); - } - else if ((it = commandData.vectorParams.find(i)) != commandData.vectorParams.end()) - { - writeCallVectorParameter(os, commandData, firstCall, singular, it); - } - else if (m_vkTypes.find(commandData.params[i].pureType) != m_vkTypes.end()) - { - writeCallVulkanTypeParameter(os, commandData.params[i]); - } - else - { - writeCallPlainTypeParameter(os, commandData.params[i]); - } - encounteredArgument = true; - } -} - -void VulkanHppGenerator::writeBitmaskToString(std::ostream & os, std::string const& bitmaskName, EnumData const &enumData) -{ - // the helper functions to make strings out of flag values - enterProtect(os, enumData.protect); - os << " VULKAN_HPP_INLINE std::string to_string(" << bitmaskName << (enumData.values.empty() ? ")" : " value)") << std::endl - << " {" << std::endl; - if (enumData.values.empty()) - { - // no flags values in this enum -> return "{}" - os << " return \"{}\";" << std::endl; - } - else - { - os << " if (!value) return \"{}\";" << std::endl - << " std::string result;" << std::endl; - - // 'or' together all the bits in the value - for (auto valuesIt = enumData.values.begin(); valuesIt != enumData.values.end(); ++valuesIt) - { - os << " if (value & " << enumData.name << "::" << valuesIt->name << ") result += \"" << valuesIt->name.substr(1) << " | \";" << std::endl; - } - // cut off the last three characters from the result (being " | ") - os << " return \"{\" + result.substr(0, result.size() - 3) + \"}\";" << std::endl; - } - os << " }" << std::endl; - leaveProtect(os, enumData.protect); - os << std::endl; -} - -void VulkanHppGenerator::writeCall(std::ostream & os, CommandData const& commandData, bool firstCall, bool singular) -{ - // the original function call - os << "d.vk" << startUpperCase(commandData.fullName) << "( "; - - if (!commandData.className.empty()) - { - // if it's member of a class -> the first argument is the member variable, starting with "m_" - assert(commandData.className == commandData.params[0].type); - os << "m_" << startLowerCase(commandData.className); - if (1 < commandData.params.size()) - { - os << ", "; - } - } - - writeArguments(os, commandData, firstCall, singular, commandData.className.empty() ? 0 : 1, commandData.params.size()); - os << " )"; -} - -void VulkanHppGenerator::writeCallCountParameter(std::ostream & os, CommandData const& commandData, bool singular, std::map::const_iterator it) -{ - // this parameter is a count parameter for a vector parameter - if ((commandData.returnParam == it->second) && commandData.twoStep) - { - // the corresponding vector parameter is the return parameter and it's a two-step algorithm - // -> use the pointer to a local variable named like the counter parameter without leading 'p' - os << "&" << startLowerCase(strip(commandData.params[it->first].name, "p")); - } - else - { - // the corresponding vector parameter is not the return parameter, or it's not a two-step algorithm - if (singular) - { - // for the singular version, the count is just 1. - os << "1 "; - } - else - { - // for the non-singular version, the count is the size of the vector parameter - // -> use the vector parameter name without leading 'p' to get the size (in number of elements, not in bytes) - os << startLowerCase(strip(commandData.params[it->second].name, "p")) << ".size() "; - } - if (commandData.templateParam == it->second) - { - // if the vector parameter is templatized -> multiply by the size of that type to get the size in bytes - os << "* sizeof( T ) "; - } - } -} - -void VulkanHppGenerator::writeCallPlainTypeParameter(std::ostream & os, ParamData const& paramData) -{ - // this parameter is just a plain type - if (paramData.type.back() == '*') - { - // it's a pointer - std::string parameterName = startLowerCase(strip(paramData.name, "p")); - if (paramData.type.find("const") != std::string::npos) - { - // it's a const pointer - if (paramData.pureType == "char") - { - // it's a const pointer to char -> it's a string -> get the data via c_str() - os << parameterName; - if (paramData.optional) - { - // it's optional -> might use nullptr - os << " ? " << parameterName << "->c_str() : nullptr"; - } - else - { - os << ".c_str()"; - } - } - else - { - // it's const pointer to something else -> just use the name - assert(!paramData.optional); - os << paramData.name; - } - } - else - { - // it's a non-const pointer, and char is the only type that occurs -> use the address of the parameter - assert(paramData.type.find("char") == std::string::npos); - os << "&" << parameterName; - } - } - else - { - // it's a plain parameter -> just use its name - os << paramData.name; - } -} - -void VulkanHppGenerator::writeCallVectorParameter(std::ostream & os, CommandData const& commandData, bool firstCall, bool singular, std::map::const_iterator it) -{ - // this parameter is a vector parameter - assert(commandData.params[it->first].type.back() == '*'); - if ((commandData.returnParam == it->first) && commandData.twoStep && firstCall) - { - // this parameter is the return parameter, and it's the first call of a two-step algorithm -> just just nullptr - os << "nullptr"; - } - else - { - std::string parameterName = startLowerCase(strip(commandData.params[it->first].name, "p")); - std::set::const_iterator vkit = m_vkTypes.find(commandData.params[it->first].pureType); - if ((vkit != m_vkTypes.end()) || (it->first == commandData.templateParam)) - { - // CHECK for !commandData.params[it->first].optional - - // this parameter is a vulkan type or a templated type -> need to reinterpret cast - writeReinterpretCast(os, commandData.params[it->first].type.find("const") == 0, vkit != m_vkTypes.end(), commandData.params[it->first].pureType, commandData.params[it->first].type.rfind("* const") != std::string::npos); - os << "( "; - if (singular) - { - // in singular case, strip the plural-S from the name, and use the pointer to that thing - os << "&" << stripPluralS(parameterName); - } - else - { - // in plural case, get the pointer to the data - os << parameterName << ".data()"; - } - os << " )"; - } - else if (commandData.params[it->first].pureType == "char") - { - // the parameter is a vector to char -> it might be optional - // besides that, the parameter now is a std::string -> get the pointer via c_str() - os << parameterName; - if (commandData.params[it->first].optional) - { - os << " ? " << parameterName << "->c_str() : nullptr"; - } - else - { - os << ".c_str()"; - } - } - else - { - // this parameter is just a vetor -> get the pointer to its data - os << parameterName << ".data()"; - } - } -} - -void VulkanHppGenerator::writeCallVulkanTypeParameter(std::ostream & os, ParamData const& paramData) -{ - // this parameter is a vulkan type - if (paramData.type.back() == '*') - { - // it's a pointer -> needs a reinterpret cast to the vulkan type - std::string parameterName = startLowerCase(strip(paramData.name, "p")); - writeReinterpretCast(os, paramData.type.find("const") != std::string::npos, true, paramData.pureType, false); - os << "( "; - if (paramData.optional) - { - // for an optional parameter, we need also a static_cast from optional type to const-pointer to pure type - os << "static_cast( " << parameterName << " )"; - } - else - { - // other parameters can just use the pointer - os << "&" << parameterName; - } - os << " )"; - } - else - { - // a non-pointer parameter needs a static_cast from vk::-type to vulkan type - os << "static_cast( " << paramData.name << " )"; - } -} - -void VulkanHppGenerator::writeEnumsToString(std::ostream & os, EnumData const& enumData) -{ - // the helper functions to make strings out of enum values - enterProtect(os, enumData.protect); - os << " VULKAN_HPP_INLINE std::string to_string(" << enumData.name << (enumData.values.empty() ? ")" : " value)") << std::endl - << " {" << std::endl; - if (enumData.values.empty()) - { - // no enum values in this enum -> return "(void)" - os << " return \"(void)\";" << std::endl; - } - else - { - // otherwise switch over the value and return the a stringized version of that value (without leading 'e') - os << " switch (value)" << std::endl - << " {" << std::endl; - for (auto const& value : enumData.values) - { - os << " case " << enumData.name << "::" << value.name << ": return \"" << value.name.substr(1) << "\";" << std::endl; - } - os << " default: return \"invalid\";" << std::endl - << " }" << std::endl; - } - os << " }" << std::endl; - leaveProtect(os, enumData.protect); - os << std::endl; -} - -// Intended only for `enum class Result`! -void VulkanHppGenerator::writeExceptionsForEnum(std::ostream & os, EnumData const& enumData) -{ - std::string templateString = - R"( class ${className} : public SystemError - { - public: - ${className}( std::string const& message ) - : SystemError( make_error_code( ${enumName}::${enumMemberName} ), message ) {} - ${className}( char const * message ) - : SystemError( make_error_code( ${enumName}::${enumMemberName} ), message ) {} - }; -)"; - - enterProtect(os, enumData.protect); - for (size_t i = 0; i < enumData.values.size(); i++) - { - if (!isErrorEnum(enumData.values[i].name)) - { - continue; - } - os << replaceWithMap(templateString, - { { "className", stripErrorEnumPrefix(enumData.values[i].name) + "Error" }, - { "enumName", enumData.name }, - { "enumMemberName", enumData.values[i].name } - }); - } - leaveProtect(os, enumData.protect); - os << std::endl; -} - -void VulkanHppGenerator::writeFunction(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool definition, bool enhanced, bool singular, bool unique, bool isStructureChain) -{ - writeFunctionHeaderTemplate(os, indentation, commandData, enhanced, unique, !definition, isStructureChain); - - os << indentation << (definition ? "VULKAN_HPP_INLINE " : ""); - writeFunctionHeaderReturnType(os, commandData, enhanced, singular, unique, isStructureChain); - if (definition && !commandData.className.empty()) - { - os << commandData.className << "::"; - } - writeFunctionHeaderName(os, commandData.reducedName, singular, unique); - writeFunctionHeaderArguments(os, commandData, enhanced, singular, !definition); - os << (definition ? "" : ";") << std::endl; - - if (definition) - { - // write the function body - os << indentation << "{" << std::endl; - if (enhanced) - { - writeFunctionBodyEnhanced(os, indentation, commandData, singular, unique, isStructureChain); - } - else - { - writeFunctionBodyStandard(os, indentation, commandData); - } - os << indentation << "}" << std::endl; - } -} - -void VulkanHppGenerator::writeFunctionBodyEnhanced(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool singular, bool unique, bool isStructureChain) -{ - if (unique && !singular && (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end())) // returns a vector of UniqueStuff - { - std::string const stringTemplate = -R"(${i} static_assert( sizeof( ${type} ) <= sizeof( Unique${type} ), "${type} is greater than Unique${type}!" ); -${i} std::vector ${typeVariable}s; -${i} ${typeVariable}s.reserve( ${vectorSize} ); -${i} ${type}* buffer = reinterpret_cast<${type}*>( reinterpret_cast( ${typeVariable}s.data() ) + ${vectorSize} * ( sizeof( Unique${type} ) - sizeof( ${type} ) ) ); -${i} Result result = static_cast(d.vk${command}( m_device, ${arguments}, reinterpret_cast( buffer ) ) ); - -${i} ${Deleter}<${DeleterTemplate},Dispatch> deleter( *this, ${deleterArg}, d ); -${i} for ( size_t i=0 ; i<${vectorSize} ; i++ ) -${i} { -${i} ${typeVariable}s.push_back( Unique${type}( buffer[i], deleter ) ); -${i} } - -${i} return createResultValue( result, ${typeVariable}s, VULKAN_HPP_NAMESPACE_STRING "::${class}::${function}Unique" ); -)"; - - std::string type = (commandData.returnParam != ~0) ? commandData.params[commandData.returnParam].pureType : ""; - std::string typeVariable = startLowerCase(type); - std::ostringstream arguments; - writeArguments(arguments, commandData, true, singular, 1, commandData.params.size() - 1); - - std::map::const_iterator ddit = m_deleters.find(type); - assert(ddit != m_deleters.end()); - - bool isCreateFunction = (commandData.fullName.substr(0, 6) == "create"); - os << replaceWithMap(stringTemplate, std::map - { - { "i", indentation }, - { "type", type }, - { "typeVariable", typeVariable }, - { "vectorSize", isCreateFunction ? "createInfos.size()" : "allocateInfo." + typeVariable + "Count" }, - { "command", startUpperCase(commandData.fullName) }, - { "arguments", arguments.str() }, - { "Deleter", ddit->second.pool.empty() ? "ObjectDestroy" : "PoolFree" }, - { "DeleterTemplate", ddit->second.pool.empty() ? commandData.className : commandData.className + "," + ddit->second.pool }, - { "deleterArg", ddit->second.pool.empty() ? "allocator" : "allocateInfo." + startLowerCase(ddit->second.pool) }, - { "class", commandData.className }, - { "function", commandData.reducedName } - }); - } - else - { - if (1 < commandData.vectorParams.size()) - { - writeFunctionBodyEnhancedMultiVectorSizeCheck(os, indentation, commandData); - } - - std::string returnName; - if (commandData.returnParam != ~0) - { - returnName = writeFunctionBodyEnhancedLocalReturnVariable(os, indentation, commandData, singular, isStructureChain); - } - - if (commandData.twoStep) - { - assert(!singular); - writeFunctionBodyEnhancedLocalCountVariable(os, indentation, commandData); - - // we now might have to check the result, resize the returned vector accordingly, and call the function again - std::map::const_iterator returnit = commandData.vectorParams.find(commandData.returnParam); - assert(returnit != commandData.vectorParams.end() && (returnit->second != ~0)); - std::string sizeName = startLowerCase(strip(commandData.params[returnit->second].name, "p")); - - if (commandData.returnType == "Result") - { - if (1 < commandData.successCodes.size()) - { - writeFunctionBodyEnhancedCallTwoStepIterate(os, indentation, returnName, sizeName, commandData); - } - else - { - writeFunctionBodyEnhancedCallTwoStepChecked(os, indentation, returnName, sizeName, commandData); - } - } - else - { - writeFunctionBodyEnhancedCallTwoStep(os, indentation, returnName, sizeName, commandData); - } - } - else - { - if (commandData.returnType == "Result") - { - writeFunctionBodyEnhancedCallResult(os, indentation, commandData, singular); - } - else - { - writeFunctionBodyEnhancedCall(os, indentation, commandData, singular); - } - } - - if ((commandData.returnType == "Result") || !commandData.successCodes.empty()) - { - writeFunctionBodyEnhancedReturnResultValue(os, indentation, returnName, commandData, singular, unique); - } - else if ((commandData.returnParam != ~0) && (commandData.returnType != commandData.enhancedReturnType)) - { - // for the other returning cases, when the return type is somhow enhanced, just return the local returnVariable - os << indentation << " return " << returnName << ";" << std::endl; - } - } -} - -void VulkanHppGenerator::writeFunctionBodyEnhanced(std::ostream &os, std::string const& templateString, std::string const& indentation, CommandData const& commandData, bool singular) -{ - os << replaceWithMap(templateString, { - { "call", generateCall(commandData, true, singular) }, - { "i", indentation } - }); -} - -void VulkanHppGenerator::writeFunctionBodyTwoStep(std::ostream & os, std::string const &templateString, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) -{ - std::map replacements = { - { "sizeName", sizeName }, - { "returnName", returnName }, - { "call1", generateCall(commandData, true, false) }, - { "call2", generateCall(commandData, false, false) }, - { "i", indentation } - }; - - os << replaceWithMap(templateString, replacements); -} - -std::string VulkanHppGenerator::writeFunctionBodyEnhancedLocalReturnVariable(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool singular, bool isStructureChain) -{ - std::string returnName = startLowerCase(strip(commandData.params[commandData.returnParam].name, "p")); - - // there is a returned parameter -> we need a local variable to hold that value - if (commandData.returnType != commandData.enhancedReturnType) - { - // the returned parameter is somehow enhanced by us - os << indentation << " "; - if (singular) - { - if (isStructureChain) - { - std::string const &pureType = commandData.params[commandData.returnParam].pureType; - // For StructureChains use the template parameters - os << "StructureChain structureChain;" << std::endl; - returnName = stripPluralS(returnName); - os << indentation << " " << pureType << "& " << returnName << " = structureChain.template get<" << pureType << ">()"; - returnName = "structureChain"; - } - else - { - // in singular case, just use the return parameters pure type for the return variable - returnName = stripPluralS(returnName); - os << commandData.params[commandData.returnParam].pureType << " " << returnName; - } - } - else - { - // in non-singular case, use the enhanced type for the return variable (like vector<...>) - if (isStructureChain) - { - std::string const &returnType = commandData.enhancedReturnType; - // For StructureChains use the template parameters - os << "StructureChain structureChain;" << std::endl; - os << indentation << " " << returnType << "& " << returnName << " = structureChain.template get<" << returnType << ">()"; - returnName = "structureChain"; - } - else - { - os << commandData.enhancedReturnType << " " << returnName; - } - - std::map::const_iterator it = commandData.vectorParams.find(commandData.returnParam); - if (it != commandData.vectorParams.end() && !commandData.twoStep) - { - // if the return parameter is a vector parameter, and not part of a two-step algorithm, initialize its size - std::string size; - if (it->second == ~0) - { - assert(!commandData.params[commandData.returnParam].len.empty()); - // the size of the vector is not given by an other parameter, but by some member of a parameter, described as 'parameter::member' - // -> replace the '::' by '.' and filter out the leading 'p' to access that value - size = startLowerCase(strip(commandData.params[commandData.returnParam].len, "p")); - size_t pos = size.find("::"); - assert(pos != std::string::npos); - size.replace(pos, 2, "."); - } - else - { - // the size of the vector is given by an other parameter - // first check, if that size has become the size of some other vector parameter - // -> look for it and get it's actual size - for (auto const& vectorParam : commandData.vectorParams) - { - if ((vectorParam.first != it->first) && (vectorParam.second == it->second)) - { - size = startLowerCase(strip(commandData.params[vectorParam.first].name, "p")) + ".size()"; - break; - } - } - if (size.empty()) - { - // otherwise, just use that parameter - size = commandData.params[it->second].name; - } - } - assert(!size.empty()); - os << "( " << size << " )"; - } - } - os << ";" << std::endl; - } - else - { - // the return parameter is not enhanced -> the type is supposed to be a Result and there are more than one success codes! - assert((commandData.returnType == "Result") && (1 < commandData.successCodes.size())); - os << indentation << " " << commandData.params[commandData.returnParam].pureType << " " << returnName << ";" << std::endl; - } - - return returnName; -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedCall(std::ostream &os, std::string const& indentation, CommandData const& commandData, bool singular) -{ - std::string const templateString = "${i} return ${call};\n"; - std::string const templateStringVoid = "${i} ${call};\n"; - writeFunctionBodyEnhanced(os, commandData.returnType == "void" ? templateStringVoid : templateString, indentation, commandData, singular); -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedCallResult(std::ostream &os, std::string const& indentation, CommandData const& commandData, bool singular) -{ - std::string const templateString = "${i} Result result = static_cast( ${call} );\n"; - writeFunctionBodyEnhanced(os, templateString, indentation, commandData, singular); -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedCallTwoStep(std::ostream & os, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) -{ - std::string const templateString = - R"(${i} ${call1}; -${i} ${returnName}.resize( ${sizeName} ); -${i} ${call2}; -)"; - writeFunctionBodyTwoStep(os, templateString, indentation, returnName, sizeName, commandData); -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedCallTwoStepIterate(std::ostream & os, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) -{ - std::string const templateString = - R"(${i} Result result; -${i} do -${i} { -${i} result = static_cast( ${call1} ); -${i} if ( ( result == Result::eSuccess ) && ${sizeName} ) -${i} { -${i} ${returnName}.resize( ${sizeName} ); -${i} result = static_cast( ${call2} ); -${i} } -${i} } while ( result == Result::eIncomplete ); -${i} VULKAN_HPP_ASSERT( ${sizeName} <= ${returnName}.size() ); -${i} ${returnName}.resize( ${sizeName} ); -)"; - writeFunctionBodyTwoStep(os, templateString, indentation, returnName, sizeName, commandData); -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedCallTwoStepChecked(std::ostream & os, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) -{ - std::string const templateString = - R"(${i} Result result = static_cast( ${call1} ); -${i} if ( ( result == Result::eSuccess ) && ${sizeName} ) -${i} { -${i} ${returnName}.resize( ${sizeName} ); -${i} result = static_cast( ${call2} ); -${i} } -)"; - writeFunctionBodyTwoStep(os, templateString, indentation, returnName, sizeName, commandData); -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedLocalCountVariable(std::ostream & os, std::string const& indentation, CommandData const& commandData) -{ - // local count variable to hold the size of the vector to fill - assert(commandData.returnParam != ~0); - - std::map::const_iterator returnit = commandData.vectorParams.find(commandData.returnParam); - assert(returnit != commandData.vectorParams.end() && (returnit->second != ~0)); - assert((commandData.returnType == "Result") || (commandData.returnType == "void")); - - // take the pure type of the size parameter; strip the leading 'p' from its name for its local name - os << indentation << " " << commandData.params[returnit->second].pureType << " " << startLowerCase(strip(commandData.params[returnit->second].name, "p")) << ";" << std::endl; -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedMultiVectorSizeCheck(std::ostream & os, std::string const& indentation, CommandData const& commandData) -{ - std::string const templateString = - R"#(#ifdef VULKAN_HPP_NO_EXCEPTIONS -${i} VULKAN_HPP_ASSERT( ${firstVectorName}.size() == ${secondVectorName}.size() ); -#else -${i} if ( ${firstVectorName}.size() != ${secondVectorName}.size() ) -${i} { -${i} throw LogicError( VULKAN_HPP_NAMESPACE_STRING "::${className}::${reducedName}: ${firstVectorName}.size() != ${secondVectorName}.size()" ); -${i} } -#endif // VULKAN_HPP_NO_EXCEPTIONS -)#"; - - - // add some error checks if multiple vectors need to have the same size - for (std::map::const_iterator it0 = commandData.vectorParams.begin(); it0 != commandData.vectorParams.end(); ++it0) - { - if (it0->first != commandData.returnParam) - { - for (std::map::const_iterator it1 = std::next(it0); it1 != commandData.vectorParams.end(); ++it1) - { - if ((it1->first != commandData.returnParam) && (it0->second == it1->second)) - { - os << replaceWithMap(templateString, std::map({ - { "firstVectorName", startLowerCase(strip(commandData.params[it0->first].name, "p")) }, - { "secondVectorName", startLowerCase(strip(commandData.params[it1->first].name, "p")) }, - { "className", commandData.className }, - { "reducedName", commandData.reducedName }, - { "i", indentation } - })); - } - } - } - } -} - -void VulkanHppGenerator::writeFunctionBodyEnhancedReturnResultValue(std::ostream & os, std::string const& indentation, std::string const& returnName, CommandData const& commandData, bool singular, bool unique) -{ - std::string type = (commandData.returnParam != ~0) ? commandData.params[commandData.returnParam].pureType : ""; - std::string returnVectorName = (commandData.returnParam != ~0) ? strip(commandData.params[commandData.returnParam].name, "p", "s") : ""; - - if (unique) - { - // the unique version needs a Deleter object for destruction of the newly created stuff - // get the DeleterData corresponding to the returned type - std::map::const_iterator ddit = m_deleters.find(type); - assert(ddit != m_deleters.end() && ddit->second.pool.empty()); - - // special handling for "createDevice", as Device is created from PhysicalDevice, but destroyed on its own - bool noParent = commandData.className.empty() || (commandData.fullName == "createDevice"); - os << std::endl - << indentation << ((commandData.fullName == "allocateMemory") ? " ObjectFree<" : " ObjectDestroy<") << (noParent ? "NoParent" : commandData.className) << ",Dispatch> deleter( " << (noParent ? "" : "*this, ") << "allocator, d );" << std::endl - << indentation << " return createResultValue<" << type << ",Dispatch>( result, "; - } - else - { - os << indentation << " return createResultValue( result, "; - } - - // if the return type is "Result" or there is at least one success code, create the Result/Value construct to return - if (commandData.returnParam != ~0) - { - // if there's a return parameter, list it in the Result/Value constructor - os << returnName << ", "; - } - - // now the function name (with full namespace) as a string - os << "VULKAN_HPP_NAMESPACE_STRING\"::" << (commandData.className.empty() ? "" : commandData.className + "::") << (singular ? stripPluralS(commandData.reducedName) : commandData.reducedName) << (unique ? "Unique" : "") << "\""; - - if (!commandData.twoStep && (1 < commandData.successCodes.size())) - { - // and for the single-step algorithms with more than one success code list them all - os << ", { Result::" << commandData.successCodes[0]; - for (size_t i = 1; i < commandData.successCodes.size(); i++) - { - os << ", Result::" << commandData.successCodes[i]; - } - os << " }"; - } - - if (unique) - { - os << ", deleter"; - } - - os << " );" << std::endl; -} - -void VulkanHppGenerator::writeFunctionBodyStandard(std::ostream & os, std::string const& indentation, CommandData const& commandData) -{ - os << indentation << " "; - bool castReturn = false; - if (commandData.returnType != "void") - { - // there's something to return... - os << "return "; - - castReturn = (m_vkTypes.find(commandData.returnType) != m_vkTypes.end()); - if (castReturn) - { - // the return-type is a vulkan type -> need to cast to vk::-type - os << "static_cast<" << commandData.returnType << ">( "; - } - } - - // call the original function - os << "d.vk" << startUpperCase(commandData.fullName) << "( "; - - if (!commandData.className.empty()) - { - // the command is part of a class -> the first argument is the member variable, starting with "m_" - assert(commandData.className == commandData.params[0].type); - os << "m_" << startLowerCase(commandData.className); - } - - // list all the arguments - for (size_t i = commandData.className.empty() ? 0 : 1; i < commandData.params.size(); i++) - { - if (0 < i) - { - os << ", "; - } - - if (m_vkTypes.find(commandData.params[i].pureType) != m_vkTypes.end()) - { - // the parameter is a vulkan type - if (commandData.params[i].type.back() == '*') - { - // it's a pointer -> need to reinterpret_cast it - writeReinterpretCast(os, commandData.params[i].type.find("const") == 0, true, commandData.params[i].pureType, commandData.params[i].type.find("* const") != std::string::npos); - } - else - { - // it's a value -> need to static_cast ist - os << "static_cast"; - } - os << "( " << commandData.params[i].name << " )"; - } - else - { - // it's a non-vulkan type -> just use it - os << commandData.params[i].name; - } - } - os << " )"; - - if (castReturn) - { - // if we cast the return -> close the static_cast - os << " )"; - } - os << ";" << std::endl; -} - -void VulkanHppGenerator::writeFunctionHeaderArguments(std::ostream & os, CommandData const& commandData, bool enhanced, bool singular, bool withDefaults) -{ - os << "("; - if (enhanced) - { - writeFunctionHeaderArgumentsEnhanced(os, commandData, singular, withDefaults); - } - else - { - writeFunctionHeaderArgumentsStandard(os, commandData, withDefaults); - } - os << ")"; - if (!commandData.className.empty()) - { - os << " const"; - } -} - -void VulkanHppGenerator::writeFunctionHeaderArgumentsEnhanced(std::ostream & os, CommandData const& commandData, bool singular, bool withDefaults) -{ - // check if there's at least one argument left to put in here - if (commandData.skippedParams.size() + (commandData.className.empty() ? 0 : 1) < commandData.params.size()) - { - // determine the last argument, where we might provide some default for - size_t lastArgument = size_t(~0); - for (size_t i = commandData.params.size() - 1; i < commandData.params.size(); i--) - { - if (commandData.skippedParams.find(i) == commandData.skippedParams.end()) - { - lastArgument = i; - break; - } - } - - os << " "; - bool argEncountered = false; - for (size_t i = commandData.className.empty() ? 0 : 1; i < commandData.params.size(); i++) - { - if (commandData.skippedParams.find(i) == commandData.skippedParams.end()) - { - if (argEncountered) - { - os << ", "; - } - std::string strippedParameterName = startLowerCase(strip(commandData.params[i].name, "p")); - - std::map::const_iterator it = commandData.vectorParams.find(i); - size_t rightStarPos = commandData.params[i].type.rfind('*'); - if (it == commandData.vectorParams.end()) - { - // the argument ist not a vector - if (rightStarPos == std::string::npos) - { - // and its not a pointer -> just use its type and name here - os << commandData.params[i].type << " " << commandData.params[i].name; - if (!commandData.params[i].arraySize.empty()) - { - os << "[" << commandData.params[i].arraySize << "]"; - } - - if (withDefaults && (lastArgument == i)) - { - // check if the very last argument is a flag without any bits -> provide some empty default for it - std::map::const_iterator bitmasksIt = m_bitmasks.find(commandData.params[i].pureType); - if (bitmasksIt != m_bitmasks.end()) - { - // get the enum corresponding to this flag, to check if it's empty - std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&bitmasksIt](DependencyData const& dd) { return(dd.name == bitmasksIt->first); }); - assert((depIt != m_dependencies.end()) && (depIt->dependencies.size() == 1)); - std::map::const_iterator enumIt = m_enums.find(*depIt->dependencies.begin()); - assert(enumIt != m_enums.end()); - if (enumIt->second.values.empty()) - { - // there are no bits in this flag -> provide the default - os << " = " << commandData.params[i].pureType << "()"; - } - } - } - } - else - { - // the argument is not a vector, but a pointer - assert(commandData.params[i].type[rightStarPos] == '*'); - if (commandData.params[i].optional) - { - // for an optional argument, trim the trailing '*' from the type, and the leading 'p' from the name - os << "Optional<" << trimEnd(commandData.params[i].type.substr(0, rightStarPos)) << "> " << strippedParameterName; - if (withDefaults) - { - os << " = nullptr"; - } - } - else if (commandData.params[i].pureType == "void") - { - // for void-pointer, just use type and name - os << commandData.params[i].type << " " << commandData.params[i].name; - } - else if (commandData.params[i].pureType != "char") - { - // for non-char-pointer, change to reference - os << trimEnd(commandData.params[i].type.substr(0, rightStarPos)) << " & " << strippedParameterName; - } - else - { - // for char-pointer, change to const reference to std::string - os << "const std::string & " << strippedParameterName; - } - } - } - else - { - // the argument is a vector - // it's optional, if it's marked as optional and there's no size specified - bool optional = commandData.params[i].optional && (it->second == ~0); - assert((rightStarPos != std::string::npos) && (commandData.params[i].type[rightStarPos] == '*')); - if (commandData.params[i].type.find("char") != std::string::npos) - { - // it's a char-vector -> use a std::string (either optional or a const-reference - if (optional) - { - os << "Optional " << strippedParameterName; - if (withDefaults) - { - os << " = nullptr"; - } - } - else - { - os << "const std::string & " << strippedParameterName; - } - } - else - { - // it's a non-char vector (they are never optional) - assert(!optional); - if (singular) - { - // in singular case, change from pointer to reference - os << trimEnd(commandData.params[i].type.substr(0, rightStarPos)) << " & " << stripPluralS(strippedParameterName); - } - else - { - // otherwise, use our ArrayProxy - bool isConst = (commandData.params[i].type.find("const") != std::string::npos); - os << "ArrayProxy<" << ((commandData.templateParam == i) ? (isConst ? "const T" : "T") : trimEnd(commandData.params[i].type.substr(0, rightStarPos))) << "> " << strippedParameterName; - } - } - } - argEncountered = true; - } - } - - if (argEncountered) - { - os << ", "; - } - } - os << "Dispatch const &d"; - if (withDefaults) - { - os << " = Dispatch()"; - } - - os << " "; -} - -void VulkanHppGenerator::writeFunctionHeaderArgumentsStandard(std::ostream & os, CommandData const& commandData, bool withDefaults) -{ - // for the standard case, just list all the arguments as we've got them - bool argEncountered = false; - - // determine the last argument, where we might provide some default for - size_t lastArgument = commandData.params.size() - 1; - - for (size_t i = commandData.className.empty() ? 0 : 1; i < commandData.params.size(); i++) - { - if (argEncountered) - { - os << ","; - } - - os << " " << commandData.params[i].type << " " << commandData.params[i].name; - if (!commandData.params[i].arraySize.empty()) - { - os << "[" << commandData.params[i].arraySize << "]"; - } - - if (withDefaults && (lastArgument == i)) - { - // check if the very last argument is a flag without any bits -> provide some empty default for it - std::map::const_iterator flagIt = m_bitmasks.find(commandData.params[i].pureType); - if (flagIt != m_bitmasks.end()) - { - // get the enum corresponding to this flag, to check if it's empty - std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&flagIt](DependencyData const& dd) { return(dd.name == flagIt->first); }); - assert((depIt != m_dependencies.end()) && (depIt->dependencies.size() == 1)); - std::map::const_iterator enumIt = m_enums.find(*depIt->dependencies.begin()); - assert(enumIt != m_enums.end()); - if (enumIt->second.values.empty()) - { - // there are no bits in this flag -> provide the default - os << " = " << commandData.params[i].pureType << "()"; - } - } - } - argEncountered = true; - } - if (argEncountered) - { - os << ", "; - } - - os << "Dispatch const &d"; - if (withDefaults) - { - os << " = Dispatch() "; - } -} - -void VulkanHppGenerator::writeFunctionHeaderReturnType(std::ostream & os, CommandData const& commandData, bool enhanced, bool singular, bool unique, bool isStructureChain) -{ - std::string templateString; - std::string returnType; - if (enhanced) - { - // the enhanced function might return some pretty complex return stuff - if (isStructureChain || (!singular && (commandData.enhancedReturnType.find("Allocator") != std::string::npos))) - { - // for the non-singular case with allocation, we need to prepend with 'typename' to keep compilers happy - templateString = "typename "; - } - if (unique) - { - // the unique version returns something prefixed with 'Unique'; potentially a vector of that stuff - // it's a vector, if it's not the singular version and the return parameter is a vector parameter - bool returnsVector = !singular && (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end()); - - templateString += returnsVector ? "ResultValueType,Allocator>>::type " : "typename ResultValueType>::type "; - returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; - } - else if ((commandData.enhancedReturnType != commandData.returnType) && (commandData.returnType != "void")) - { - // if the enhanced return type differs from the original return type, and it's not void, we return a ResultValueType<...>::type - templateString += "ResultValueType<${returnType}>::type "; - - assert(commandData.returnType == "Result"); - // in singular case, we create the ResultValueType from the pure return type, otherwise from the enhanced return type - if (isStructureChain) - { - returnType = "StructureChain"; - } - else - { - returnType = singular ? commandData.params[commandData.returnParam].pureType : commandData.enhancedReturnType; - } - } - else if ((commandData.returnParam != ~0) && (1 < commandData.successCodes.size())) - { - // if there is a return parameter at all, and there are multiple success codes, we return a ResultValue<...> with the pure return type - assert(commandData.returnType == "Result"); - templateString = "ResultValue<${returnType}> "; - returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; - } - else - { - // and in every other case, we just return the enhanced return type. - templateString = "${returnType} "; - returnType = isStructureChain ? "StructureChain" : commandData.enhancedReturnType; - } - } - else - { - // the non-enhanced function just uses the return type - templateString = "${returnType} "; - returnType = commandData.returnType; - } - os << replaceWithMap(templateString, { { "returnType", returnType } }); -} - -void VulkanHppGenerator::writeFunctionHeaderTemplate(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool enhanced, bool unique, bool withDefault, bool isStructureChain) -{ - std::string dispatch = withDefault ? std::string("typename Dispatch = DispatchLoaderStatic") : std::string("typename Dispatch"); - if (enhanced && isStructureChain) - { - os << indentation << "template " << std::endl; - } - else if (enhanced && (commandData.templateParam != ~0) && ((commandData.templateParam != commandData.returnParam) || (commandData.enhancedReturnType == "Result"))) - { - // if there's a template parameter, not being the return parameter or where the enhanced return type is 'Result' -> templatize on type 'T' - assert(commandData.enhancedReturnType.find("Allocator") == std::string::npos); - os << indentation << "template " << std::endl; - } - else if (enhanced && (commandData.enhancedReturnType.find("Allocator") != std::string::npos)) - { - // otherwise, if there's an Allocator used in the enhanced return type, we templatize on that Allocator - assert((commandData.enhancedReturnType.substr(0, 12) == "std::vector<") && (commandData.enhancedReturnType.find(',') != std::string::npos) && (12 < commandData.enhancedReturnType.find(','))); - os << indentation << "template ' - os << " = std::allocator<" << (unique ? "Unique" : "") << commandData.enhancedReturnType.substr(12, commandData.enhancedReturnType.find(',') - 12) << ">"; - } - os << ", " << dispatch; - os << "> " << std::endl; - } - else - { - os << indentation << "template<" << dispatch << ">" << std::endl; - } -} - -void VulkanHppGenerator::writeResultEnum(std::ostream & os) -{ - std::list::const_iterator it = std::find_if(m_dependencies.begin(), m_dependencies.end(), [](DependencyData const& dp) { return dp.name == "Result"; }); - assert(it != m_dependencies.end()); - writeTypeEnum(os, m_enums.find(it->name)->second); - writeEnumsToString(os, m_enums.find(it->name)->second); - os << "#ifndef VULKAN_HPP_NO_EXCEPTIONS"; - os << exceptionHeader; - os << exceptionClassesHeader; - writeExceptionsForEnum(os, m_enums.find(it->name)->second); - writeThrowExceptions(os, m_enums.find(it->name)->second); - os << "#endif" << std::endl; - m_dependencies.erase(it); -} - -void VulkanHppGenerator::writeStructConstructor(std::ostream & os, std::string const& name, StructData const& structData, std::map const& defaultValues) -{ - // the constructor with all the elements as arguments, with defaults - std::string ctorOpening = " " + name + "( "; - size_t indentSize = ctorOpening.size(); - os << ctorOpening; - - bool listedArgument = false; - for (size_t i = 0; i < structData.members.size(); i++) - { - listedArgument = writeStructConstructorArgument(os, listedArgument, indentSize, structData.members[i], defaultValues); - } - os << " )" << std::endl; - - // copy over the simple arguments - bool firstArgument = true; - for (size_t i = 0; i < structData.members.size(); i++) - { - // skip members 'pNext' and 'sType' are directly set by initializers - if ((structData.members[i].name != "pNext") && (structData.members[i].name != "sType") && (structData.members[i].arraySize.empty())) - { - // here, we can only handle non-array arguments - std::string templateString = " ${sep} ${member}( ${value} )\n"; - std::string sep = firstArgument ? ":" : ","; - std::string member = structData.members[i].name; - std::string value = structData.members[i].name + "_"; // the elements are initialized by the corresponding argument (with trailing '_', as mentioned above) - - os << replaceWithMap(templateString, { { "sep", sep },{ "member", member },{ "value", value } }); - firstArgument = false; - } - } - - // the body of the constructor, copying over data from argument list into wrapped struct - os << " {" << std::endl; - for (size_t i = 0; i < structData.members.size(); i++) - { - if (!structData.members[i].arraySize.empty()) - { - // here we can handle the arrays, copying over from argument (with trailing '_') to member - // size is arraySize times sizeof type - std::string member = structData.members[i].name; - std::string arraySize = structData.members[i].arraySize; - std::string type = structData.members[i].type; - os << replaceWithMap(" memcpy( &${member}, ${member}_.data(), ${arraySize} * sizeof( ${type} ) );\n", - { { "member", member },{ "arraySize", arraySize },{ "type", type } }); - } - } - os << " }\n\n"; - - if (!structData.subStruct.empty()) - { - auto const& subStruct = m_structs.find(structData.subStruct); - assert(subStruct != m_structs.end()); - - std::string subStructArgumentName = startLowerCase(strip(subStruct->first, "vk")); - ctorOpening = " explicit " + name + "( "; - indentSize = ctorOpening.size(); - - os << ctorOpening << subStruct->first << " const& " << subStructArgumentName; - - for (size_t i = subStruct->second.members.size(); i < structData.members.size(); i++) - { - writeStructConstructorArgument(os, true, indentSize, structData.members[i], defaultValues); - } - os << " )" << std::endl; - - firstArgument = true; - std::string templateString = " ${sep} ${member}( ${value} )\n"; - for (size_t i = 0; i < subStruct->second.members.size(); i++) - { - assert(structData.members[i].arraySize.empty()); - std::string sep = firstArgument ? ":" : ","; - std::string member = structData.members[i].name; - std::string value = subStructArgumentName + "." + subStruct->second.members[i].name; - - os << replaceWithMap(templateString, { { "sep", sep },{ "member", member },{ "value", value } }); - firstArgument = false; - } - for (size_t i = subStruct->second.members.size(); i < structData.members.size(); i++) - { - assert(structData.members[i].arraySize.empty()); - std::string member = structData.members[i].name; - std::string value = structData.members[i].name + "_"; // the elements are initialized by the corresponding argument (with trailing '_', as mentioned above) - - os << replaceWithMap(templateString, { { "sep", "," },{ "member", member },{ "value", value } }); - } - os << " {}" << std::endl << std::endl; - } - - std::string templateString = - R"( ${name}( Vk${name} const & rhs ) - { - memcpy( this, &rhs, sizeof( ${name} ) ); - } - - ${name}& operator=( Vk${name} const & rhs ) - { - memcpy( this, &rhs, sizeof( ${name} ) ); - return *this; - } -)"; - - os << replaceWithMap(templateString, { { "name", name } }); -} - -void VulkanHppGenerator::writeIndentation(std::ostream & os, size_t indentLength) -{ - for(size_t i = 0; i < indentLength; i++) - { - os << " "; - } -} - -bool VulkanHppGenerator::writeStructConstructorArgument(std::ostream & os, bool listedArgument, size_t indentLength, MemberData const& memberData, std::map const& defaultValues) -{ - if (listedArgument) - { - os << ",\n"; - writeIndentation(os, indentLength); - } - - // skip members 'pNext' and 'sType', as they are never explicitly set - if ((memberData.name != "pNext") && (memberData.name != "sType")) - { - // find a default value for the given pure type - std::map::const_iterator defaultIt = defaultValues.find(memberData.pureType); - assert(defaultIt != defaultValues.end()); - - if (memberData.arraySize.empty()) - { - // the arguments name get a trailing '_', to distinguish them from the actual struct members - // pointer arguments get a nullptr as default - os << memberData.type << " " << memberData.name << "_ = " << (memberData.type.back() == '*' ? "nullptr" : defaultIt->second); - } - else - { - // array members are provided as const reference to a std::array - // the arguments name get a trailing '_', to distinguish them from the actual struct members - // list as many default values as there are elements in the array - os << "std::array<" << memberData.type << "," << memberData.arraySize << "> const& " << memberData.name << "_ = { { " << defaultIt->second; - size_t n = atoi(memberData.arraySize.c_str()); - assert(0 < n); - for (size_t j = 1; j < n; j++) - { - os << ", " << defaultIt->second; - } - os << " } }"; - } - listedArgument = true; - } - return listedArgument; -} - -void VulkanHppGenerator::writeStructSetter(std::ostream & os, std::string const& structureName, MemberData const& memberData) -{ - if (memberData.type != "StructureType") // filter out StructureType, which is supposed to be immutable ! - { - // the setters return a reference to the structure - os << " " << structureName << "& set" << startUpperCase(memberData.name) << "( "; - if (memberData.arraySize.empty()) - { - os << memberData.type << " "; - } - else - { - os << "std::array<" << memberData.type << "," << memberData.arraySize << "> "; - } - // add a trailing '_' to the argument to distinguish it from the structure member - os << memberData.name << "_ )" << std::endl - << " {" << std::endl; - // copy over the argument, either by assigning simple data, or by memcpy array data - if (memberData.arraySize.empty()) - { - os << " " << memberData.name << " = " << memberData.name << "_"; - } - else - { - os << " memcpy( &" << memberData.name << ", " << memberData.name << "_.data(), " << memberData.arraySize << " * sizeof( " << memberData.type << " ) )"; - } - os << ";" << std::endl - << " return *this;" << std::endl - << " }" << std::endl - << std::endl; - } -} - -void VulkanHppGenerator::writeStructureChainValidation(std::ostream & os) -{ - // write all template functions for the structure pointer chain validation - for (auto it = m_dependencies.begin(); it != m_dependencies.end(); ++it) - { - switch (it->category) - { - case DependencyData::Category::STRUCT: - writeStructureChainValidation(os, *it); - break; - } - } -} - -void VulkanHppGenerator::writeStructureChainValidation(std::ostream & os, DependencyData const& dependencyData) -{ - std::map::const_iterator it = m_structs.find(dependencyData.name); - assert(it != m_structs.end()); - - if (!it->second.structExtends.empty()) - { - enterProtect(os, it->second.protect); - - // write out allowed structure chains - for (auto extendName : it->second.structExtends) - { - std::map::const_iterator itExtend = m_structs.find(extendName); - if (itExtend == m_structs.end()) { - std::stringstream errorString; - errorString << extendName << " does not specify a struct in structextends field."; - - // check if symbol name is an alias to a struct - auto itAlias = std::find_if(m_structs.begin(), m_structs.end(), [&extendName](std::pair const &it) -> bool {return it.second.alias == extendName;}); - if (itAlias != m_structs.end()) - { - errorString << " The symbol is an alias and maps to " << itAlias->first << "."; - } - - errorString << std::endl; - throw std::runtime_error(errorString.str()); - } - enterProtect(os, itExtend->second.protect); - - os << " template <> struct isStructureChainValid<" << extendName << ", " << dependencyData.name << ">{ enum { value = true }; };" << std::endl; - - leaveProtect(os, itExtend->second.protect); - } - leaveProtect(os, it->second.protect); - } -} - -void VulkanHppGenerator::writeThrowExceptions(std::ostream & os, EnumData const& enumData) -{ - enterProtect(os, enumData.protect); - os << - R"( VULKAN_HPP_INLINE void throwResultException( Result result, char const * message ) - { - switch ( result ) - { -)"; - for (size_t i = 0; icategory) - { - case DependencyData::Category::BITMASK: - writeBitmaskToString(os, it->name, m_enums.find(*it->dependencies.begin())->second); - break; - case DependencyData::Category::ENUM: - assert(m_enums.find(it->name) != m_enums.end()); - writeEnumsToString(os, m_enums.find(it->name)->second); - break; - } - } -} - -void VulkanHppGenerator::writeTypeBitmask(std::ostream & os, std::string const& bitmaskName, BitmaskData const& bitmaskData, EnumData const& enumData) -{ - enterProtect(os, bitmaskData.protect); - - // each Flags class is using on the class 'Flags' with the corresponding FlagBits enum as the template parameter - os << " using " << bitmaskName << " = Flags<" << enumData.name << ", Vk" << bitmaskName << ">;" << std::endl; - - std::stringstream allFlags; - for (size_t i = 0; i < enumData.values.size(); i++) - { - if (i != 0) - { - allFlags << " | "; - } - allFlags << "VkFlags(" << enumData.name << "::" << enumData.values[i].name << ")"; - } - - if (!enumData.values.empty()) - { - const std::string templateString = R"( - VULKAN_HPP_INLINE ${bitmaskName} operator|( ${enumName} bit0, ${enumName} bit1 ) - { - return ${bitmaskName}( bit0 ) | bit1; - } - - VULKAN_HPP_INLINE ${bitmaskName} operator~( ${enumName} bits ) - { - return ~( ${bitmaskName}( bits ) ); - } - - template <> struct FlagTraits<${enumName}> - { - enum - { - allFlags = ${allFlags} - }; - }; -)"; - os << replaceWithMap(templateString, { { "bitmaskName", bitmaskName },{ "enumName", enumData.name },{ "allFlags", allFlags.str() } }); - } - - if (!bitmaskData.alias.empty()) - { - os << std::endl - << " using " << bitmaskData.alias << " = " << bitmaskName << ";" << std::endl; - } - - leaveProtect(os, bitmaskData.protect); - os << std::endl; -} - -void VulkanHppGenerator::writeTypeCommand(std::ostream & os, DependencyData const& dependencyData) -{ - assert(m_commands.find(dependencyData.name) != m_commands.end()); - CommandData const& commandData = m_commands.find(dependencyData.name)->second; - if (commandData.className.empty()) - { - if (commandData.fullName == "createInstance") - { - // special handling for createInstance, as we need to explicitly place the forward declarations and the deleter classes here -#if !defined(NDEBUG) - auto deleterTypesIt = m_deleterTypes.find(""); - assert((deleterTypesIt != m_deleterTypes.end()) && (deleterTypesIt->second.size() == 2)); - assert(deleterTypesIt->second.find("Instance") != deleterTypesIt->second.end()); -#endif - - writeUniqueTypes(os, std::make_pair>("", { "Instance" })); - writeTypeCommand(os, " ", commandData, false); - } - else - { - writeTypeCommand(os, " ", commandData, false); - } - writeTypeCommand(os, " ", commandData, true); - os << std::endl; - } -} - -void VulkanHppGenerator::writeTypeCommand(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool definition) -{ - enterProtect(os, commandData.protect); - - bool isStructureChain = m_extendedStructs.find(commandData.enhancedReturnType) != m_extendedStructs.end(); - - // first create the standard version of the function - std::ostringstream standard; - writeFunction(standard, indentation, commandData, definition, false, false, false, false); - - // then the enhanced version, composed by up to five parts - std::ostringstream enhanced; - writeFunction(enhanced, indentation, commandData, definition, true, false, false, false); - - if (isStructureChain) - { - writeFunction(enhanced, indentation, commandData, definition, true, false, false, true); - } - - // then a singular version, if a sized vector would be returned - std::map::const_iterator returnVector = commandData.vectorParams.find(commandData.returnParam); - bool singular = (returnVector != commandData.vectorParams.end()) && - (returnVector->second != ~0) && - (commandData.params[returnVector->first].pureType != "void") && - (commandData.params[returnVector->second].type.back() != '*'); - if (singular) - { - writeFunction(enhanced, indentation, commandData, definition, true, true, false, false); - } - - // special handling for createDevice and createInstance ! - bool specialWriteUnique = (commandData.reducedName == "createDevice") || (commandData.reducedName == "createInstance"); - - // and then the same for the Unique* versions (a Deleter is available for the commandData's class, and the function starts with 'allocate' or 'create') - if (((m_deleters.find(commandData.className) != m_deleters.end()) || specialWriteUnique) && ((commandData.reducedName.substr(0, 8) == "allocate") || (commandData.reducedName.substr(0, 6) == "create"))) - { - enhanced << "#ifndef VULKAN_HPP_NO_SMART_HANDLE" << std::endl; - writeFunction(enhanced, indentation, commandData, definition, true, false, true, false); - - if (singular) - { - writeFunction(enhanced, indentation, commandData, definition, true, true, true, false); - } - enhanced << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl; - } - - // and write one or both of them - writeStandardOrEnhanced(os, standard.str(), enhanced.str()); - - leaveProtect(os, commandData.protect); - os << std::endl; -} - -void VulkanHppGenerator::writeTypeEnum(std::ostream & os, EnumData const& enumData) -{ - // a named enum per enum, listing all its values by setting them to the original Vulkan names - enterProtect(os, enumData.protect); - os << " enum class " << enumData.name << std::endl - << " {" << std::endl; - for (size_t i = 0; i list them first - if (!dependencyData.forwardDependencies.empty()) - { - os << " // forward declarations" << std::endl; - for (std::set::const_iterator it = dependencyData.forwardDependencies.begin(); it != dependencyData.forwardDependencies.end(); ++it) - { - assert(m_structs.find(*it) != m_structs.end()); - os << " struct " << *it << ";" << std::endl; - } - os << std::endl; - } - - // then write any forward declaration of Deleters used by this handle - std::map>::const_iterator deleterTypesIt = m_deleterTypes.find(dependencyData.name); - if (deleterTypesIt != m_deleterTypes.end()) - { - writeUniqueTypes(os, *deleterTypesIt); - } - else if (dependencyData.name == "PhysicalDevice") - { - // special handling for class Device, as it's created from PhysicalDevice, but destroys itself - writeUniqueTypes(os, std::make_pair>("", { "Device" })); - } - - const std::string memberName = startLowerCase(dependencyData.name); - const std::string templateString = - R"( class ${className} - { - public: - VULKAN_HPP_CONSTEXPR ${className}() - : m_${memberName}(VK_NULL_HANDLE) - {} - - VULKAN_HPP_CONSTEXPR ${className}( std::nullptr_t ) - : m_${memberName}(VK_NULL_HANDLE) - {} - - VULKAN_HPP_TYPESAFE_EXPLICIT ${className}( Vk${className} ${memberName} ) - : m_${memberName}( ${memberName} ) - {} - -#if defined(VULKAN_HPP_TYPESAFE_CONVERSION) - ${className} & operator=(Vk${className} ${memberName}) - { - m_${memberName} = ${memberName}; - return *this; - } -#endif - - ${className} & operator=( std::nullptr_t ) - { - m_${memberName} = VK_NULL_HANDLE; - return *this; - } - - bool operator==( ${className} const & rhs ) const - { - return m_${memberName} == rhs.m_${memberName}; - } - - bool operator!=(${className} const & rhs ) const - { - return m_${memberName} != rhs.m_${memberName}; - } - - bool operator<(${className} const & rhs ) const - { - return m_${memberName} < rhs.m_${memberName}; - } - -${commands} - - VULKAN_HPP_TYPESAFE_EXPLICIT operator Vk${className}() const - { - return m_${memberName}; - } - - explicit operator bool() const - { - return m_${memberName} != VK_NULL_HANDLE; - } - - bool operator!() const - { - return m_${memberName} == VK_NULL_HANDLE; - } - - private: - Vk${className} m_${memberName}; - }; - - static_assert( sizeof( ${className} ) == sizeof( Vk${className} ), "handle and wrapper have different size!" ); - -)"; - - std::ostringstream commands; - // now list all the commands that are mapped to members of this class - for (size_t i = 0; i < handleData.commands.size(); i++) - { - std::map::const_iterator cit = m_commands.find(handleData.commands[i]); - assert((cit != m_commands.end()) && !cit->second.className.empty()); - writeTypeCommand(commands, " ", cit->second, false); - - // special handling for destroy functions which are not aliased. - if (!cit->second.isAlias && (((cit->second.fullName.substr(0, 7) == "destroy") && (cit->second.reducedName != "destroy")) || (cit->second.fullName.substr(0, 4) == "free"))) - { - CommandData shortenedCommand = cit->second; - shortenedCommand.reducedName = (cit->second.fullName.substr(0, 7) == "destroy") ? "destroy" : "free"; - writeTypeCommand(commands, " ", shortenedCommand, false); - } - } - - os << replaceWithMap(templateString, { - { "className", dependencyData.name }, - { "memberName", memberName }, - { "commands", commands.str() } - }); - - // and finally the commands, that are member functions of this handle - for (size_t i = 0; i < handleData.commands.size(); i++) - { - std::string commandName = handleData.commands[i]; - std::map::const_iterator cit = m_commands.find(commandName); - assert((cit != m_commands.end()) && !cit->second.className.empty()); - std::list::const_iterator dep = std::find_if(m_dependencies.begin(), m_dependencies.end(), [commandName](DependencyData const& dd) { return dd.name == commandName; }); - assert(dep != m_dependencies.end() && (dep->name == cit->second.fullName)); - writeTypeCommand(os, " ", cit->second, true); - - // special handling for destroy functions - if (!cit->second.isAlias && (((cit->second.fullName.substr(0, 7) == "destroy") && (cit->second.reducedName != "destroy")) || (cit->second.fullName.substr(0, 4) == "free"))) - { - CommandData shortenedCommand = cit->second; - shortenedCommand.reducedName = (cit->second.fullName.substr(0, 7) == "destroy") ? "destroy" : "free"; - writeTypeCommand(os, " ", shortenedCommand, true); - } - } - - if (!handleData.alias.empty()) - { - os << " using " << handleData.alias << " = " << dependencyData.name << ";" << std::endl - << std::endl; - } - - leaveProtect(os, handleData.protect); -} - -void VulkanHppGenerator::writeTypes(std::ostream & os, std::map const& defaultValues) -{ - assert(m_deleterTypes.find("") != m_deleterTypes.end()); - - for (std::list::const_iterator it = m_dependencies.begin(); it != m_dependencies.end(); ++it) - { - switch (it->category) - { - case DependencyData::Category::BITMASK: - assert(m_bitmasks.find(it->name) != m_bitmasks.end()); - writeTypeBitmask(os, it->name, m_bitmasks.find(it->name)->second, m_enums.find(generateEnumNameForFlags(it->name))->second); - break; - case DependencyData::Category::COMMAND: - writeTypeCommand(os, *it); - break; - case DependencyData::Category::ENUM: - assert(m_enums.find(it->name) != m_enums.end()); - writeTypeEnum(os, m_enums.find(it->name)->second); - break; - case DependencyData::Category::FUNC_POINTER: - case DependencyData::Category::REQUIRED: - // skip FUNC_POINTER and REQUIRED, they just needed to be in the dependencies list to resolve dependencies - break; - case DependencyData::Category::HANDLE: - assert(m_handles.find(it->name) != m_handles.end()); - writeTypeHandle(os, *it, m_handles.find(it->name)->second); - break; - case DependencyData::Category::SCALAR: - writeTypeScalar(os, *it); - break; - case DependencyData::Category::STRUCT: - writeTypeStruct(os, *it, defaultValues); - break; - case DependencyData::Category::UNION: - assert(m_structs.find(it->name) != m_structs.end()); - writeTypeUnion(os, *it, defaultValues); - break; - default: - assert(false); - break; - } - } -} - -void VulkanHppGenerator::writeTypeScalar(std::ostream & os, DependencyData const& dependencyData) -{ - assert(dependencyData.dependencies.size() == 1); - os << " using " << dependencyData.name << " = " << *dependencyData.dependencies.begin() << ";" << std::endl - << std::endl; -} - -void VulkanHppGenerator::writeTypeStruct(std::ostream & os, DependencyData const& dependencyData, std::map const& defaultValues) -{ - std::map::const_iterator it = m_structs.find(dependencyData.name); - assert(it != m_structs.end()); - - enterProtect(os, it->second.protect); - os << " struct " << dependencyData.name << std::endl - << " {" << std::endl; - - // only structs that are not returnedOnly get a constructor! - if (!it->second.returnedOnly) - { - writeStructConstructor(os, dependencyData.name, it->second, defaultValues); - } - - // create the setters - if (!it->second.returnedOnly) - { - for (size_t i = 0; i < it->second.members.size(); i++) - { - writeStructSetter(os, dependencyData.name, it->second.members[i]); - } - } - - // the implicit cast-operators to the native type - os << " operator Vk" << dependencyData.name << " const&() const" << std::endl - << " {" << std::endl - << " return *reinterpret_cast(this);" << std::endl - << " }" << std::endl - << std::endl - << " operator Vk" << dependencyData.name << " &()" << std::endl - << " {" << std::endl - << " return *reinterpret_cast(this);" << std::endl - << " }" << std::endl - << std::endl; - - // operator==() and operator!=() - // only structs without a union as a member can have a meaningfull == and != operation; we filter them out - if (!containsUnion(dependencyData.name, m_structs)) - { - // two structs are compared by comparing each of the elements - os << " bool operator==( " << dependencyData.name << " const& rhs ) const" << std::endl - << " {" << std::endl - << " return "; - for (size_t i = 0; i < it->second.members.size(); i++) - { - if (i != 0) - { - os << std::endl << " && "; - } - if (!it->second.members[i].arraySize.empty()) - { - os << "( memcmp( " << it->second.members[i].name << ", rhs." << it->second.members[i].name << ", " << it->second.members[i].arraySize << " * sizeof( " << it->second.members[i].type << " ) ) == 0 )"; - } - else - { - os << "( " << it->second.members[i].name << " == rhs." << it->second.members[i].name << " )"; - } - } - os << ";" << std::endl - << " }" << std::endl - << std::endl - << " bool operator!=( " << dependencyData.name << " const& rhs ) const" << std::endl - << " {" << std::endl - << " return !operator==( rhs );" << std::endl - << " }" << std::endl - << std::endl; - } - - // the member variables - for (size_t i = 0; i < it->second.members.size(); i++) - { - if (it->second.members[i].type == "StructureType") - { - assert((i == 0) && (it->second.members[i].name == "sType")); - if (!it->second.members[i].values.empty()) - { - assert(!it->second.members[i].values.empty()); - auto nameIt = m_nameMap.find(it->second.members[i].values); - assert(nameIt != m_nameMap.end()); - os << " private:" << std::endl - << " StructureType sType = " << nameIt->second << ";" << std::endl - << std::endl - << " public:" << std::endl; - } - else - { - os << " StructureType sType;" << std::endl; - } - } - else - { - os << " " << it->second.members[i].type << " " << it->second.members[i].name; - if (it->second.members[i].name == "pNext") - { - os << " = nullptr"; - } - else if (!it->second.members[i].arraySize.empty()) - { - os << "[" << it->second.members[i].arraySize << "]"; - } - os << ";" << std::endl; - } - } - os << " };" << std::endl - << " static_assert( sizeof( " << dependencyData.name << " ) == sizeof( Vk" << dependencyData.name << " ), \"struct and wrapper have different size!\" );" << std::endl; - - if (!it->second.alias.empty()) - { - os << std::endl - << " using " << it->second.alias << " = " << dependencyData.name << ";" << std::endl; - } - - leaveProtect(os, it->second.protect); - os << std::endl; -} - -void VulkanHppGenerator::writeUniqueTypes(std::ostream &os, std::pair> const& deleterTypes) -{ - os << "#ifndef VULKAN_HPP_NO_SMART_HANDLE" << std::endl; - if (!deleterTypes.first.empty()) - { - os << " class " << deleterTypes.first << ";" << std::endl; - } - os << std::endl; - - for (auto const& dt : deleterTypes.second) - { - auto ddit = m_deleters.find(dt); - assert(ddit != m_deleters.end()); - - os << " template class UniqueHandleTraits<" << dt << ",Dispatch> {public: using deleter = " << (ddit->second.pool.empty() ? "Object" : "Pool") << ((ddit->second.call.substr(0, 4) == "free") ? "Free<" : "Destroy<") << (deleterTypes.first.empty() ? "NoParent" : deleterTypes.first) << (ddit->second.pool.empty() ? "" : ", " + ddit->second.pool) << ",Dispatch>; };\n"; - os << " using Unique" << dt << " = UniqueHandle<" << dt << ",DispatchLoaderStatic>;" << std::endl; - } - os << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl - << std::endl; -} - -void VulkanHppGenerator::writeTypeUnion(std::ostream & os, DependencyData const& dependencyData, std::map const& defaultValues) -{ - std::map::const_iterator it = m_structs.find(dependencyData.name); - assert(it != m_structs.end()); - - std::ostringstream oss; - os << " union " << dependencyData.name << std::endl - << " {" << std::endl; - - for (size_t i = 0; isecond.members.size(); i++) - { - // one constructor per union element - os << " " << dependencyData.name << "( "; - if (it->second.members[i].arraySize.empty()) - { - os << it->second.members[i].type << " "; - } - else - { - os << "const std::array<" << it->second.members[i].type << "," << it->second.members[i].arraySize << ">& "; - } - os << it->second.members[i].name << "_"; - - // just the very first constructor gets default arguments - if (i == 0) - { - std::map::const_iterator defaultIt = defaultValues.find(it->second.members[i].pureType); - assert(defaultIt != defaultValues.end()); - if (it->second.members[i].arraySize.empty()) - { - os << " = " << defaultIt->second; - } - else - { - os << " = { {" << defaultIt->second << "} }"; - } - } - os << " )" << std::endl - << " {" << std::endl - << " "; - if (it->second.members[i].arraySize.empty()) - { - os << it->second.members[i].name << " = " << it->second.members[i].name << "_"; - } - else - { - os << "memcpy( &" << it->second.members[i].name << ", " << it->second.members[i].name << "_.data(), " << it->second.members[i].arraySize << " * sizeof( " << it->second.members[i].type << " ) )"; - } - os << ";" << std::endl - << " }" << std::endl - << std::endl; - } - - for (size_t i = 0; isecond.members.size(); i++) - { - // one setter per union element - assert(!it->second.returnedOnly); - writeStructSetter(os, dependencyData.name, it->second.members[i]); - } - - // the implicit cast operators to the native type - os << " operator Vk" << dependencyData.name << " const&() const" << std::endl - << " {" << std::endl - << " return *reinterpret_cast(this);" << std::endl - << " }" << std::endl - << std::endl - << " operator Vk" << dependencyData.name << " &()" << std::endl - << " {" << std::endl - << " return *reinterpret_cast(this);" << std::endl - << " }" << std::endl - << std::endl; - - // the union member variables - // if there's at least one Vk... type in this union, check for unrestricted unions support - bool needsUnrestrictedUnions = false; - for (size_t i = 0; i < it->second.members.size() && !needsUnrestrictedUnions; i++) - { - needsUnrestrictedUnions = (m_vkTypes.find(it->second.members[i].type) != m_vkTypes.end()); - } - if (needsUnrestrictedUnions) - { - os << "#ifdef VULKAN_HPP_HAS_UNRESTRICTED_UNIONS" << std::endl; - for (size_t i = 0; i < it->second.members.size(); i++) - { - os << " " << it->second.members[i].type << " " << it->second.members[i].name; - if (!it->second.members[i].arraySize.empty()) - { - os << "[" << it->second.members[i].arraySize << "]"; - } - os << ";" << std::endl; - } - os << "#else" << std::endl; - } - for (size_t i = 0; i < it->second.members.size(); i++) - { - os << " "; - if (m_vkTypes.find(it->second.members[i].type) != m_vkTypes.end()) - { - os << "Vk"; - } - os << it->second.members[i].type << " " << it->second.members[i].name; - if (!it->second.members[i].arraySize.empty()) - { - os << "[" << it->second.members[i].arraySize << "]"; - } - os << ";" << std::endl; - } - if (needsUnrestrictedUnions) - { - os << "#endif // VULKAN_HPP_HAS_UNRESTRICTED_UNIONS" << std::endl; - } - os << " };" << std::endl - << std::endl; -} - -#if !defined(NDEBUG) -void VulkanHppGenerator::checkExtensionRequirements() -{ - for (auto const& ext : m_extensions) - { - for (auto const& req : ext.second.requires) - { - auto reqExt = m_extensions.find(req); - assert(reqExt != m_extensions.end()); - assert(reqExt->second.protect.empty() || (reqExt->second.protect == ext.second.protect)); - } - } -} - -void VulkanHppGenerator::skipVendorID(tinyxml2::XMLElement const* element) -{ - std::map attributes = getAttributes(element); - checkAttributes(attributes, element->GetLineNum(), { { "comment",{} },{ "id",{} },{ "name",{} } }, {}); - checkElements(getChildElements(element), {}); - - VendorIDData vendorID; - for (auto const& attribute : attributes) - { - std::string name = attribute.first; - if (name == "comment") - { - vendorID.comment = attribute.second; - } - else if (name == "id") - { - vendorID.id = attribute.second; - } - else - { - assert(name == "name"); - vendorID.name = attribute.second; - } - } - m_vendorIDs.push_back(vendorID); -} - -void VulkanHppGenerator::skipVendorIDs(tinyxml2::XMLElement const* element) -{ - checkAttributes(getAttributes(element), element->GetLineNum(), { { "comment",{} } }, {}); - std::vector children = getChildElements(element); - checkElements(children, { "vendorid" }); - - for (auto child : children) - { - skipVendorID(child); - } -} -#endif - -void VulkanHppGenerator::EnumData::addEnumValue(std::string const &enumName, std::string const& tag, std::map & nameMap) -{ - EnumValueData evd; - evd.name = createEnumValueName(enumName, prefix, postfix, bitmask, tag); - evd.value = enumName; - - auto it = std::find_if(values.begin(), values.end(), [&evd](EnumValueData const& _evd) { return _evd.name == evd.name; }); - if (it == values.end()) - { - values.push_back(evd); - assert(nameMap.find(enumName) == nameMap.end()); - nameMap[enumName] = this->name + "::" + evd.name; - } - else - { - assert(it->value == evd.value); - } -} - -void VulkanHppGenerator::writeDelegationClassStatic(std::ostream &os) -{ - os << "class DispatchLoaderStatic" << std::endl - << "{" << std::endl - << "public:\n"; - - for (auto command : m_commands) - { - enterProtect(os, command.second.protect); - os << " " << command.second.unchangedReturnType << " vk" << startUpperCase(command.second.fullName) << "( "; - bool first = true; - for (auto param : command.second.params) - { - if (!first) { - os << ", "; - } - os << param.unchangedType << " " << param.name; - if (!param.arraySize.empty()) - { - os << "[" << param.arraySize << "]"; - } - first = false; - } - os << " ) const\n" - << " {\n" - << " return ::vk" << startUpperCase(command.second.fullName) << "( "; - first = true; - for (auto param : command.second.params) - { - if (!first) { - os << ", "; - } - os << param.name; - first = false; - } - os << ");\n"; - os << " }\n"; - leaveProtect(os, command.second.protect); - } - os << "};\n"; -} - -void VulkanHppGenerator::writeDelegationClassDynamic(std::ostream &os) -{ - os << " class DispatchLoaderDynamic" << std::endl - << " {" << std::endl - << " public:" << std::endl; - - for (auto command : m_commands) - { - enterProtect(os, command.second.protect); - os << " PFN_vk" << startUpperCase(command.second.fullName) << " vk" << startUpperCase(command.second.fullName) << " = 0;" << std::endl; - leaveProtect(os, command.second.protect); - } - - // write initialization function to fetch function pointers - os << " public:" << std::endl - << " DispatchLoaderDynamic(Instance instance = Instance(), Device device = Device())" << std::endl - << " {" << std::endl - << " if (instance)" << std::endl - << " {" << std::endl - << " init(instance, device);" << std::endl - << " }" << std::endl - << " }" << std::endl << std::endl - << " void init(Instance instance, Device device = Device())" << std::endl - << " {" << std::endl; - - for (auto command : m_commands) - { - enterProtect(os, command.second.protect); - if (!command.second.params.empty() - && m_handles.find(command.second.params[0].type) != m_handles.end() - && command.second.params[0].type != "Instance" - && command.second.params[0].type != "PhysicalDevice") - { - os << " vk" << startUpperCase(command.second.fullName) << " = PFN_vk" << startUpperCase(command.second.fullName) - << "(device ? device.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\") : instance.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\"));" << std::endl; - } - else { - os << " vk" << startUpperCase(command.second.fullName) << " = PFN_vk" << startUpperCase(command.second.fullName) << "(instance.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\"));" << std::endl; - } - leaveProtect(os, command.second.protect); - } - os << " }" << std::endl; - os << " };\n"; -} - -int main( int argc, char **argv ) -{ - try { - tinyxml2::XMLDocument doc; - - std::string filename = (argc == 1) ? VK_SPEC : argv[1]; - std::cout << "Loading vk.xml from " << filename << std::endl; - std::cout << "Writing vulkan.hpp to " << VULKAN_HPP_FILE << std::endl; - - tinyxml2::XMLError error = doc.LoadFile(filename.c_str()); - if (error != tinyxml2::XML_SUCCESS) - { - std::cout << "VkGenerate: failed to load file " << filename << " . Error code: " << error << std::endl; - return -1; - } - - VulkanHppGenerator generator; - - bool foundLicense = false; - - tinyxml2::XMLElement const* registryElement = doc.FirstChildElement(); - checkAttributes(getAttributes(registryElement), registryElement->GetLineNum(), {}, {}); - assert(strcmp(registryElement->Value(), "registry") == 0); - assert(!registryElement->NextSiblingElement()); - - std::vector children = getChildElements(registryElement); - checkElements(children, { "commands", "comment", "enums", "extensions", "feature", "tags", "types", "vendorids", "platforms" }); - for (auto child : children) - { - const std::string value = child->Value(); - if (value == "commands") - { - generator.readCommands(child); - } - else if (value == "comment") - { - if (!foundLicense) - { - // get the vulkan license header and skip any leading spaces - generator.readComment(child); - foundLicense = true; - } - } - else if (value == "enums") - { - generator.readEnums(child); - } - else if (value == "extensions") - { - generator.readExtensions(child); - } - else if (value == "feature") - { - generator.readFeature(child); - } - else if (value == "tags") - { - generator.readTags(child); - } - else if (value == "types") - { - generator.readTypes(child); - } - else if (value == "vendorids") - { -#if !defined(NDEBUG) - generator.skipVendorIDs(child); -#endif - } - else if (value == "platforms") - { - // skip this tag - } - else - { - std::stringstream lineNumber; - lineNumber << child->GetLineNum(); - std::cerr << "warning: Unhandled tag " << value << " at line number: " << lineNumber.str() << "!" << std::endl; - } - } - - generator.sortDependencies(); - -#if !defined(NDEBUG) - generator.checkExtensionRequirements(); -#endif - - std::map defaultValues = generator.createDefaults(); - - std::ofstream ofs(VULKAN_HPP_FILE); - ofs << generator.getVulkanLicenseHeader() << std::endl - << R"( -#ifndef VULKAN_HPP -#define VULKAN_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE -# include -# include -#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ -#if !defined(VULKAN_HPP_ASSERT) -# include -# define VULKAN_HPP_ASSERT assert -#endif - -// includes through some other header -// this results in major(x) being resolved to gnu_dev_major(x) -// which is an expression in a constructor initializer list. -#if defined(major) - #undef major -#endif -#if defined(minor) - #undef minor -#endif - -// Windows defines MemoryBarrier which is deprecated and collides -// with the vk::MemoryBarrier struct. -#ifdef MemoryBarrier - #undef MemoryBarrier -#endif - -)"; - - writeVersionCheck(ofs, generator.getVersion()); - writeTypesafeCheck(ofs, generator.getTypesafeCheck()); - ofs << versionCheckHeader - << inlineHeader - << explicitHeader - << constExprHeader - << std::endl - << vkNamespace - << flagsHeader - << optionalClassHeader - << arrayProxyHeader - << uniqueHandleHeader - << structureChainHeader; - - // first of all, write out vk::Result and the exception handling stuff - generator.writeResultEnum(ofs); - - ofs << "} // namespace VULKAN_HPP_NAMESPACE" << std::endl - << std::endl - << "namespace std" << std::endl - << "{" << std::endl - << " template <>" << std::endl - << " struct is_error_code_enum : public true_type" << std::endl - << " {};" << std::endl - << "}" << std::endl - << std::endl - << "namespace VULKAN_HPP_NAMESPACE" << std::endl - << "{" << std::endl - << resultValueHeader - << createResultValueHeader; - generator.writeDelegationClassStatic(ofs); - ofs << deleterClassString; - - generator.writeTypes(ofs, defaultValues); - generator.writeStructureChainValidation(ofs); - generator.writeToStringFunctions(ofs); - - generator.writeDelegationClassDynamic(ofs); - - ofs << "} // namespace VULKAN_HPP_NAMESPACE" << std::endl - << std::endl - << "#endif" << std::endl; - } - catch (std::exception const& e) - { - std::cout << "caught exception: " << e.what() << std::endl; - return -1; - } - catch (...) - { - std::cout << "caught unknown exception" << std::endl; - return -1; - } -} +// Copyright(c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "VulkanHppGenerator.hpp" + +const size_t INVALID_INDEX = (size_t)~0; + +const std::string vkNamespace = R"( +#if !defined(VULKAN_HPP_NAMESPACE) +#define VULKAN_HPP_NAMESPACE vk +#endif + +#define VULKAN_HPP_STRINGIFY2(text) #text +#define VULKAN_HPP_STRINGIFY(text) VULKAN_HPP_STRINGIFY2(text) +#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY(VULKAN_HPP_NAMESPACE) + +namespace VULKAN_HPP_NAMESPACE +{ +)"; + +const std::string constExprHeader = R"( +#if defined(_MSC_VER) && (_MSC_VER <= 1800) +# define VULKAN_HPP_CONSTEXPR +#else +# define VULKAN_HPP_CONSTEXPR constexpr +#endif +)"; + +const std::string exceptionHeader = R"( +#if defined(_MSC_VER) && (_MSC_VER == 1800) +# define noexcept _NOEXCEPT +#endif + + class ErrorCategoryImpl : public std::error_category + { + public: + virtual const char* name() const noexcept override { return VULKAN_HPP_NAMESPACE_STRING"::Result"; } + virtual std::string message(int ev) const override { return to_string(static_cast(ev)); } + }; + +#if defined(_MSC_VER) && (_MSC_VER == 1800) +# undef noexcept +#endif + + VULKAN_HPP_INLINE const std::error_category& errorCategory() + { + static ErrorCategoryImpl instance; + return instance; + } + + VULKAN_HPP_INLINE std::error_code make_error_code(Result e) + { + return std::error_code(static_cast(e), errorCategory()); + } + + VULKAN_HPP_INLINE std::error_condition make_error_condition(Result e) + { + return std::error_condition(static_cast(e), errorCategory()); + } +)"; + +const std::string exceptionClassesHeader = R"( +#if defined(_MSC_VER) && (_MSC_VER == 1800) +# define noexcept _NOEXCEPT +#endif + + class Error + { + public: + virtual ~Error() = default; + + virtual const char* what() const noexcept = 0; + }; + + class LogicError : public Error, public std::logic_error + { + public: + explicit LogicError( const std::string& what ) + : Error(), std::logic_error(what) {} + explicit LogicError( char const * what ) + : Error(), std::logic_error(what) {} + virtual ~LogicError() = default; + + virtual const char* what() const noexcept { return std::logic_error::what(); } + }; + + class SystemError : public Error, public std::system_error + { + public: + SystemError( std::error_code ec ) + : Error(), std::system_error(ec) {} + SystemError( std::error_code ec, std::string const& what ) + : Error(), std::system_error(ec, what) {} + SystemError( std::error_code ec, char const * what ) + : Error(), std::system_error(ec, what) {} + SystemError( int ev, std::error_category const& ecat ) + : Error(), std::system_error(ev, ecat) {} + SystemError( int ev, std::error_category const& ecat, std::string const& what) + : Error(), std::system_error(ev, ecat, what) {} + SystemError( int ev, std::error_category const& ecat, char const * what) + : Error(), std::system_error(ev, ecat, what) {} + virtual ~SystemError() = default; + + virtual const char* what() const noexcept { return std::system_error::what(); } + }; + +#if defined(_MSC_VER) && (_MSC_VER == 1800) +# undef noexcept +#endif + +)"; + +const std::string flagsHeader = R"( + template struct FlagTraits + { + enum { allFlags = 0 }; + }; + + template + class Flags + { + public: + VULKAN_HPP_CONSTEXPR Flags() + : m_mask(0) + { + } + + Flags(BitType bit) + : m_mask(static_cast(bit)) + { + } + + Flags(Flags const& rhs) + : m_mask(rhs.m_mask) + { + } + + explicit Flags(MaskType flags) + : m_mask(flags) + { + } + + Flags & operator=(Flags const& rhs) + { + m_mask = rhs.m_mask; + return *this; + } + + Flags & operator|=(Flags const& rhs) + { + m_mask |= rhs.m_mask; + return *this; + } + + Flags & operator&=(Flags const& rhs) + { + m_mask &= rhs.m_mask; + return *this; + } + + Flags & operator^=(Flags const& rhs) + { + m_mask ^= rhs.m_mask; + return *this; + } + + Flags operator|(Flags const& rhs) const + { + Flags result(*this); + result |= rhs; + return result; + } + + Flags operator&(Flags const& rhs) const + { + Flags result(*this); + result &= rhs; + return result; + } + + Flags operator^(Flags const& rhs) const + { + Flags result(*this); + result ^= rhs; + return result; + } + + bool operator!() const + { + return !m_mask; + } + + Flags operator~() const + { + Flags result(*this); + result.m_mask ^= FlagTraits::allFlags; + return result; + } + + bool operator==(Flags const& rhs) const + { + return m_mask == rhs.m_mask; + } + + bool operator!=(Flags const& rhs) const + { + return m_mask != rhs.m_mask; + } + + explicit operator bool() const + { + return !!m_mask; + } + + explicit operator MaskType() const + { + return m_mask; + } + + private: + MaskType m_mask; + }; + + template + Flags operator|(BitType bit, Flags const& flags) + { + return flags | bit; + } + + template + Flags operator&(BitType bit, Flags const& flags) + { + return flags & bit; + } + + template + Flags operator^(BitType bit, Flags const& flags) + { + return flags ^ bit; + } + +)"; + +const std::string optionalClassHeader = R"( + template + class Optional + { + public: + Optional(RefType & reference) { m_ptr = &reference; } + Optional(RefType * ptr) { m_ptr = ptr; } + Optional(std::nullptr_t) { m_ptr = nullptr; } + + operator RefType*() const { return m_ptr; } + RefType const* operator->() const { return m_ptr; } + explicit operator bool() const { return !!m_ptr; } + + private: + RefType *m_ptr; + }; +)"; + +const std::string arrayProxyHeader = R"( +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE + template + class ArrayProxy + { + public: + VULKAN_HPP_CONSTEXPR ArrayProxy(std::nullptr_t) + : m_count(0) + , m_ptr(nullptr) + {} + + ArrayProxy(T & ptr) + : m_count(1) + , m_ptr(&ptr) + {} + + ArrayProxy(uint32_t count, T * ptr) + : m_count(count) + , m_ptr(ptr) + {} + + template + ArrayProxy(std::array::type, N> & data) + : m_count(N) + , m_ptr(data.data()) + {} + + template + ArrayProxy(std::array::type, N> const& data) + : m_count(N) + , m_ptr(data.data()) + {} + + template ::type>> + ArrayProxy(std::vector::type, Allocator> & data) + : m_count(static_cast(data.size())) + , m_ptr(data.data()) + {} + + template ::type>> + ArrayProxy(std::vector::type, Allocator> const& data) + : m_count(static_cast(data.size())) + , m_ptr(data.data()) + {} + + ArrayProxy(std::initializer_list const& data) + : m_count(static_cast(data.end() - data.begin())) + , m_ptr(data.begin()) + {} + + const T * begin() const + { + return m_ptr; + } + + const T * end() const + { + return m_ptr + m_count; + } + + const T & front() const + { + VULKAN_HPP_ASSERT(m_count && m_ptr); + return *m_ptr; + } + + const T & back() const + { + VULKAN_HPP_ASSERT(m_count && m_ptr); + return *(m_ptr + m_count - 1); + } + + bool empty() const + { + return (m_count == 0); + } + + uint32_t size() const + { + return m_count; + } + + T * data() const + { + return m_ptr; + } + + private: + uint32_t m_count; + T * m_ptr; + }; +#endif +)"; + +const std::string structureChainHeader = R"( + + template struct isStructureChainValid { enum { value = false }; }; + + template + struct TypeList + { + using list = P; + using last = T; + }; + + template + struct extendCheck + { + static const bool valid = isStructureChainValid::value || extendCheck::valid; + }; + + template + struct extendCheck,X> + { + static const bool valid = isStructureChainValid::value; + }; + + template + struct extendCheck + { + static const bool valid = true; + }; + + template + class StructureChainElement + { + public: + explicit operator Element&() { return value; } + explicit operator const Element&() const { return value; } + private: + Element value; + }; + + template + class StructureChain : private StructureChainElement... + { + public: + StructureChain() + { + link(); + } + + StructureChain(StructureChain const &rhs) + { + linkAndCopy(rhs); + } + + StructureChain(StructureElements const &... elems) + { + linkAndCopyElements(elems...); + } + + StructureChain& operator=(StructureChain const &rhs) + { + linkAndCopy(rhs); + return *this; + } + + template ClassType& get() { return static_cast(*this);} + + private: + template + void link() + { + static_assert(extendCheck::valid, "The structure chain is not valid!"); + } + + template + void link() + { + static_assert(extendCheck::valid, "The structure chain is not valid!"); + X& x = static_cast(*this); + Y& y = static_cast(*this); + x.pNext = &y; + link, Y, Z...>(); + } + + template + void linkAndCopy(StructureChain const &rhs) + { + static_assert(extendCheck::valid, "The structure chain is not valid!"); + static_cast(*this) = static_cast(rhs); + } + + template + void linkAndCopy(StructureChain const &rhs) + { + static_assert(extendCheck::valid, "The structure chain is not valid!"); + X& x = static_cast(*this); + Y& y = static_cast(*this); + x = static_cast(rhs); + x.pNext = &y; + linkAndCopy, Y, Z...>(rhs); + } + + template + void linkAndCopyElements(X const &xelem) + { + static_assert(extendCheck::valid, "The structure chain is not valid!"); + static_cast(*this) = xelem; + } + + template + void linkAndCopyElements(X const &xelem, Y const &yelem, Z const &... zelem) + { + static_assert(extendCheck::valid, "The structure chain is not valid!"); + X& x = static_cast(*this); + Y& y = static_cast(*this); + x = xelem; + x.pNext = &y; + linkAndCopyElements, Y, Z...>(yelem, zelem...); + } + }; + +)"; + +const std::string versionCheckHeader = R"( +#if !defined(VULKAN_HPP_HAS_UNRESTRICTED_UNIONS) +# if defined(__clang__) +# if __has_feature(cxx_unrestricted_unions) +# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS +# endif +# elif defined(__GNUC__) +# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +# if 40600 <= GCC_VERSION +# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS +# endif +# elif defined(_MSC_VER) +# if 1900 <= _MSC_VER +# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS +# endif +# endif +#endif +)"; + +const std::string inlineHeader = R"( +#if !defined(VULKAN_HPP_INLINE) +# if defined(__clang___) +# if __has_attribute(always_inline) +# define VULKAN_HPP_INLINE __attribute__((always_inline)) __inline__ +# else +# define VULKAN_HPP_INLINE inline +# endif +# elif defined(__GNUC__) +# define VULKAN_HPP_INLINE __attribute__((always_inline)) __inline__ +# elif defined(_MSC_VER) +# define VULKAN_HPP_INLINE inline +# else +# define VULKAN_HPP_INLINE inline +# endif +#endif +)"; + +const std::string explicitHeader = R"( +#if defined(VULKAN_HPP_TYPESAFE_CONVERSION) +# define VULKAN_HPP_TYPESAFE_EXPLICIT +#else +# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit +#endif +)"; + +const std::string resultValueHeader = R"( + template + struct ResultValue + { + ResultValue( Result r, T & v ) + : result( r ) + , value( v ) + {} + + ResultValue( Result r, T && v ) + : result( r ) + , value( std::move( v ) ) + {} + + Result result; + T value; + + operator std::tuple() { return std::tuple(result, value); } + }; + + template + struct ResultValueType + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + typedef ResultValue type; +#else + typedef T type; +#endif + }; + + template <> + struct ResultValueType + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + typedef Result type; +#else + typedef void type; +#endif + }; +)"; + +const std::string createResultValueHeader = R"( + VULKAN_HPP_INLINE ResultValueType::type createResultValue( Result result, char const * message ) + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + VULKAN_HPP_ASSERT( result == Result::eSuccess ); + return result; +#else + if ( result != Result::eSuccess ) + { + throwResultException( result, message ); + } +#endif + } + + template + VULKAN_HPP_INLINE typename ResultValueType::type createResultValue( Result result, T & data, char const * message ) + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + VULKAN_HPP_ASSERT( result == Result::eSuccess ); + return ResultValue( result, data ); +#else + if ( result != Result::eSuccess ) + { + throwResultException( result, message ); + } + return std::move( data ); +#endif + } + + VULKAN_HPP_INLINE Result createResultValue( Result result, char const * message, std::initializer_list successCodes ) + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); +#else + if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) + { + throwResultException( result, message ); + } +#endif + return result; + } + + template + VULKAN_HPP_INLINE ResultValue createResultValue( Result result, T & data, char const * message, std::initializer_list successCodes ) + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); +#else + if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) + { + throwResultException( result, message ); + } +#endif + return ResultValue( result, data ); + } + +#ifndef VULKAN_HPP_NO_SMART_HANDLE + template + VULKAN_HPP_INLINE typename ResultValueType>::type createResultValue( Result result, T & data, char const * message, typename UniqueHandleTraits::deleter const& deleter ) + { +#ifdef VULKAN_HPP_NO_EXCEPTIONS + VULKAN_HPP_ASSERT( result == Result::eSuccess ); + return ResultValue>( result, UniqueHandle(data, deleter) ); +#else + if ( result != Result::eSuccess ) + { + throwResultException( result, message ); + } + return UniqueHandle(data, deleter); +#endif + } +#endif + +)"; + +const std::string uniqueHandleHeader = R"( +#ifndef VULKAN_HPP_NO_SMART_HANDLE + + template class UniqueHandleTraits; + + template + class UniqueHandle : public UniqueHandleTraits::deleter + { + private: + using Deleter = typename UniqueHandleTraits::deleter; + public: + explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() ) + : Deleter( deleter) + , m_value( value ) + {} + + UniqueHandle( UniqueHandle const& ) = delete; + + UniqueHandle( UniqueHandle && other ) + : Deleter( std::move( static_cast( other ) ) ) + , m_value( other.release() ) + {} + + ~UniqueHandle() + { + if ( m_value ) this->destroy( m_value ); + } + + UniqueHandle & operator=( UniqueHandle const& ) = delete; + + UniqueHandle & operator=( UniqueHandle && other ) + { + reset( other.release() ); + *static_cast(this) = std::move( static_cast(other) ); + return *this; + } + + explicit operator bool() const + { + return m_value.operator bool(); + } + + Type const* operator->() const + { + return &m_value; + } + + Type * operator->() + { + return &m_value; + } + + Type const& operator*() const + { + return m_value; + } + + Type & operator*() + { + return m_value; + } + + const Type & get() const + { + return m_value; + } + + Type & get() + { + return m_value; + } + + void reset( Type const& value = Type() ) + { + if ( m_value != value ) + { + if ( m_value ) this->destroy( m_value ); + m_value = value; + } + } + + Type release() + { + Type value = m_value; + m_value = nullptr; + return value; + } + + void swap( UniqueHandle & rhs ) + { + std::swap(m_value, rhs.m_value); + std::swap(static_cast(*this), static_cast(rhs)); + } + + private: + Type m_value; + }; + + template + VULKAN_HPP_INLINE void swap( UniqueHandle & lhs, UniqueHandle & rhs ) + { + lhs.swap( rhs ); + } +#endif + +)"; + +const std::string deleterClassString = R"( + struct AllocationCallbacks; + + template + class ObjectDestroy + { + public: + ObjectDestroy( OwnerType owner = OwnerType(), Optional allocator = nullptr, Dispatch const &dispatch = Dispatch() ) + : m_owner( owner ) + , m_allocator( allocator ) + , m_dispatch( &dispatch ) + {} + + OwnerType getOwner() const { return m_owner; } + Optional getAllocator() const { return m_allocator; } + + protected: + template + void destroy(T t) + { + m_owner.destroy( t, m_allocator, *m_dispatch ); + } + + private: + OwnerType m_owner; + Optional m_allocator; + Dispatch const* m_dispatch; + }; + + class NoParent; + + template + class ObjectDestroy + { + public: + ObjectDestroy( Optional allocator = nullptr, Dispatch const &dispatch = Dispatch() ) + : m_allocator( allocator ) + , m_dispatch( &dispatch ) + {} + + Optional getAllocator() const { return m_allocator; } + + protected: + template + void destroy(T t) + { + t.destroy( m_allocator, *m_dispatch ); + } + + private: + Optional m_allocator; + Dispatch const* m_dispatch; + }; + + template + class ObjectFree + { + public: + ObjectFree( OwnerType owner = OwnerType(), Optional allocator = nullptr, Dispatch const &dispatch = Dispatch() ) + : m_owner( owner ) + , m_allocator( allocator ) + , m_dispatch( &dispatch ) + {} + + OwnerType getOwner() const { return m_owner; } + Optional getAllocator() const { return m_allocator; } + + protected: + template + void destroy(T t) + { + m_owner.free( t, m_allocator, *m_dispatch ); + } + + private: + OwnerType m_owner; + Optional m_allocator; + Dispatch const* m_dispatch; + }; + + template + class PoolFree + { + public: + PoolFree( OwnerType owner = OwnerType(), PoolType pool = PoolType(), Dispatch const &dispatch = Dispatch() ) + : m_owner( owner ) + , m_pool( pool ) + , m_dispatch( &dispatch ) + {} + + OwnerType getOwner() const { return m_owner; } + PoolType getPool() const { return m_pool; } + + protected: + template + void destroy(T t) + { + m_owner.free( m_pool, t, *m_dispatch ); + } + + private: + OwnerType m_owner; + PoolType m_pool; + Dispatch const* m_dispatch; + }; + +)"; + + +std::string replaceWithMap(std::string const &input, std::map replacements) +{ + // This will match ${someVariable} and contain someVariable in match group 1 + std::regex re(R"(\$\{([^\}]+)\})"); + auto it = std::sregex_iterator(input.begin(), input.end(), re); + auto end = std::sregex_iterator(); + + // No match, just return the original string + if (it == end) + { + return input; + } + + std::string result = ""; + while (it != end) + { + std::smatch match = *it; + auto itReplacement = replacements.find(match[1].str()); + assert(itReplacement != replacements.end()); + + result += match.prefix().str() + ((itReplacement != replacements.end()) ? itReplacement->second : match[0].str()); + ++it; + + // we've passed the last match. Append the rest of the orignal string + if (it == end) + { + result += match.suffix().str(); + } + } + return result; +} + + +bool beginsWith(std::string const& text, std::string const& prefix); +void checkAttributes(std::map const& attributes, int line, std::map> const& required, std::map> const& optional); +void checkElements(std::vector const& elements, std::set const& values); +void checkEmptyElement(tinyxml2::XMLElement const* element); +void checkOrderedElements(std::vector const& elements, std::vector const& values); +std::string createEnumValueName(std::string const& name, std::string const& prefix, std::string const& postfix, bool bitmask, std::string const& tag); +bool endsWith(std::string const& text, std::string const& postfix); +void enterProtect(std::ostream &os, std::string const& protect); +std::string extractTag(std::string const& name); +std::string findTag(std::string const& name, std::set const& tags); +std::string generateEnumNameForFlags(std::string const& name); +std::map getAttributes(tinyxml2::XMLElement const* element); +std::vector getChildElements(tinyxml2::XMLElement const* element); +bool isErrorEnum(std::string const& enumName); +void leaveProtect(std::ostream &os, std::string const& protect); +std::string readArraySize(tinyxml2::XMLNode const* node, std::string& name); +std::string startUpperCase(std::string const& input); +std::string startLowerCase(std::string const& input); +std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix = std::string()); +std::string stripErrorEnumPrefix(std::string const& enumName); +std::string stripPluralS(std::string const& name); +std::vector tokenize(std::string tokenString, char separator); +std::string trim(std::string const& input); +std::string trimEnd(std::string const& input); +std::string toCamelCase(std::string const& value); +std::string toUpperCase(std::string const& name); +void writeFunctionHeaderName(std::ostream & os, std::string const& name, bool singular, bool unique); +void writeReinterpretCast(std::ostream & os, bool leadingConst, bool vulkanType, std::string const& type, bool trailingPointerToConst); +void writeStandardOrEnhanced(std::ostream & os, std::string const& standard, std::string const& enhanced); +void writeTypesafeCheck(std::ostream & os, std::string const& typesafeCheck); +void writeVersionCheck(std::ostream & os, std::string const& version); +#if !defined(NDEBUG) +void skipFeatureRequire(tinyxml2::XMLElement const* element); +void skipImplicitExternSyncParams(tinyxml2::XMLElement const* element); +void skipTypeEnum(tinyxml2::XMLElement const* element, std::map const& attributes); +void skipTypeInclude(tinyxml2::XMLElement const* element); +#endif + +bool beginsWith(std::string const& text, std::string const& prefix) +{ + return !prefix.empty() && text.substr(0, prefix.length()) == prefix; +} + +// check the validity of an attributes map +// attributes : the map of name/value pairs of the encountered attributes +// line : the line in the xml file where the attributes are listed +// required : the required attributes, with a set of allowed values per attribute +// optional : the optional attributes, with a set of allowed values per attribute +void checkAttributes(std::map const& attributes, int line, std::map> const& required, std::map> const& optional) +{ + std::stringstream ss; + ss << line; + std::string lineNumber = ss.str(); + + // check if all required attributes are included and if there is a set of allowed values, check if the actual value is part of that set + for (auto const& r : required) + { + auto attributesIt = attributes.find(r.first); + if (attributesIt == attributes.end()) + { + throw std::runtime_error("Spec error on line " + lineNumber + ": missing attribute <" + r.first + ">"); + } + if (!r.second.empty() && (r.second.find(attributesIt->second) == r.second.end())) + { + throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected attribute value <" + attributesIt->second + "> in attribute <" + r.first + ">"); + } + } + // check if all not required attributes or optional, and if there is a set of allowed values, check if the actual value is part of that set + for (auto const& a : attributes) + { + if (required.find(a.first) == required.end()) + { + auto optionalIt = optional.find(a.first); + if (optionalIt == optional.end()) + { + std::cerr << "warning: " << "Unknown attribute " + a.first + " in line " + lineNumber + "!" << std::endl; + continue; + } + if (!optionalIt->second.empty()) + { + std::vector values = tokenize(a.second, ','); + for (auto const& v : values) + { + if (optionalIt->second.find(v) == optionalIt->second.end()) + { + throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected attribute value <" + v + "> in attribute <" + a.first + ">"); + } + } + } + } + } +} + +void checkElements(std::vector const& elements, std::set const& values) +{ + for (auto e : elements) + { + if (values.find(e->Value()) == values.end()) + { + std::stringstream ss; + ss << e->GetLineNum(); + std::string lineNumber = ss.str(); + std::cerr << "warning: Unknown element in spec on line: " << lineNumber << " " << e->Value() << "!" << std::endl; + } + } +} + +void checkEmptyElement(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); + checkElements(getChildElements(element), {}); +} + +void checkOrderedElements(std::vector const& elements, std::vector const& values) +{ + for (size_t i = 0; i < elements.size(); i++) + { + std::stringstream ss; + ss << elements[i]->GetLineNum(); + std::string lineNumber = ss.str(); + + if (values.size() <= i) + { + throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected surplus element <" + elements[i]->Value() + ">"); + } + if (values[i] != elements[i]->Value()) + { + throw std::runtime_error("Spec error on line " + lineNumber + ": unexpected element <" + elements[i]->Value() + ">, expected <" + values[i] + ">"); + } + } +} + +std::string createEnumValueName(std::string const& name, std::string const& prefix, std::string const& postfix, bool bitmask, std::string const& tag) +{ + std::string result = "e" + toCamelCase(strip(name, prefix, postfix)); + if (bitmask) + { + size_t pos = result.find("Bit"); + if (pos != std::string::npos) + { + result.erase(pos, 3); + } + } + if (!tag.empty() && (result.substr(result.length() - tag.length()) == toCamelCase(tag))) + { + result = result.substr(0, result.length() - tag.length()) + tag; + } + return result; +} + +bool endsWith(std::string const& text, std::string const& postfix) +{ + return !postfix.empty() && (postfix.length() < text.length()) && (text.substr(text.length() - postfix.length()) == postfix); +} + +void enterProtect(std::ostream &os, std::string const& protect) +{ + if (!protect.empty()) + { + os << "#ifdef " << protect << std::endl; + } +} + +std::string extractTag(std::string const& name) +{ + // the name is supposed to look like: VK__ + size_t start = name.find('_'); + assert((start != std::string::npos) && (name.substr(0, start) == "VK")); + size_t end = name.find('_', start + 1); + assert(end != std::string::npos); + return name.substr(start + 1, end - start - 1); +} + +std::string findTag(std::string const& name, std::set const& tags) +{ + // find the tag in a name, return that tag or an empty string + auto tagIt = std::find_if(tags.begin(), tags.end(), [&name](std::string const& t) + { + size_t pos = name.find(t); + return (pos != std::string::npos) && (pos == name.length() - t.length()); + }); + return tagIt != tags.end() ? *tagIt : ""; +} + +std::string generateEnumNameForFlags(std::string const& name) +{ + // create a string, where the substring "Flags" is replaced by "FlagBits" + std::string generatedName = name; + size_t pos = generatedName.rfind("Flags"); + assert(pos != std::string::npos); + generatedName.replace(pos, 5, "FlagBits"); + return generatedName; +} + +std::map getAttributes(tinyxml2::XMLElement const* element) +{ + std::map attributes; + for (auto attribute = element->FirstAttribute(); attribute; attribute = attribute->Next()) + { + assert(attributes.find(attribute->Name()) == attributes.end()); + attributes[attribute->Name()] = attribute->Value(); + } + return attributes; +} + +std::vector getChildElements(tinyxml2::XMLElement const* element) +{ + std::vector childElements; + for (tinyxml2::XMLElement const* childElement = element->FirstChildElement(); childElement; childElement = childElement->NextSiblingElement()) + { + childElements.push_back(childElement); + } + return childElements; +} + +bool isErrorEnum(std::string const& enumName) +{ + return (enumName.substr(0, 6) == "eError"); +} + +void leaveProtect(std::ostream &os, std::string const& protect) +{ + if (!protect.empty()) + { + os << "#endif /*" << protect << "*/" << std::endl; + } +} + +std::string readArraySize(tinyxml2::XMLNode const* node, std::string& name) +{ + std::string arraySize; + if (name.back() == ']') + { + // if the parameter has '[' and ']' in its name, get the stuff inbetween those as the array size and erase that part from the parameter name + assert(!node->NextSibling()); + size_t pos = name.find('['); + assert(pos != std::string::npos); + arraySize = name.substr(pos + 1, name.length() - 2 - pos); + name.erase(pos); + } + else + { + // otherwise look for a sibling of this node + node = node->NextSibling(); + if (node && node->ToText()) + { + assert(node->Value()); + std::string value = trimEnd(node->Value()); + if (value == "[") + { + // if this node has '[' as its value, the next node holds the array size, and the node after that needs to hold ']', and there should be no more siblings + node = node->NextSibling(); + assert(node && node->ToElement() && (strcmp(node->Value(), "enum") == 0)); + arraySize = node->ToElement()->GetText(); + node = node->NextSibling(); + assert(node && node->ToText() && (trimEnd(node->Value()) == "]")); + } + else + { + // otherwise, the node holds '[' and ']', so get the stuff in between those as the array size + assert((value.front() == '[') && (value.back() == ']')); + arraySize = value.substr(1, value.length() - 2); + } + assert(!node->NextSibling() || ((strcmp(node->NextSibling()->Value(), "comment") == 0) && !node->NextSibling()->NextSibling())); + } + } + return arraySize; +} + +std::string startUpperCase(std::string const& input) +{ + return static_cast(toupper(input[0])) + input.substr(1); +} + +std::string startLowerCase(std::string const& input) +{ + return input.empty() ? "" : static_cast(tolower(input[0])) + input.substr(1); +} + +std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix) +{ + std::string strippedValue = value; + if (beginsWith(strippedValue, prefix)) + { + strippedValue.erase(0, prefix.length()); + } + if (endsWith(strippedValue, postfix)) + { + strippedValue.erase(strippedValue.length() - postfix.length()); + } + return strippedValue; +} + +std::string stripErrorEnumPrefix(std::string const& enumName) +{ + assert(isErrorEnum(enumName)); + return strip(enumName, "eError"); +} + +std::string stripPluralS(std::string const& name) +{ + std::string strippedName(name); + size_t pos = strippedName.rfind('s'); + assert(pos != std::string::npos); + strippedName.erase(pos, 1); + return strippedName; +} + +std::vector tokenize(std::string tokenString, char separator) +{ + std::vector tokens; + size_t start = 0, end; + do + { + end = tokenString.find(separator, start); + tokens.push_back(tokenString.substr(start, end - start)); + start = end + 1; + } while (end != std::string::npos); + return tokens; +} + +std::string trim(std::string const& input) +{ + std::string result = input; + result.erase(result.begin(), std::find_if(result.begin(), result.end(), [](char c) { return !std::isspace(c); })); + result.erase(std::find_if(result.rbegin(), result.rend(), [](char c) { return !std::isspace(c); }).base(), result.end()); + return result; +} + +std::string trimEnd(std::string const& input) +{ + std::string result = input; + result.erase(std::find_if(result.rbegin(), result.rend(), [](char c) { return !std::isspace(c); }).base(), result.end()); + return result; +} + +std::string toCamelCase(std::string const& value) +{ + assert(!value.empty() && (isupper(value[0]) || isdigit(value[0]))); + std::string result; + result.reserve(value.size()); + result.push_back(value[0]); + for (size_t i = 1; i < value.size(); i++) + { + if (value[i] != '_') + { + if ((value[i - 1] == '_') || isdigit(value[i - 1])) + { + result.push_back(value[i]); + } + else + { + result.push_back(static_cast(tolower(value[i]))); + } + } + } + return result; +} + +std::string toUpperCase(std::string const& name) +{ + std::string convertedName; + + for (size_t i = 0; i(toupper(name[i]))); + } + return convertedName; +} + +void writeFunctionHeaderName(std::ostream & os, std::string const& name, bool singular, bool unique) +{ + os << (singular ? stripPluralS(name) : name); + if (unique) + { + os << "Unique"; + } +} + +void writeReinterpretCast(std::ostream & os, bool leadingConst, bool vulkanType, std::string const& type, bool trailingPointerToConst) +{ + os << "reinterpret_cast<"; + if (leadingConst) + { + os << "const "; + } + if (vulkanType) + { + os << "Vk"; + } + os << type; + if (trailingPointerToConst) + { + os << "* const"; + } + os << "*>"; +} + +void writeStandardOrEnhanced(std::ostream & os, std::string const& standard, std::string const& enhanced) +{ + if (standard == enhanced) + { + // standard and enhanced string are equal -> just use one of them and we're done + os << standard; + } + else + { + // standard and enhanced string differ -> use both, wrapping the enhanced by !VULKAN_HPP_DISABLE_ENHANCED_MODE + // determine the argument list of that standard, and compare it with that of the enhanced + // if they are equal -> need to have just one; if they differ -> need to have both + size_t standardStart = standard.find('('); + size_t standardCount = standard.find(')', standardStart) - standardStart; + size_t enhancedStart = enhanced.find('('); + bool unchangedInterface = (standard.substr(standardStart, standardCount) == enhanced.substr(enhancedStart, standardCount)); + if (unchangedInterface) + { + os << "#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE" << std::endl; + } + os << standard + << (unchangedInterface ? "#else" : "#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE") << std::endl + << enhanced + << "#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/" << std::endl; + } +} + +void writeTypesafeCheck(std::ostream & os, std::string const& typesafeCheck) +{ + os << "// 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default." << std::endl + << "// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION" << std::endl + << typesafeCheck << std::endl + << "# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )" << std::endl + << "# define VULKAN_HPP_TYPESAFE_CONVERSION" << std::endl + << "# endif" << std::endl + << "#endif" << std::endl; +} + +void writeVersionCheck(std::ostream & os, std::string const& version) +{ + os << "static_assert( VK_HEADER_VERSION == " << version << " , \"Wrong VK_HEADER_VERSION!\" );" << std::endl + << std::endl; +} + +#if !defined(NDEBUG) +void skipFeatureRequire(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, { { "name",{} } }); + checkElements(getChildElements(element), {}); +} + +void skipImplicitExternSyncParams(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); + std::vector children = getChildElements(element); + checkOrderedElements(children, { "param" }); + checkEmptyElement(children[0]); +} + +void skipTypeEnum(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "category",{ "enum" } } }, { { "alias", {} }, { "name",{} } }); + checkElements(getChildElements(element), {}); +} + +void skipTypeInclude(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), { { "category",{ "include" } } }, { { "name",{} } }); + std::vector children = getChildElements(element); + checkElements(children, { "name" }); + + for (auto child : children) + { + checkEmptyElement(child); + } +} +#endif + +template +void VulkanHppGenerator::checkAlias(std::map const& data, std::string const& name, int line) +{ + if (data.find(name) == data.end()) + { + std::stringstream ss; + ss << line; + std::string lineNumber = ss.str(); + + throw std::runtime_error("Spec error on line " + lineNumber + ": missing alias <" + name + ">"); + } +} + +bool VulkanHppGenerator::containsUnion(std::string const& type, std::map const& structs) +{ + // a simple recursive check if a type is or contains a union + std::map::const_iterator sit = structs.find(type); + bool found = (sit != structs.end()); + if (found) + { + found = sit->second.isUnion; + for (std::vector::const_iterator mit = sit->second.members.begin(); mit != sit->second.members.end() && !found; ++mit) + { + found = (mit->type == mit->pureType) && containsUnion(mit->type, structs); + } + } + return found; +} + +std::map VulkanHppGenerator::createDefaults() +{ + std::map defaultValues; + for (auto const& dependency : m_dependencies) + { + assert(defaultValues.find(dependency.name) == defaultValues.end()); + switch (dependency.category) + { + case DependencyData::Category::BITMASK: + case DependencyData::Category::HANDLE: + case DependencyData::Category::STRUCT: + case DependencyData::Category::UNION: // just call the default constructor for bitmasks, handles, structs, and unions (which are mapped to classes) + defaultValues[dependency.name] = dependency.name + "()"; + break; + case DependencyData::Category::COMMAND: // commands should never be asked for defaults + break; + case DependencyData::Category::ENUM: + assert(m_enums.find(dependency.name) != m_enums.end()); + setDefault(dependency.name, defaultValues, m_enums.find(dependency.name)->second); + break; + case DependencyData::Category::FUNC_POINTER: // func_pointers default to nullptr + defaultValues[dependency.name] = "nullptr"; + break; + case DependencyData::Category::REQUIRED: // all required default to "0" + case DependencyData::Category::SCALAR: // all scalars default to "0" + defaultValues[dependency.name] = "0"; + break; + default: + assert(false && "Unhandled exception category"); + break; + } + } + return defaultValues; +} + +void VulkanHppGenerator::determineEnhancedReturnType(CommandData & commandData) +{ + std::string returnType; + // if there is a return parameter of type void or Result, and if it's of type Result it either has just one success code + // or two success codes, where the second one is of type eIncomplete and it's a two-step process + // -> we can return that parameter + if ((commandData.returnParam != INVALID_INDEX) + && ((commandData.returnType == "void") + || ((commandData.returnType == "Result") + && ((commandData.successCodes.size() == 1) + || ((commandData.successCodes.size() == 2) + && (commandData.successCodes[1] == "eIncomplete") + && commandData.twoStep))))) + { + if (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end()) + { + // the return parameter is a vector-type parameter + if (commandData.params[commandData.returnParam].pureType == "void") + { + // for a vector of void, we use a vector of uint8_t, instead + commandData.enhancedReturnType = "std::vector"; + } + else + { + // for the other parameters, we use a vector of the pure type + commandData.enhancedReturnType = "std::vector<" + commandData.params[commandData.returnParam].pureType + ",Allocator>"; + } + } + else + { + // it's a simple parameter -> get the type and just remove the trailing '*' (originally, it's a pointer) + assert(commandData.params[commandData.returnParam].type.back() == '*'); + assert(commandData.params[commandData.returnParam].type.find("const") == std::string::npos); + commandData.enhancedReturnType = commandData.params[commandData.returnParam].type; + commandData.enhancedReturnType.pop_back(); + } + } + else if ((commandData.returnType == "Result") && (commandData.successCodes.size() == 1)) + { + // an original return of type "Result" with just one successCode is changed to void, errors throw an exception + commandData.enhancedReturnType = "void"; + } + else + { + // the return type just stays the original return type + commandData.enhancedReturnType = commandData.returnType; + } +} + +void VulkanHppGenerator::determineReducedName(CommandData & commandData) +{ + commandData.reducedName = commandData.fullName; + std::string searchName = commandData.params[0].pureType; + size_t pos = commandData.fullName.find(searchName); + if ((pos == std::string::npos) && isupper(searchName[0])) + { + searchName[0] = static_cast(tolower(searchName[0])); + pos = commandData.fullName.find(searchName); + } + if (pos != std::string::npos) + { + commandData.reducedName.erase(pos, searchName.length()); + } + else if ((searchName == "commandBuffer") && (commandData.fullName.find("cmd") == 0)) + { + commandData.reducedName.erase(0, 3); + pos = 0; + } + if ((pos == 0) && isupper(commandData.reducedName[0])) + { + commandData.reducedName[0] = static_cast(tolower(commandData.reducedName[0])); + } +} + +void VulkanHppGenerator::determineReturnParam(CommandData & commandData) +{ + // for return types of type Result or void, we can replace determine a parameter to return + if ((commandData.returnType == "Result") || (commandData.returnType == "void")) + { + for (size_t i = 0; i < commandData.params.size(); i++) + { + if ((commandData.params[i].type.find('*') != std::string::npos) + && (commandData.params[i].type.find("const") == std::string::npos) + && std::find_if(commandData.vectorParams.begin(), commandData.vectorParams.end(), [i](std::pair const& vp) { return vp.second == i; }) == commandData.vectorParams.end()) + { + // it's a non-const pointer and not a vector-size parameter + std::map::const_iterator vpit = commandData.vectorParams.find(i); + if ((vpit == commandData.vectorParams.end()) || commandData.twoStep || (commandData.vectorParams.size() > 1) || (vpit->second == INVALID_INDEX) || (commandData.params[vpit->second].type.find('*') != std::string::npos)) + { + // it's not a vector parameter, or a two-step process, or there is at least one more vector parameter, or the size argument of this vector parameter is not an argument, or the size argument of this vector parameter is provided by a pointer + // -> look for another non-cost pointer argument + auto paramIt = std::find_if(commandData.params.begin() + i + 1, commandData.params.end(), [](ParamData const& pd) + { + return (pd.type.find('*') != std::string::npos) && (pd.type.find("const") == std::string::npos); + }); + // if there is another such argument, we can't decide which one to return -> return INVALID_INDEX + // otherwise return the index of the selcted parameter + commandData.returnParam = paramIt != commandData.params.end() ? ~0 : i; + } + } + } + } +} + +void VulkanHppGenerator::determineSkippedParams(CommandData & commandData) +{ + // the size-parameters of vector parameters are not explicitly used in the enhanced API + std::for_each(commandData.vectorParams.begin(), commandData.vectorParams.end(), [&commandData](std::pair const& vp) { if (vp.second != INVALID_INDEX) commandData.skippedParams.insert(vp.second); }); + // and the return parameter is also skipped + if (commandData.returnParam != INVALID_INDEX) + { + commandData.skippedParams.insert(commandData.returnParam); + } +} + +void VulkanHppGenerator::determineTemplateParam(CommandData & commandData) +{ + for (size_t i = 0; i < commandData.params.size(); i++) + { + // any vector parameter on the pure type void is templatized in the enhanced API + if ((commandData.vectorParams.find(i) != commandData.vectorParams.end()) && (commandData.params[i].pureType == "void")) + { +#if !defined(NDEBUG) + for (size_t j = i + 1; j < commandData.params.size(); j++) + { + assert((commandData.vectorParams.find(j) == commandData.vectorParams.end()) || (commandData.params[j].pureType != "void")); + } +#endif + commandData.templateParam = i; + break; + } + } + assert((commandData.templateParam == INVALID_INDEX) || (commandData.vectorParams.find(commandData.templateParam) != commandData.vectorParams.end())); +} + +void VulkanHppGenerator::determineVectorParams(CommandData & commandData) +{ + // look for the parameters whose len equals the name of an other parameter + for (auto it = commandData.params.begin(), begin = it, end = commandData.params.end(); it != end; ++it) + { + if (!it->len.empty()) + { + auto findLambda = [it](ParamData const& pd) { return pd.name == it->len; }; + auto findIt = std::find_if(begin, it, findLambda); // look for a parameter named as the len of this parameter + assert((std::count_if(begin, end, findLambda) == 0) || (findIt < it)); // make sure, there is no other parameter like that + + // add this parameter as a vector parameter, using the len-name parameter as the second value (or INVALID_INDEX if there is nothing like that) + commandData.vectorParams.insert(std::make_pair(std::distance(begin, it), findIt < it ? std::distance(begin, findIt) : INVALID_INDEX)); + assert((commandData.vectorParams[std::distance(begin, it)] != INVALID_INDEX) + || (it->len == "null-terminated") + || (it->len == "pAllocateInfo::descriptorSetCount") + || (it->len == "pAllocateInfo::commandBufferCount")); + } + } +} + +std::string VulkanHppGenerator::generateCall(CommandData const& commandData, bool firstCall, bool singular) +{ + std::ostringstream call; + writeCall(call, commandData, firstCall, singular); + return call.str(); +} + +std::string const& VulkanHppGenerator::getTypesafeCheck() const +{ + return m_typesafeCheck; +} + +std::string const& VulkanHppGenerator::getVersion() const +{ + return m_version; +} + +std::string const& VulkanHppGenerator::getVulkanLicenseHeader() const +{ + return m_vulkanLicenseHeader; +} + +bool VulkanHppGenerator::isSubStruct(std::pair const& nsd, std::string const& name, StructData const& structData) +{ + if ((nsd.first != name) && (nsd.second.members.size() < structData.members.size()) && (structData.members[0].name != "sType")) + { + bool equal = true; + for (size_t i = 0; i < nsd.second.members.size() && equal; i++) + { + equal = (nsd.second.members[i].type == structData.members[i].type) && (nsd.second.members[i].name == structData.members[i].name); + } + if (equal) + { + return true; + } + } + return false; +} + +void VulkanHppGenerator::linkCommandToHandle(CommandData & commandData) +{ + // first, find the handle named like the type of the first argument + // if there is no such handle, look for the unnamed "handle", that gathers all the functions not tied to a specific handle + assert(!commandData.params.empty()); + std::map::iterator hit = m_handles.find(commandData.params[0].pureType); + if (hit == m_handles.end()) + { + hit = m_handles.find(""); + } + assert(hit != m_handles.end()); + + // put the command into the handle's list of commands, and store the handle in the commands className + hit->second.commands.push_back(commandData.fullName); + commandData.className = hit->first; + + // add the dependencies of the command to the dependencies of the handle + DependencyData const& commandDD = m_dependencies.back(); + std::list::iterator handleDD = std::find_if(m_dependencies.begin(), m_dependencies.end(), [hit](DependencyData const& dd) { return dd.name == hit->first; }); + assert((handleDD != m_dependencies.end()) || hit->first.empty()); + if (handleDD != m_dependencies.end()) + { + std::copy_if(commandDD.dependencies.begin(), commandDD.dependencies.end(), std::inserter(handleDD->dependencies, handleDD->dependencies.end()), [hit](std::string const& d) { return d != hit->first; }); + } +} + +bool VulkanHppGenerator::readCommandParam(tinyxml2::XMLElement const* element, std::set & dependencies, std::vector & params) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, { { "externsync",{} },{ "len",{} },{ "noautovalidity",{ "true" } },{ "optional",{ "false", "true" } } }); + checkElements(getChildElements(element), { "name", "type" }); + + ParamData param; + + bool isTwoStep = false; + auto lenAttribute = attributes.find("len"); + if (lenAttribute != attributes.end()) + { + param.len = lenAttribute->second; + auto pit = std::find_if(params.begin(), params.end(), [¶m](ParamData const& pd) { return param.len == pd.name; }); + if (pit != params.end()) + { + isTwoStep = (pit->type.find('*') != std::string::npos); + } + } + + // get the type of the parameter, and put it into the list of dependencies + tinyxml2::XMLNode const* child = readCommandParamType(element->FirstChild(), param); + dependencies.insert(param.pureType); + + assert(child->ToElement()); + tinyxml2::XMLElement const* nameElement = child->ToElement(); + checkEmptyElement(nameElement); + param.name = child->ToElement()->GetText(); + + param.arraySize = readArraySize(child, param.name); + + auto optionalAttribute = attributes.find("optional"); + param.optional = (optionalAttribute != attributes.end()) && (optionalAttribute->second == "true"); + + params.push_back(param); + + assert(!isTwoStep || (param.type.substr(0, 6) != "const ")); + return isTwoStep; +} + +tinyxml2::XMLNode const* VulkanHppGenerator::readCommandParamType(tinyxml2::XMLNode const* node, ParamData& param) +{ + assert(node); + if (node->ToText()) + { + // start type with "const" or "struct", if needed + std::string value = trim(node->Value()); + assert((value == "const") || (value == "struct") || (value == "const struct")); + param.type = value + " "; + node = node->NextSibling(); + assert(node); + } + + // get the pure type + assert(node->ToElement()); + tinyxml2::XMLElement const* typeElement = node->ToElement(); + checkEmptyElement(typeElement); + std::string type = strip(node->ToElement()->GetText(), "Vk"); + param.unchangedType = param.type + node->ToElement()->GetText(); + param.type += type; + param.pureType = type; + + // end with "*", "**", or "* const*", if needed + node = node->NextSibling(); + assert(node); + if (node->ToText()) + { + std::string value = trimEnd(node->Value()); + assert((value == "*") || (value == "**") || (value == "* const*")); + param.type += value; + param.unchangedType += value; + node = node->NextSibling(); + } + + return node; +} + +void VulkanHppGenerator::readCommands(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, { { "comment",{} } }); + std::vector children = getChildElements(element); + checkElements(children, { "command" }); + + for (auto child : children) + { + readCommandsCommand(child); + } +} + +void VulkanHppGenerator::readCommandsCommand(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, + { { "alias", {} }, + { "cmdbufferlevel",{ "primary", "secondary" } }, + { "comment",{} }, + { "errorcodes",{} }, + { "name", {} }, + { "pipeline",{ "compute", "graphics", "transfer" } }, + { "queues",{ "compute", "graphics", "sparse_binding", "transfer" } }, + { "renderpass",{ "both", "inside", "outside" } }, + { "successcodes",{} } + }); + std::vector children = getChildElements(element); + + CommandData commandData; + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + // for command aliases, create a copy of the aliased command + checkAttributes(attributes, element->GetLineNum(), { { "alias",{} },{ "name",{} } }, {}); // re-check on alias type! + checkElements(children, {}); + + std::string alias = startLowerCase(strip(aliasIt->second, "vk")); + checkAlias(m_commands, alias, element->GetLineNum()); + + auto commandsIt = m_commands.find(alias); + assert(commandsIt != m_commands.end()); + commandData = commandsIt->second; + commandData.fullName = startLowerCase(strip(attributes.find("name")->second, "vk")); + commandData.isAlias = true; + determineReducedName(commandData); + linkCommandToHandle(commandData); + + // add a DependencyData to this name + m_dependencies.push_back(DependencyData(DependencyData::Category::COMMAND, commandData.fullName)); + m_dependencies.back().dependencies.insert(alias); + } + else + { + checkElements(children, { "implicitexternsyncparams", "param", "proto" }); + + // read the success codes + auto successcodesAttribute = attributes.find("successcodes"); + if (successcodesAttribute != attributes.end()) + { + commandData.successCodes = tokenize(successcodesAttribute->second, ','); + for (auto & code : commandData.successCodes) + { + std::string tag = findTag(code, m_tags); + // on each success code: prepend 'e', strip "VK_" and a tag, convert it to camel case, and add the tag again + code = std::string("e") + toCamelCase(strip(code, "VK_", tag)) + tag; + } + } + + for (auto child : children) + { + std::string value = child->Value(); + if (value == "param") + { + commandData.twoStep |= readCommandParam(child, m_dependencies.back().dependencies, commandData.params); + } + else if (value == "proto") + { + readCommandProto(child, commandData.returnType, commandData.unchangedReturnType, commandData.fullName); + } +#if !defined(NDEBUG) + else + { + assert(value == "implicitexternsyncparams"); + skipImplicitExternSyncParams(child); + } +#endif + } + + determineReducedName(commandData); + linkCommandToHandle(commandData); + registerDeleter(commandData); + determineVectorParams(commandData); + determineReturnParam(commandData); + determineTemplateParam(commandData); + determineEnhancedReturnType(commandData); + determineSkippedParams(commandData); + } + + // insert the commandData into the commands-map, + assert(m_commands.find(commandData.fullName) == m_commands.end()); + m_commands.insert(std::make_pair(commandData.fullName, commandData)); +} + +void VulkanHppGenerator::readCommandProto(tinyxml2::XMLElement const* element, std::string & returnType, std::string & unchangedReturnType, std::string & fullName) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); + std::vector children = getChildElements(element); + checkOrderedElements(children, { "type", "name" }); + + // get return type and name of the command + returnType = strip(children[0]->GetText(), "Vk"); + unchangedReturnType = children[0]->GetText(); + fullName = startLowerCase(strip(children[1]->GetText(), "vk")); + + // add an empty DependencyData to this name + m_dependencies.push_back(DependencyData(DependencyData::Category::COMMAND, fullName)); +} + +void VulkanHppGenerator::readComment(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); + checkElements(getChildElements(element), {}); + + assert(element->GetText()); + std::string text = element->GetText(); + if (text.find("\nCopyright") == 0) + { + assert(m_vulkanLicenseHeader.empty()); + m_vulkanLicenseHeader = text; + + // erase the part after the Copyright text + size_t pos = m_vulkanLicenseHeader.find("\n\n------------------------------------------------------------------------"); + if (pos != std::string::npos) { + m_vulkanLicenseHeader.erase(pos); + } + + // replace any '\n' with "\n// " + for (pos = m_vulkanLicenseHeader.find('\n'); pos != std::string::npos; pos = m_vulkanLicenseHeader.find('\n', pos + 1)) + { + m_vulkanLicenseHeader.replace(pos, 1, "\n// "); + } + + // and add a little message on our own + m_vulkanLicenseHeader += "\n\n// This header is generated from the Khronos Vulkan XML API Registry."; + } + + m_vulkanLicenseHeader.erase(m_vulkanLicenseHeader.begin(), std::find_if(m_vulkanLicenseHeader.begin(), m_vulkanLicenseHeader.end(), [](char c) { return !std::isspace(c); })); +} + +void VulkanHppGenerator::readDisabledExtensionRequire(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), {}, {}); + std::vector children = getChildElements(element); + checkElements(children, { "command", "enum", "type" }); + + for (auto child : children) + { + checkElements(getChildElements(child), {}); + + std::string value = child->Value(); + if ((value == "command") || (value == "type")) + { + std::map attributes = getAttributes(child); + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, {}); + + // disable a command or a type ! + auto nameAttribute = attributes.find("name"); + std::string name = (value == "command") ? startLowerCase(strip(nameAttribute->second, "vk")) : strip(nameAttribute->second, "Vk"); + + // search this name in the dependencies list and remove it + std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&name](DependencyData const& dd) { return(dd.name == name); }); + assert(depIt != m_dependencies.end()); + m_dependencies.erase(depIt); + + // erase it from all dependency sets + for (auto & dep : m_dependencies) + { + dep.dependencies.erase(name); + } + + if (value == "command") + { + // first unlink the command from its class + auto commandsIt = m_commands.find(name); + assert(commandsIt != m_commands.end()); + assert(!commandsIt->second.className.empty()); + auto handlesIt = m_handles.find(commandsIt->second.className); + assert(handlesIt != m_handles.end()); + auto it = std::find(handlesIt->second.commands.begin(), handlesIt->second.commands.end(), name); + assert(it != handlesIt->second.commands.end()); + handlesIt->second.commands.erase(it); + + // then remove the command + m_commands.erase(name); + } + else + { + // a type simply needs to be removed from the structs and vkTypes sets + assert((m_structs.find(name) != m_structs.end()) && (m_vkTypes.find(name) != m_vkTypes.end())); + m_structs.erase(name); + m_vkTypes.erase(name); + } + } + else + { + assert(value == "enum"); + std::map attributes = getAttributes(child); + checkAttributes(attributes, child->GetLineNum(), { { "name",{} } }, { { "bitpos", {} }, { "extends",{} },{ "offset",{} },{ "value",{} } }); + } + } +} + +void VulkanHppGenerator::readEnums(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { { "comment",{} },{ "type",{ "bitmask", "enum" } } }); + std::vector children = getChildElements(element); + checkElements(children, { "comment", "enum", "unused" }); + + std::string name = strip(attributes.find("name")->second, "Vk"); + + if (name == "API Constants") + { + for (auto child : children) + { + assert(strcmp(child->Value(), "enum") == 0); + readEnumsConstant(child); + } + } + else + { + checkAttributes(attributes, element->GetLineNum(), { { "name",{} },{ "type",{ "bitmask", "enum" } } }, { { "comment",{} } }); // re-check with type as required + + if (std::find_if(m_dependencies.begin(), m_dependencies.end(), [&name](DependencyData const& dd) { return dd.name == name; }) == m_dependencies.end()) + { + // add an empty DependencyData on this name into the dependencies list + m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, name)); + + // add this enum to the set of Vulkan data types + assert(m_vkTypes.find(name) == m_vkTypes.end()); + m_vkTypes.insert(name); + } + + // ad an empty EnumData on this name into the enums map + std::map::iterator it = m_enums.insert(std::make_pair(name, EnumData(name))).first; + assert(it->second.postfix.empty() && it->second.prefix.empty() && it->second.protect.empty() && it->second.values.empty()); + + if (name == "Result") + { + // special handling for VKResult, as its enums just have VK_ in common + it->second.prefix = "VK_"; + } + else + { + std::string type = attributes.find("type")->second; + it->second.bitmask = (type == "bitmask"); + if (it->second.bitmask) + { + // for a bitmask enum, start with "VK", cut off the trailing "FlagBits", and convert that name to upper case + // end that with "Bit" + size_t pos = name.find("FlagBits"); + assert(pos != std::string::npos); + it->second.prefix = "VK" + toUpperCase(name.substr(0, pos)) + "_"; + } + else + { + // for a non-bitmask enum, start with "VK", and convert the name to upper case + it->second.prefix = "VK" + toUpperCase(name) + "_"; + } + + // if the enum name contains a tag move it from the prefix to the postfix to generate correct enum value names. + for (std::set::const_iterator tit = m_tags.begin(); tit != m_tags.end(); ++tit) + { + if ((tit->length() < it->second.prefix.length()) && (it->second.prefix.substr(it->second.prefix.length() - tit->length() - 1) == (*tit + "_"))) + { + it->second.prefix.erase(it->second.prefix.length() - tit->length() - 1); + it->second.postfix = "_" + *tit; + break; + } + else if ((tit->length() < it->second.name.length()) && (it->second.name.substr(it->second.name.length() - tit->length()) == *tit)) + { + it->second.postfix = "_" + *tit; + break; + } + } + } + + // read the names of the enum values + for (auto child : children) + { + std::string value = child->Value(); + if (value == "enum") + { + readEnumsEnum(child, it->second, ""); + } +#if !defined(NDEBUG) + else + { + assert((value == "comment") || (value == "unused")); + } +#endif + } + } +} + +void VulkanHppGenerator::readEnumsEnum(tinyxml2::XMLElement const* element, EnumData & enumData, std::string const& tag) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { {"alias", {} }, { "bitpos",{} },{ "comment",{} },{ "value",{} } }); + assert((attributes.find("alias") != attributes.end()) + (attributes.find("bitpos") != attributes.end()) + (attributes.find("value") != attributes.end()) == 1); + checkElements(getChildElements(element), {}); + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + auto enumIt = std::find_if(enumData.values.begin(), enumData.values.end(), [&aliasIt](EnumValueData const& evd) { return evd.value == aliasIt->second; }); + assert((enumIt != enumData.values.end()) && enumIt->alias.empty()); + enumIt->alias = createEnumValueName(attributes.find("name")->second, enumData.prefix, enumData.postfix, enumData.bitmask, tag); + } + else + { + enumData.addEnumValue(attributes.find("name")->second, tag, m_nameMap); + } +} + +void VulkanHppGenerator::readEnumsConstant(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { { "alias", {}}, { "comment",{} }, { "value",{} } }); + checkElements(getChildElements(element), {}); + std::string name = attributes.find("name")->second; + assert(m_constants.find(name) == m_constants.end()); + + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + checkAttributes(attributes, element->GetLineNum(), { {"alias", {}}, { "name", {}} }, {}); // re-check on alias type + checkAlias(m_constants, aliasIt->second, element->GetLineNum()); + m_constants[name] = m_constants.find(aliasIt->second)->second; + } + else + { + checkAttributes(attributes, element->GetLineNum(), { { "name",{} }, { "value", {}} }, { {"comment", {} } }); // re-check on non-alias type + m_constants[name] = attributes.find("value")->second; + } +} + +void VulkanHppGenerator::readExtensionCommand(tinyxml2::XMLElement const* element, std::string const& protect) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, {}); + checkElements(getChildElements(element), {}); + + // just add the protect string to the CommandData + if (!protect.empty()) + { + std::string name = startLowerCase(strip(attributes.find("name")->second, "vk")); + std::map::iterator cit = m_commands.find(name); + assert(cit != m_commands.end()); + cit->second.protect = protect; + } +} + +void VulkanHppGenerator::readExtensionEnum(tinyxml2::XMLElement const* element, std::string const& tag) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), + { + { "name", {} } + }, + { + { "alias", {} }, + { "bitpos", {} }, + { "comment", {} }, + { "dir", { "-" } }, + { "extends", {} }, + { "extnumber", {} }, + { "offset", {} }, + { "value", {} } + }); + checkElements(getChildElements(element), {}); + + // TODO process enums which don't extend existing enums + auto extendsIt = attributes.find("extends"); + if (extendsIt != attributes.end()) + { + std::string extends = strip(extendsIt->second, "Vk"); + auto enumIt = m_enums.find(extends); + assert(enumIt != m_enums.end()); + + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + checkAttributes(attributes, element->GetLineNum(), { { "alias", {} }, { "extends", {} }, { "name", {} } }, { { "comment",{} } }); + std::string alias = createEnumValueName(aliasIt->second, enumIt->second.prefix, enumIt->second.postfix, enumIt->second.bitmask, tag); + auto evdIt = std::find_if(enumIt->second.values.begin(), enumIt->second.values.end(), [&alias](EnumValueData const& evd) { return evd.name == alias; }); + assert(evdIt != enumIt->second.values.end()); + evdIt->alias = createEnumValueName(attributes.find("name")->second, enumIt->second.prefix, enumIt->second.postfix, enumIt->second.bitmask, tag); + if (evdIt->name == evdIt->alias) + { + // skip alias, that would result in the very same enum name + evdIt->alias.clear(); + } + } + else + { + assert((attributes.find("bitpos") != attributes.end()) + (attributes.find("offset") != attributes.end()) + (attributes.find("value") != attributes.end()) == 1); + enumIt->second.addEnumValue(attributes.find("name")->second, tag, m_nameMap); + } + } +} + +void VulkanHppGenerator::readExtensionRequire(tinyxml2::XMLElement const* element, std::string const& protect, std::string const& tag) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, { { "extension",{} },{ "feature",{} } }); + std::vector children = getChildElements(element); + checkElements(children, { "command", "comment", "enum", "type" }); + + for (auto child : children) + { + std::string value = child->Value(); + + if (value == "command") + { + readExtensionCommand(child, protect); + } + else if (value == "enum") + { + readExtensionEnum(child, tag); + } + else if (value == "type") + { + readExtensionType(child, protect); + } +#if !defined(NDEBUG) + else + { + assert(value == "comment"); + checkEmptyElement(child); + } +#endif + } +} + +void VulkanHppGenerator::readExtensions(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "comment",{} } }, {}); + std::vector children = getChildElements(element); + checkElements(children, { "extension" }); + + for (auto child : children) + { + readExtensionsExtension(child); + } +} + +void VulkanHppGenerator::readExtensionsExtension(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), + { + { "name",{} }, + { "number",{} }, + { "supported",{ "disabled", "vulkan" } } + }, + { + { "author",{} }, + { "comment", {} }, + { "contact",{} }, + { "deprecatedby", {} }, + { "obsoletedby", {} }, + { "platform",{} }, + { "promotedto", {} }, + { "provisional", {} }, + { "protect",{} }, + { "requires",{} }, + { "requiresCore",{} }, + { "type",{ "device", "instance" } } + }); + std::vector children = getChildElements(element); + checkElements(children, { "require" }); + + if (attributes.find("supported")->second == "disabled") + { + // kick out all the disabled stuff we've read before !! + for (tinyxml2::XMLElement const* child = element->FirstChildElement(); child; child = child->NextSiblingElement()) + { + assert(strcmp(child->Value(), "require") == 0); + readDisabledExtensionRequire(child); + } + } + else + { + std::string name = attributes.find("name")->second; + std::string tag = extractTag(name); + assert(m_tags.find(tag) != m_tags.end()); + + auto protectAttribute = attributes.find("protect"); + auto platformAttribute = attributes.find("platform"); + std::string protect; + if (protectAttribute != attributes.end()) + { + protect = protectAttribute->second; + } + else if (platformAttribute != attributes.end()) + { + auto authorAttribute = attributes.find("author"); + assert(authorAttribute != attributes.end()); + protect = "VK_USE_PLATFORM_" + toUpperCase(platformAttribute->second) + "_" + authorAttribute->second; + } + +#if !defined(NDEBUG) + assert(m_extensions.find(name) == m_extensions.end()); + ExtensionData & extension = m_extensions.insert(std::make_pair(name, ExtensionData())).first->second; + extension.protect = protect; + auto requiresAttribute = attributes.find("requires"); + if (requiresAttribute != attributes.end()) + { + extension.requires = tokenize(requiresAttribute->second, ','); + } +#endif + + for (auto child : children) + { + readExtensionRequire(child, protect, tag); + } + } +} + +void VulkanHppGenerator::readExtensionType(tinyxml2::XMLElement const* element, std::string const& protect) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, {}); + checkElements(getChildElements(element), {}); + + // add the protect-string to the appropriate type: enum, flag, handle, scalar, or struct + if (!protect.empty()) + { + std::string name = strip(attributes.find("name")->second, "Vk"); + std::map::iterator bitmasksIt = m_bitmasks.find(name); + if (bitmasksIt != m_bitmasks.end()) + { + bitmasksIt->second.protect = protect; + + // if the enum of this flags is auto-generated, protect it as well + std::string enumName = generateEnumNameForFlags(name); + std::map::iterator enumsIt = m_enums.find(enumName); + assert(enumsIt != m_enums.end()); + if (enumsIt->second.values.empty()) + { + enumsIt->second.protect = protect; + } + } + else + { + std::map::iterator eit = m_enums.find(name); + if (eit != m_enums.end()) + { + eit->second.protect = protect; + } + else + { + std::map::iterator hait = m_handles.find(name); + if (hait != m_handles.end()) + { + hait->second.protect = protect; + } + else + { + std::map::iterator scit = m_scalars.find(name); + if (scit != m_scalars.end()) + { + scit->second.protect = protect; + } + else + { + std::map::iterator stit = m_structs.find(name); + if (stit != m_structs.end()) + { + stit->second.protect = protect; + } + else + { + assert(m_defines.find(name) != m_defines.end()); + } + } + } + } + } + } +} + +void VulkanHppGenerator::readFeature(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "api",{ "vulkan" } },{ "comment",{} },{ "name",{} },{ "number",{} } }, {}); + std::vector children = getChildElements(element); + checkElements(children, { "require" }); + + for (auto child : children) + { + readFeatureRequire(child); + } +} + +void VulkanHppGenerator::readFeatureRequire(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, { { "comment",{} } }); + std::vector children = getChildElements(element); + checkElements(children, { "command", "comment", "enum", "type" }); + + for (auto child : children) + { + std::string value = child->Value(); + if (value == "enum") + { + readFeatureRequireEnum(child); + } +#if !defined(NDEBUG) + else + { + assert((value == "command") || (value == "comment") || (value == "type")); + skipFeatureRequire(child); + } +#endif + } +} + +void VulkanHppGenerator::readFeatureRequireEnum(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), + { + { "name",{} } + }, + { + { "bitpos",{} }, + { "comment",{} }, + { "dir", { "-" } }, + { "extends",{} }, + { "extnumber", {} }, + { "offset", {} }, + { "value",{} } + }); + checkElements(getChildElements(element), {}); + + auto extendsAttribute = attributes.find("extends"); + if (extendsAttribute != attributes.end()) + { + assert(strncmp(extendsAttribute->second.c_str(), "Vk", 2) == 0); + std::string extends = strip(extendsAttribute->second, "Vk"); + auto enumIt = m_enums.find(extends); + assert(enumIt != m_enums.end()); + enumIt->second.addEnumValue(attributes.find("name")->second, "", m_nameMap); + } +} + +void VulkanHppGenerator::readTags(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), { { "comment",{} } }, {}); + std::vector children = getChildElements(element); + checkElements(children, { "tag" }); + + for (auto child : children) + { + std::string value = child->Value(); + assert(value == "tag"); + readTag(child); + } +} + +void VulkanHppGenerator::readTag(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "author",{} },{ "contact",{} },{ "name",{} } }, {}); + checkElements(getChildElements(element), {}); + + for (auto const& attribute : attributes) + { + std::string name = attribute.first; + if (name == "name") + { + std::string value = attribute.second; + m_tags.insert(value); + } + else + { + assert((name == "author") || (name == "contact")); + } + } +} + +void VulkanHppGenerator::readType(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + + auto categoryIt = attributes.find("category"); + if (categoryIt != attributes.end()) + { + if (categoryIt->second == "basetype") + { + readTypeBasetype(element, attributes); + } + else if (categoryIt->second == "bitmask") + { + readTypeBitmask(element, attributes); + } + else if (categoryIt->second == "define") + { + readTypeDefine(element, attributes); + } + else if (categoryIt->second == "funcpointer") + { + readTypeFuncpointer(element, attributes); + } + else if (categoryIt->second == "handle") + { + readTypeHandle(element, attributes); + } + else if (categoryIt->second == "struct") + { + readTypeStruct(element, false, attributes); + } + else if (categoryIt->second == "union") + { + readTypeStruct(element, true, attributes); + } +#if !defined(NDEBUG) + else if (categoryIt->second == "enum") + { + skipTypeEnum(element, attributes); + } + else if (categoryIt->second == "include") + { + skipTypeInclude(element); + } + else +#else + else if ((categoryIt->second != "enum") && (categoryIt->second != "include")) +#endif + { + std::stringstream ss; + ss << element->GetLineNum(); + std::string lineNumber = ss.str(); + + throw std::runtime_error("Spec error on line " + lineNumber + ": unknown category <" + categoryIt->second + ">"); + } + } + else + { + assert(attributes.find("name") != attributes.end()); + readTypeName(element, attributes); + } +} + +void VulkanHppGenerator::readTypeBasetype(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "category",{ "basetype" } } }, {}); + std::vector children = getChildElements(element); + checkOrderedElements(children, { "type", "name" }); + checkEmptyElement(children[0]); + checkEmptyElement(children[1]); + + std::string type = children[0]->GetText(); + assert((type == "uint32_t") || (type == "uint64_t")); + + std::string name = strip(children[1]->GetText(), "Vk"); + + // skip "Flags", + if (name != "Flags") + { + m_dependencies.push_back(DependencyData(DependencyData::Category::SCALAR, name)); + m_dependencies.back().dependencies.insert(type); + } + else + { + assert(type == "uint32_t"); + } +} + +void VulkanHppGenerator::readTypeBitmask(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "category", { "bitmask" } } }, { { "alias", {} }, { "name", {}}, { "requires", {} } }); + std::vector children = getChildElements(element); + + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + checkAttributes(attributes, element->GetLineNum(), { { "alias", {} }, { "category", {"bitmask"} }, { "name", {} } }, {}); // re-check on alias type! + checkElements(children, {}); + + std::string alias = strip(aliasIt->second, "Vk"); + checkAlias(m_bitmasks, alias, element->GetLineNum()); + + std::string name = strip(attributes.find("name")->second, "Vk"); + + auto bitmasksIt = m_bitmasks.find(alias); + assert((bitmasksIt != m_bitmasks.end()) && bitmasksIt->second.alias.empty()); + bitmasksIt->second.alias = name; + } + else + { + checkOrderedElements(children, { "type", "name" }); + checkEmptyElement(children[0]); + checkEmptyElement(children[1]); + + assert(strcmp(children[0]->GetText(), "VkFlags") == 0); + + std::string name = strip(children[1]->GetText(), "Vk"); + + std::string requires; + auto requiresIt = attributes.find("requires"); + if (requiresIt != attributes.end()) + { + requires = strip(requiresIt->second, "Vk"); + } + else + { + // Generate FlagBits name, add a DependencyData for that name, and add it to the list of enums and vulkan types + requires = generateEnumNameForFlags(name); + assert(std::find_if(m_dependencies.begin(), m_dependencies.end(), [&requires](DependencyData const& dd) { return dd.name == requires; }) == m_dependencies.end()); + m_dependencies.push_back(DependencyData(DependencyData::Category::ENUM, requires)); + assert(m_enums.find(requires) == m_enums.end()); + m_enums.insert(std::make_pair(requires, EnumData(requires, true))); + assert(m_vkTypes.find(requires) == m_vkTypes.end()); + m_vkTypes.insert(requires); + } + + // add a DependencyData for the bitmask name, with the required type as its first dependency + m_dependencies.push_back(DependencyData(DependencyData::Category::BITMASK, name)); + m_dependencies.back().dependencies.insert(requires); + + m_bitmasks.insert(std::make_pair(name, BitmaskData())); + + assert(m_vkTypes.find(name) == m_vkTypes.end()); + m_vkTypes.insert(name); + } +} + +void VulkanHppGenerator::readTypeDefine(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "category",{ "define" } } }, { { "name",{} } }); + + auto nameIt = attributes.find("name"); + if (nameIt != attributes.end()) + { + assert(!element->FirstChildElement()); + assert(nameIt->second == "VK_DEFINE_NON_DISPATCHABLE_HANDLE"); + + // filter out the check for the different types of VK_DEFINE_NON_DISPATCHABLE_HANDLE + std::string text = element->LastChild()->ToText()->Value(); + size_t start = text.find("#if defined(__LP64__)"); + size_t end = text.find_first_of("\r\n", start + 1); + m_typesafeCheck = text.substr(start, end - start); + } + else if (element->GetText() && (trim(element->GetText()) == "struct")) + { + tinyxml2::XMLElement const* child = element->FirstChildElement(); + assert(child && (strcmp(child->Value(), "name") == 0) && child->GetText()); + m_defines.insert(child->GetText()); + m_dependencies.push_back(DependencyData(DependencyData::Category::REQUIRED, child->GetText())); + } + else + { + tinyxml2::XMLElement const* child = element->FirstChildElement(); + assert(child && !child->FirstAttribute() && (strcmp(child->Value(), "name") == 0) && child->GetText()); + std::string text = trim(child->GetText()); + if (text == "VK_HEADER_VERSION") + { + m_version = trimEnd(element->LastChild()->ToText()->Value()); + } + // ignore all the other defines + assert(!child->NextSiblingElement() || (child->NextSiblingElement() && !child->NextSiblingElement()->FirstAttribute() && (strcmp(child->NextSiblingElement()->Value(), "type") == 0) && !child->NextSiblingElement()->NextSiblingElement())); + } +} + +void VulkanHppGenerator::readTypeFuncpointer(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "category",{ "funcpointer" } } }, { { "requires",{} } }); + std::vector children = getChildElements(element); + checkElements(children, { "name", "type" }); + assert(!children.empty()); + checkEmptyElement(children[0]); + + assert((strcmp(children[0]->Value(), "name") == 0) && children[0]->GetText()); + m_dependencies.push_back(DependencyData(DependencyData::Category::FUNC_POINTER, children[0]->GetText())); + +#if !defined(NDEBUG) + for (size_t i = 1; i < children.size(); i++) + { + checkEmptyElement(children[i]); + } +#endif +} + +void VulkanHppGenerator::readTypeHandle(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "category",{ "handle" } } }, { { "alias",{} }, { "name",{} }, { "parent",{} } }); + std::vector children = getChildElements(element); + + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + checkAttributes(attributes, element->GetLineNum(), { { "alias",{} },{ "category",{ "handle" } },{ "name",{} } }, {}); // re-check on alias type! + checkElements(children, {}); + + std::string alias = strip(aliasIt->second, "Vk"); + checkAlias(m_handles, alias, element->GetLineNum()); + + std::string name = strip(attributes.find("name")->second, "Vk"); + + auto handlesIt = m_handles.find(alias); + assert((handlesIt != m_handles.end()) && handlesIt->second.alias.empty()); + handlesIt->second.alias = name; + } + else + { + checkOrderedElements(children, { "type", "name" }); + checkEmptyElement(children[0]); + checkEmptyElement(children[1]); + +#if !defined(NDEBUG) + std::string type = children[0]->GetText(); + assert((type.find("VK_DEFINE_HANDLE") == 0) || (type.find("VK_DEFINE_NON_DISPATCHABLE_HANDLE") == 0)); +#endif + + std::string name = strip(children[1]->GetText(), "Vk"); + + m_dependencies.push_back(DependencyData(DependencyData::Category::HANDLE, name)); + + assert(m_vkTypes.find(name) == m_vkTypes.end()); + m_vkTypes.insert(name); + assert(m_handles.find(name) == m_handles.end()); + m_handles.insert(std::make_pair(name, HandleData())); + } +} + +void VulkanHppGenerator::readTypeName(tinyxml2::XMLElement const* element, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), { { "name",{} } }, { { "requires",{} } }); + checkElements(getChildElements(element), {}); + + auto nameIt = attributes.find("name"); + assert(nameIt != attributes.end()); + m_dependencies.push_back(DependencyData(DependencyData::Category::REQUIRED, nameIt->second)); +} + +void VulkanHppGenerator::readTypes(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), { { "comment",{} } }, {}); + std::vector children = getChildElements(element); + checkElements(children, { "comment", "type" }); + + for (auto child : children) + { + std::string value = child->Value(); + if (value == "type") + { + readType(child); + } +#if !defined(NDEBUG) + else + { + assert(value == "comment"); + checkEmptyElement(child); + } +#endif + } +} + +void VulkanHppGenerator::readTypeStruct(tinyxml2::XMLElement const* element, bool isUnion, std::map const& attributes) +{ + checkAttributes(attributes, element->GetLineNum(), + { + { "category",{ isUnion ? "union" : "struct" } }, + { "name",{} } + }, + { + { "alias", {} }, + { "comment",{} }, + { "returnedonly",{ "true" } }, + { "structextends",{} } + }); + std::vector children = getChildElements(element); + checkElements(children, { "comment", "member" }); + + std::string name = strip(attributes.find("name")->second, "Vk"); + + auto aliasIt = attributes.find("alias"); + if (aliasIt != attributes.end()) + { + checkAttributes(attributes, element->GetLineNum(), { { "alias", {}}, {"category", {"struct"}}, { "name", {}} }, {}); // re-check on alias type! + + std::string alias = strip(aliasIt->second, "Vk"); + checkAlias(m_structs, alias, element->GetLineNum()); + + auto structsIt = m_structs.find(alias); + assert((structsIt != m_structs.end()) && structsIt->second.alias.empty()); + structsIt->second.alias = name; + } + else + { + m_dependencies.push_back(DependencyData(isUnion ? DependencyData::Category::UNION : DependencyData::Category::STRUCT, name)); + + assert(m_structs.find(name) == m_structs.end()); + std::map::iterator it = m_structs.insert(std::make_pair(name, StructData())).first; + it->second.returnedOnly = (attributes.find("returnedonly") != attributes.end()); + it->second.isUnion = isUnion; + + auto attributesIt = attributes.find("structextends"); + if (attributesIt != attributes.end()) + { + std::vector structExtends = tokenize(attributesIt->second, ','); + for (auto const& s : structExtends) + { + assert(s.substr(0, 2) == "Vk"); + std::string strippedName = s.substr(2); + it->second.structExtends.push_back(strippedName); + m_extendedStructs.insert(strippedName); + } + assert(!it->second.structExtends.empty()); + } + + for (auto child : children) + { + assert(child->Value()); + std::string value = child->Value(); + if (value == "member") + { + readTypeStructMember(child, it->second); + } +#if !defined(NDEBUG) + else + { + assert(value == "comment"); + checkEmptyElement(child); + } +#endif + } + + for (auto const& s : m_structs) + { + if (isSubStruct(s, name, it->second)) + { + it->second.subStruct = s.first; + break; // just take the very first candidate as a subStruct, skip any possible others! + } + } + } + + assert(m_vkTypes.find(name) == m_vkTypes.end()); + m_vkTypes.insert(name); +} + +void VulkanHppGenerator::readTypeStructMember(tinyxml2::XMLElement const* element, StructData & structData) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), {}, + { + { "altlen",{} }, + { "externsync",{ "true" } }, + { "len",{} }, + { "noautovalidity",{ "true" } }, + { "optional",{ "false", "true" } }, + { "values",{} } + }); + std::vector children = getChildElements(element); + checkElements(children, { "comment", "enum", "name", "type" }); + for (auto child : children) + { + checkEmptyElement(child); + } + + structData.members.push_back(MemberData()); + MemberData & member = structData.members.back(); + + auto valuesAttribute = attributes.find("values"); + if (valuesAttribute != attributes.end()) + { + member.values = valuesAttribute->second; + } + + tinyxml2::XMLNode const* child = element->FirstChild(); + assert(child); + if (child->ToText()) + { + std::string value = trim(child->Value()); + assert((value == "const") || (value == "struct") || value == "const struct"); + member.type = value + " "; + child = child->NextSibling(); + assert(child); + } + + assert(child->ToElement()); + tinyxml2::XMLElement const* typeElement = child->ToElement(); + assert((strcmp(typeElement->Value(), "type") == 0) && typeElement->GetText()); + member.pureType = strip(typeElement->GetText(), "Vk"); + member.type += member.pureType; + + child = typeElement->NextSibling(); + assert(child); + if (child->ToText()) + { + std::string value = trimEnd(child->Value()); + assert((value == "*") || (value == "**") || (value == "* const*")); + member.type += value; + child = child->NextSibling(); + } + + m_dependencies.back().dependencies.insert(member.pureType); + + assert(child->ToElement()); + tinyxml2::XMLElement const* nameElement = child->ToElement(); + assert((strcmp(nameElement->Value(), "name") == 0) && nameElement->GetText()); + member.name = nameElement->GetText(); + + member.arraySize = readArraySize(nameElement, member.name); +} + +void VulkanHppGenerator::registerDeleter(CommandData const& commandData) +{ + if ((commandData.fullName.substr(0, 7) == "destroy") || (commandData.fullName.substr(0, 4) == "free")) + { + std::string key; + size_t valueIndex; + switch (commandData.params.size()) + { + case 2: + case 3: + assert(commandData.params.back().pureType == "AllocationCallbacks"); + key = (commandData.params.size() == 2) ? "" : commandData.params[0].pureType; + valueIndex = commandData.params.size() - 2; + break; + case 4: + key = commandData.params[0].pureType; + valueIndex = 3; + assert(m_deleters.find(commandData.params[valueIndex].pureType) == m_deleters.end()); + m_deleters[commandData.params[valueIndex].pureType].pool = commandData.params[1].pureType; + break; + default: + assert(false); + valueIndex = 0; + } + assert(m_deleterTypes[key].find(commandData.params[valueIndex].pureType) == m_deleterTypes[key].end()); + m_deleterTypes[key].insert(commandData.params[valueIndex].pureType); + m_deleters[commandData.params[valueIndex].pureType].call = commandData.reducedName; + } +} + +void VulkanHppGenerator::setDefault(std::string const& name, std::map & defaultValues, EnumData const& enumData) +{ + defaultValues[name] = name + (enumData.values.empty() ? "()" : ("::" + enumData.values.front().name)); +} + +void VulkanHppGenerator::sortDependencies() +{ + std::set listedTypes = { "VkFlags" }; + std::list sortedDependencies; + + while (!m_dependencies.empty()) + { + bool found = false; + for (std::list::iterator it = m_dependencies.begin(); it != m_dependencies.end(); ++it) + { + // check if all dependencies of it are already listed + if (std::find_if(it->dependencies.begin(), it->dependencies.end(), [&listedTypes](std::string const& d) { return listedTypes.find(d) == listedTypes.end(); }) == it->dependencies.end()) + { + // add it to the end of the sorted list and the set of listed types, remove it from the list of dependencies to handle and start over with the next dependency + sortedDependencies.push_back(*it); + listedTypes.insert(it->name); + + // if it is a struct, add any alias of it to the list of encountered types + if (it->category == DependencyData::Category::STRUCT) + { + std::map::const_iterator sit = m_structs.find(it->name); + assert(sit != m_structs.end()); + if (!sit->second.alias.empty()) + { + assert(listedTypes.find(sit->second.alias) == listedTypes.end()); + listedTypes.insert(sit->second.alias); + } + } + m_dependencies.erase(it); + found = true; + break; + } + } + if (!found) + { + // at least one dependency of it is not yet listed -> resolve direct circular dependencies + for (std::list::iterator it = m_dependencies.begin(); !found && it != m_dependencies.end(); ++it) + { + for (std::set::const_iterator dit = it->dependencies.begin(); dit != it->dependencies.end(); ++dit) + { + std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&dit](DependencyData const& dd) { return(dd.name == *dit); }); + if (depIt != m_dependencies.end()) + { + if (depIt->dependencies.find(it->name) != depIt->dependencies.end()) + { + // we only have two cases, for now! + assert((depIt->category == DependencyData::Category::STRUCT) && ((it->category == DependencyData::Category::HANDLE) || (it->category == DependencyData::Category::STRUCT))); + it->forwardDependencies.insert(*dit); + it->dependencies.erase(*dit); + found = true; + break; + } + } +#if !defined(NDEBUG) + else + { + // here, only already sorted dependencies should occur, or structs that are aliased and sorted + std::list::const_iterator sdit = std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [&dit](DependencyData const& dd) { return(dd.name == *dit); }); + if (sdit == sortedDependencies.end()) + { + std::map::const_iterator sit = std::find_if(m_structs.begin(), m_structs.end(), [&dit](std::pair const& sd) { return sd.second.alias == *dit; }); + assert(sit != m_structs.end()); + assert(std::find_if(sortedDependencies.begin(), sortedDependencies.end(), [name = sit->first](DependencyData const& dd) { return dd.name == name; }) != sortedDependencies.end()); + } + } +#endif + } + } + } + assert(found); + } + + m_dependencies.swap(sortedDependencies); +} + +void VulkanHppGenerator::writeArguments(std::ostream & os, CommandData const& commandData, bool firstCall, bool singular, size_t from, size_t to) +{ + assert(from <= to); + + // get the parameter indices of the counter for vector parameters + std::map countIndices; + for (std::map::const_iterator it = commandData.vectorParams.begin(); it != commandData.vectorParams.end(); ++it) + { + countIndices.insert(std::make_pair(it->second, it->first)); + } + + bool encounteredArgument = false; + for (size_t i = from; i < to; i++) + { + if (encounteredArgument) + { + os << ", "; + } + + std::map::const_iterator it = countIndices.find(i); + if (it != countIndices.end()) + { + writeCallCountParameter(os, commandData, singular, it); + } + else if ((it = commandData.vectorParams.find(i)) != commandData.vectorParams.end()) + { + writeCallVectorParameter(os, commandData, firstCall, singular, it); + } + else if (m_vkTypes.find(commandData.params[i].pureType) != m_vkTypes.end()) + { + writeCallVulkanTypeParameter(os, commandData.params[i]); + } + else + { + writeCallPlainTypeParameter(os, commandData.params[i]); + } + encounteredArgument = true; + } +} + +void VulkanHppGenerator::writeBitmaskToString(std::ostream & os, std::string const& bitmaskName, EnumData const &enumData) +{ + // the helper functions to make strings out of flag values + enterProtect(os, enumData.protect); + os << " VULKAN_HPP_INLINE std::string to_string(" << bitmaskName << (enumData.values.empty() ? ")" : " value)") << std::endl + << " {" << std::endl; + if (enumData.values.empty()) + { + // no flags values in this enum -> return "{}" + os << " return \"{}\";" << std::endl; + } + else + { + os << " if (!value) return \"{}\";" << std::endl + << " std::string result;" << std::endl; + + // 'or' together all the bits in the value + for (auto valuesIt = enumData.values.begin(); valuesIt != enumData.values.end(); ++valuesIt) + { + os << " if (value & " << enumData.name << "::" << valuesIt->name << ") result += \"" << valuesIt->name.substr(1) << " | \";" << std::endl; + } + // cut off the last three characters from the result (being " | ") + os << " return \"{\" + result.substr(0, result.size() - 3) + \"}\";" << std::endl; + } + os << " }" << std::endl; + leaveProtect(os, enumData.protect); + os << std::endl; +} + +void VulkanHppGenerator::writeCall(std::ostream & os, CommandData const& commandData, bool firstCall, bool singular) +{ + // the original function call + os << "d.vk" << startUpperCase(commandData.fullName) << "( "; + + if (!commandData.className.empty()) + { + // if it's member of a class -> the first argument is the member variable, starting with "m_" + assert(commandData.className == commandData.params[0].type); + os << "m_" << startLowerCase(commandData.className); + if (1 < commandData.params.size()) + { + os << ", "; + } + } + + writeArguments(os, commandData, firstCall, singular, commandData.className.empty() ? 0 : 1, commandData.params.size()); + os << " )"; +} + +void VulkanHppGenerator::writeCallCountParameter(std::ostream & os, CommandData const& commandData, bool singular, std::map::const_iterator it) +{ + // this parameter is a count parameter for a vector parameter + if ((commandData.returnParam == it->second) && commandData.twoStep) + { + // the corresponding vector parameter is the return parameter and it's a two-step algorithm + // -> use the pointer to a local variable named like the counter parameter without leading 'p' + os << "&" << startLowerCase(strip(commandData.params[it->first].name, "p")); + } + else + { + // the corresponding vector parameter is not the return parameter, or it's not a two-step algorithm + if (singular) + { + // for the singular version, the count is just 1. + os << "1 "; + } + else + { + // for the non-singular version, the count is the size of the vector parameter + // -> use the vector parameter name without leading 'p' to get the size (in number of elements, not in bytes) + os << startLowerCase(strip(commandData.params[it->second].name, "p")) << ".size() "; + } + if (commandData.templateParam == it->second) + { + // if the vector parameter is templatized -> multiply by the size of that type to get the size in bytes + os << "* sizeof( T ) "; + } + } +} + +void VulkanHppGenerator::writeCallPlainTypeParameter(std::ostream & os, ParamData const& paramData) +{ + // this parameter is just a plain type + if (paramData.type.back() == '*') + { + // it's a pointer + std::string parameterName = startLowerCase(strip(paramData.name, "p")); + if (paramData.type.find("const") != std::string::npos) + { + // it's a const pointer + if (paramData.pureType == "char") + { + // it's a const pointer to char -> it's a string -> get the data via c_str() + os << parameterName; + if (paramData.optional) + { + // it's optional -> might use nullptr + os << " ? " << parameterName << "->c_str() : nullptr"; + } + else + { + os << ".c_str()"; + } + } + else + { + // it's const pointer to something else -> just use the name + assert(!paramData.optional); + os << paramData.name; + } + } + else + { + // it's a non-const pointer, and char is the only type that occurs -> use the address of the parameter + assert(paramData.type.find("char") == std::string::npos); + os << "&" << parameterName; + } + } + else + { + // it's a plain parameter -> just use its name + os << paramData.name; + } +} + +void VulkanHppGenerator::writeCallVectorParameter(std::ostream & os, CommandData const& commandData, bool firstCall, bool singular, std::map::const_iterator it) +{ + // this parameter is a vector parameter + assert(commandData.params[it->first].type.back() == '*'); + if ((commandData.returnParam == it->first) && commandData.twoStep && firstCall) + { + // this parameter is the return parameter, and it's the first call of a two-step algorithm -> just just nullptr + os << "nullptr"; + } + else + { + std::string parameterName = startLowerCase(strip(commandData.params[it->first].name, "p")); + std::set::const_iterator vkit = m_vkTypes.find(commandData.params[it->first].pureType); + if ((vkit != m_vkTypes.end()) || (it->first == commandData.templateParam)) + { + // CHECK for !commandData.params[it->first].optional + + // this parameter is a vulkan type or a templated type -> need to reinterpret cast + writeReinterpretCast(os, commandData.params[it->first].type.find("const") == 0, vkit != m_vkTypes.end(), commandData.params[it->first].pureType, commandData.params[it->first].type.rfind("* const") != std::string::npos); + os << "( "; + if (singular) + { + // in singular case, strip the plural-S from the name, and use the pointer to that thing + os << "&" << stripPluralS(parameterName); + } + else + { + // in plural case, get the pointer to the data + os << parameterName << ".data()"; + } + os << " )"; + } + else if (commandData.params[it->first].pureType == "char") + { + // the parameter is a vector to char -> it might be optional + // besides that, the parameter now is a std::string -> get the pointer via c_str() + os << parameterName; + if (commandData.params[it->first].optional) + { + os << " ? " << parameterName << "->c_str() : nullptr"; + } + else + { + os << ".c_str()"; + } + } + else + { + // this parameter is just a vetor -> get the pointer to its data + os << parameterName << ".data()"; + } + } +} + +void VulkanHppGenerator::writeCallVulkanTypeParameter(std::ostream & os, ParamData const& paramData) +{ + // this parameter is a vulkan type + if (paramData.type.back() == '*') + { + // it's a pointer -> needs a reinterpret cast to the vulkan type + std::string parameterName = startLowerCase(strip(paramData.name, "p")); + writeReinterpretCast(os, paramData.type.find("const") != std::string::npos, true, paramData.pureType, false); + os << "( "; + if (paramData.optional) + { + // for an optional parameter, we need also a static_cast from optional type to const-pointer to pure type + os << "static_cast( " << parameterName << " )"; + } + else + { + // other parameters can just use the pointer + os << "&" << parameterName; + } + os << " )"; + } + else + { + // a non-pointer parameter needs a static_cast from vk::-type to vulkan type + os << "static_cast( " << paramData.name << " )"; + } +} + +void VulkanHppGenerator::writeEnumsToString(std::ostream & os, EnumData const& enumData) +{ + // the helper functions to make strings out of enum values + enterProtect(os, enumData.protect); + os << " VULKAN_HPP_INLINE std::string to_string(" << enumData.name << (enumData.values.empty() ? ")" : " value)") << std::endl + << " {" << std::endl; + if (enumData.values.empty()) + { + // no enum values in this enum -> return "(void)" + os << " return \"(void)\";" << std::endl; + } + else + { + // otherwise switch over the value and return the a stringized version of that value (without leading 'e') + os << " switch (value)" << std::endl + << " {" << std::endl; + for (auto const& value : enumData.values) + { + os << " case " << enumData.name << "::" << value.name << ": return \"" << value.name.substr(1) << "\";" << std::endl; + } + os << " default: return \"invalid\";" << std::endl + << " }" << std::endl; + } + os << " }" << std::endl; + leaveProtect(os, enumData.protect); + os << std::endl; +} + +// Intended only for `enum class Result`! +void VulkanHppGenerator::writeExceptionsForEnum(std::ostream & os, EnumData const& enumData) +{ + std::string templateString = + R"( class ${className} : public SystemError + { + public: + ${className}( std::string const& message ) + : SystemError( make_error_code( ${enumName}::${enumMemberName} ), message ) {} + ${className}( char const * message ) + : SystemError( make_error_code( ${enumName}::${enumMemberName} ), message ) {} + }; +)"; + + enterProtect(os, enumData.protect); + for (size_t i = 0; i < enumData.values.size(); i++) + { + if (!isErrorEnum(enumData.values[i].name)) + { + continue; + } + os << replaceWithMap(templateString, + { { "className", stripErrorEnumPrefix(enumData.values[i].name) + "Error" }, + { "enumName", enumData.name }, + { "enumMemberName", enumData.values[i].name } + }); + } + leaveProtect(os, enumData.protect); + os << std::endl; +} + +void VulkanHppGenerator::writeFunction(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool definition, bool enhanced, bool singular, bool unique, bool isStructureChain) +{ + writeFunctionHeaderTemplate(os, indentation, commandData, enhanced, unique, !definition, isStructureChain); + + os << indentation << (definition ? "VULKAN_HPP_INLINE " : ""); + writeFunctionHeaderReturnType(os, commandData, enhanced, singular, unique, isStructureChain); + if (definition && !commandData.className.empty()) + { + os << commandData.className << "::"; + } + writeFunctionHeaderName(os, commandData.reducedName, singular, unique); + writeFunctionHeaderArguments(os, commandData, enhanced, singular, !definition); + os << (definition ? "" : ";") << std::endl; + + if (definition) + { + // write the function body + os << indentation << "{" << std::endl; + if (enhanced) + { + writeFunctionBodyEnhanced(os, indentation, commandData, singular, unique, isStructureChain); + } + else + { + writeFunctionBodyStandard(os, indentation, commandData); + } + os << indentation << "}" << std::endl; + } +} + +void VulkanHppGenerator::writeFunctionBodyEnhanced(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool singular, bool unique, bool isStructureChain) +{ + if (unique && !singular && (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end())) // returns a vector of UniqueStuff + { + std::string const stringTemplate = +R"(${i} static_assert( sizeof( ${type} ) <= sizeof( Unique${type} ), "${type} is greater than Unique${type}!" ); +${i} std::vector ${typeVariable}s; +${i} ${typeVariable}s.reserve( ${vectorSize} ); +${i} ${type}* buffer = reinterpret_cast<${type}*>( reinterpret_cast( ${typeVariable}s.data() ) + ${vectorSize} * ( sizeof( Unique${type} ) - sizeof( ${type} ) ) ); +${i} Result result = static_cast(d.vk${command}( m_device, ${arguments}, reinterpret_cast( buffer ) ) ); + +${i} ${Deleter}<${DeleterTemplate},Dispatch> deleter( *this, ${deleterArg}, d ); +${i} for ( size_t i=0 ; i<${vectorSize} ; i++ ) +${i} { +${i} ${typeVariable}s.push_back( Unique${type}( buffer[i], deleter ) ); +${i} } + +${i} return createResultValue( result, ${typeVariable}s, VULKAN_HPP_NAMESPACE_STRING "::${class}::${function}Unique" ); +)"; + + std::string type = (commandData.returnParam != INVALID_INDEX) ? commandData.params[commandData.returnParam].pureType : ""; + std::string typeVariable = startLowerCase(type); + std::ostringstream arguments; + writeArguments(arguments, commandData, true, singular, 1, commandData.params.size() - 1); + + std::map::const_iterator ddit = m_deleters.find(type); + assert(ddit != m_deleters.end()); + + bool isCreateFunction = (commandData.fullName.substr(0, 6) == "create"); + os << replaceWithMap(stringTemplate, std::map + { + { "i", indentation }, + { "type", type }, + { "typeVariable", typeVariable }, + { "vectorSize", isCreateFunction ? "createInfos.size()" : "allocateInfo." + typeVariable + "Count" }, + { "command", startUpperCase(commandData.fullName) }, + { "arguments", arguments.str() }, + { "Deleter", ddit->second.pool.empty() ? "ObjectDestroy" : "PoolFree" }, + { "DeleterTemplate", ddit->second.pool.empty() ? commandData.className : commandData.className + "," + ddit->second.pool }, + { "deleterArg", ddit->second.pool.empty() ? "allocator" : "allocateInfo." + startLowerCase(ddit->second.pool) }, + { "class", commandData.className }, + { "function", commandData.reducedName } + }); + } + else + { + if (1 < commandData.vectorParams.size()) + { + writeFunctionBodyEnhancedMultiVectorSizeCheck(os, indentation, commandData); + } + + std::string returnName; + if (commandData.returnParam != INVALID_INDEX) + { + returnName = writeFunctionBodyEnhancedLocalReturnVariable(os, indentation, commandData, singular, isStructureChain); + } + + if (commandData.twoStep) + { + assert(!singular); + writeFunctionBodyEnhancedLocalCountVariable(os, indentation, commandData); + + // we now might have to check the result, resize the returned vector accordingly, and call the function again + std::map::const_iterator returnit = commandData.vectorParams.find(commandData.returnParam); + assert(returnit != commandData.vectorParams.end() && (returnit->second != INVALID_INDEX)); + std::string sizeName = startLowerCase(strip(commandData.params[returnit->second].name, "p")); + + if (commandData.returnType == "Result") + { + if (1 < commandData.successCodes.size()) + { + writeFunctionBodyEnhancedCallTwoStepIterate(os, indentation, returnName, sizeName, commandData); + } + else + { + writeFunctionBodyEnhancedCallTwoStepChecked(os, indentation, returnName, sizeName, commandData); + } + } + else + { + writeFunctionBodyEnhancedCallTwoStep(os, indentation, returnName, sizeName, commandData); + } + } + else + { + if (commandData.returnType == "Result") + { + writeFunctionBodyEnhancedCallResult(os, indentation, commandData, singular); + } + else + { + writeFunctionBodyEnhancedCall(os, indentation, commandData, singular); + } + } + + if ((commandData.returnType == "Result") || !commandData.successCodes.empty()) + { + writeFunctionBodyEnhancedReturnResultValue(os, indentation, returnName, commandData, singular, unique); + } + else if ((commandData.returnParam != INVALID_INDEX) && (commandData.returnType != commandData.enhancedReturnType)) + { + // for the other returning cases, when the return type is somhow enhanced, just return the local returnVariable + os << indentation << " return " << returnName << ";" << std::endl; + } + } +} + +void VulkanHppGenerator::writeFunctionBodyEnhanced(std::ostream &os, std::string const& templateString, std::string const& indentation, CommandData const& commandData, bool singular) +{ + os << replaceWithMap(templateString, { + { "call", generateCall(commandData, true, singular) }, + { "i", indentation } + }); +} + +void VulkanHppGenerator::writeFunctionBodyTwoStep(std::ostream & os, std::string const &templateString, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) +{ + std::map replacements = { + { "sizeName", sizeName }, + { "returnName", returnName }, + { "call1", generateCall(commandData, true, false) }, + { "call2", generateCall(commandData, false, false) }, + { "i", indentation } + }; + + os << replaceWithMap(templateString, replacements); +} + +std::string VulkanHppGenerator::writeFunctionBodyEnhancedLocalReturnVariable(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool singular, bool isStructureChain) +{ + std::string returnName = startLowerCase(strip(commandData.params[commandData.returnParam].name, "p")); + + // there is a returned parameter -> we need a local variable to hold that value + if (commandData.returnType != commandData.enhancedReturnType) + { + // the returned parameter is somehow enhanced by us + os << indentation << " "; + if (singular) + { + if (isStructureChain) + { + std::string const &pureType = commandData.params[commandData.returnParam].pureType; + // For StructureChains use the template parameters + os << "StructureChain structureChain;" << std::endl; + returnName = stripPluralS(returnName); + os << indentation << " " << pureType << "& " << returnName << " = structureChain.template get<" << pureType << ">()"; + returnName = "structureChain"; + } + else + { + // in singular case, just use the return parameters pure type for the return variable + returnName = stripPluralS(returnName); + os << commandData.params[commandData.returnParam].pureType << " " << returnName; + } + } + else + { + // in non-singular case, use the enhanced type for the return variable (like vector<...>) + if (isStructureChain) + { + std::string const &returnType = commandData.enhancedReturnType; + // For StructureChains use the template parameters + os << "StructureChain structureChain;" << std::endl; + os << indentation << " " << returnType << "& " << returnName << " = structureChain.template get<" << returnType << ">()"; + returnName = "structureChain"; + } + else + { + os << commandData.enhancedReturnType << " " << returnName; + } + + std::map::const_iterator it = commandData.vectorParams.find(commandData.returnParam); + if (it != commandData.vectorParams.end() && !commandData.twoStep) + { + // if the return parameter is a vector parameter, and not part of a two-step algorithm, initialize its size + std::string size; + if (it->second == INVALID_INDEX) + { + assert(!commandData.params[commandData.returnParam].len.empty()); + // the size of the vector is not given by an other parameter, but by some member of a parameter, described as 'parameter::member' + // -> replace the '::' by '.' and filter out the leading 'p' to access that value + size = startLowerCase(strip(commandData.params[commandData.returnParam].len, "p")); + size_t pos = size.find("::"); + assert(pos != std::string::npos); + size.replace(pos, 2, "."); + } + else + { + // the size of the vector is given by an other parameter + // first check, if that size has become the size of some other vector parameter + // -> look for it and get it's actual size + for (auto const& vectorParam : commandData.vectorParams) + { + if ((vectorParam.first != it->first) && (vectorParam.second == it->second)) + { + size = startLowerCase(strip(commandData.params[vectorParam.first].name, "p")) + ".size()"; + break; + } + } + if (size.empty()) + { + // otherwise, just use that parameter + size = commandData.params[it->second].name; + } + } + assert(!size.empty()); + os << "( " << size << " )"; + } + } + os << ";" << std::endl; + } + else + { + // the return parameter is not enhanced -> the type is supposed to be a Result and there are more than one success codes! + assert((commandData.returnType == "Result") && (1 < commandData.successCodes.size())); + os << indentation << " " << commandData.params[commandData.returnParam].pureType << " " << returnName << ";" << std::endl; + } + + return returnName; +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedCall(std::ostream &os, std::string const& indentation, CommandData const& commandData, bool singular) +{ + std::string const templateString = "${i} return ${call};\n"; + std::string const templateStringVoid = "${i} ${call};\n"; + writeFunctionBodyEnhanced(os, commandData.returnType == "void" ? templateStringVoid : templateString, indentation, commandData, singular); +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedCallResult(std::ostream &os, std::string const& indentation, CommandData const& commandData, bool singular) +{ + std::string const templateString = "${i} Result result = static_cast( ${call} );\n"; + writeFunctionBodyEnhanced(os, templateString, indentation, commandData, singular); +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedCallTwoStep(std::ostream & os, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) +{ + std::string const templateString = + R"(${i} ${call1}; +${i} ${returnName}.resize( ${sizeName} ); +${i} ${call2}; +)"; + writeFunctionBodyTwoStep(os, templateString, indentation, returnName, sizeName, commandData); +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedCallTwoStepIterate(std::ostream & os, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) +{ + std::string const templateString = + R"(${i} Result result; +${i} do +${i} { +${i} result = static_cast( ${call1} ); +${i} if ( ( result == Result::eSuccess ) && ${sizeName} ) +${i} { +${i} ${returnName}.resize( ${sizeName} ); +${i} result = static_cast( ${call2} ); +${i} } +${i} } while ( result == Result::eIncomplete ); +${i} VULKAN_HPP_ASSERT( ${sizeName} <= ${returnName}.size() ); +${i} ${returnName}.resize( ${sizeName} ); +)"; + writeFunctionBodyTwoStep(os, templateString, indentation, returnName, sizeName, commandData); +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedCallTwoStepChecked(std::ostream & os, std::string const& indentation, std::string const& returnName, std::string const& sizeName, CommandData const& commandData) +{ + std::string const templateString = + R"(${i} Result result = static_cast( ${call1} ); +${i} if ( ( result == Result::eSuccess ) && ${sizeName} ) +${i} { +${i} ${returnName}.resize( ${sizeName} ); +${i} result = static_cast( ${call2} ); +${i} } +)"; + writeFunctionBodyTwoStep(os, templateString, indentation, returnName, sizeName, commandData); +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedLocalCountVariable(std::ostream & os, std::string const& indentation, CommandData const& commandData) +{ + // local count variable to hold the size of the vector to fill + assert(commandData.returnParam != INVALID_INDEX); + + std::map::const_iterator returnit = commandData.vectorParams.find(commandData.returnParam); + assert(returnit != commandData.vectorParams.end() && (returnit->second != INVALID_INDEX)); + assert((commandData.returnType == "Result") || (commandData.returnType == "void")); + + // take the pure type of the size parameter; strip the leading 'p' from its name for its local name + os << indentation << " " << commandData.params[returnit->second].pureType << " " << startLowerCase(strip(commandData.params[returnit->second].name, "p")) << ";" << std::endl; +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedMultiVectorSizeCheck(std::ostream & os, std::string const& indentation, CommandData const& commandData) +{ + std::string const templateString = + R"#(#ifdef VULKAN_HPP_NO_EXCEPTIONS +${i} VULKAN_HPP_ASSERT( ${firstVectorName}.size() == ${secondVectorName}.size() ); +#else +${i} if ( ${firstVectorName}.size() != ${secondVectorName}.size() ) +${i} { +${i} throw LogicError( VULKAN_HPP_NAMESPACE_STRING "::${className}::${reducedName}: ${firstVectorName}.size() != ${secondVectorName}.size()" ); +${i} } +#endif // VULKAN_HPP_NO_EXCEPTIONS +)#"; + + + // add some error checks if multiple vectors need to have the same size + for (std::map::const_iterator it0 = commandData.vectorParams.begin(); it0 != commandData.vectorParams.end(); ++it0) + { + if (it0->first != commandData.returnParam) + { + for (std::map::const_iterator it1 = std::next(it0); it1 != commandData.vectorParams.end(); ++it1) + { + if ((it1->first != commandData.returnParam) && (it0->second == it1->second)) + { + os << replaceWithMap(templateString, std::map({ + { "firstVectorName", startLowerCase(strip(commandData.params[it0->first].name, "p")) }, + { "secondVectorName", startLowerCase(strip(commandData.params[it1->first].name, "p")) }, + { "className", commandData.className }, + { "reducedName", commandData.reducedName }, + { "i", indentation } + })); + } + } + } + } +} + +void VulkanHppGenerator::writeFunctionBodyEnhancedReturnResultValue(std::ostream & os, std::string const& indentation, std::string const& returnName, CommandData const& commandData, bool singular, bool unique) +{ + std::string type = (commandData.returnParam != INVALID_INDEX) ? commandData.params[commandData.returnParam].pureType : ""; + std::string returnVectorName = (commandData.returnParam != INVALID_INDEX) ? strip(commandData.params[commandData.returnParam].name, "p", "s") : ""; + + if (unique) + { + // the unique version needs a Deleter object for destruction of the newly created stuff + // get the DeleterData corresponding to the returned type + std::map::const_iterator ddit = m_deleters.find(type); + assert(ddit != m_deleters.end() && ddit->second.pool.empty()); + + // special handling for "createDevice", as Device is created from PhysicalDevice, but destroyed on its own + bool noParent = commandData.className.empty() || (commandData.fullName == "createDevice"); + os << std::endl + << indentation << ((commandData.fullName == "allocateMemory") ? " ObjectFree<" : " ObjectDestroy<") << (noParent ? "NoParent" : commandData.className) << ",Dispatch> deleter( " << (noParent ? "" : "*this, ") << "allocator, d );" << std::endl + << indentation << " return createResultValue<" << type << ",Dispatch>( result, "; + } + else + { + os << indentation << " return createResultValue( result, "; + } + + // if the return type is "Result" or there is at least one success code, create the Result/Value construct to return + if (commandData.returnParam != INVALID_INDEX) + { + // if there's a return parameter, list it in the Result/Value constructor + os << returnName << ", "; + } + + // now the function name (with full namespace) as a string + os << "VULKAN_HPP_NAMESPACE_STRING\"::" << (commandData.className.empty() ? "" : commandData.className + "::") << (singular ? stripPluralS(commandData.reducedName) : commandData.reducedName) << (unique ? "Unique" : "") << "\""; + + if (!commandData.twoStep && (1 < commandData.successCodes.size())) + { + // and for the single-step algorithms with more than one success code list them all + os << ", { Result::" << commandData.successCodes[0]; + for (size_t i = 1; i < commandData.successCodes.size(); i++) + { + os << ", Result::" << commandData.successCodes[i]; + } + os << " }"; + } + + if (unique) + { + os << ", deleter"; + } + + os << " );" << std::endl; +} + +void VulkanHppGenerator::writeFunctionBodyStandard(std::ostream & os, std::string const& indentation, CommandData const& commandData) +{ + os << indentation << " "; + bool castReturn = false; + if (commandData.returnType != "void") + { + // there's something to return... + os << "return "; + + castReturn = (m_vkTypes.find(commandData.returnType) != m_vkTypes.end()); + if (castReturn) + { + // the return-type is a vulkan type -> need to cast to vk::-type + os << "static_cast<" << commandData.returnType << ">( "; + } + } + + // call the original function + os << "d.vk" << startUpperCase(commandData.fullName) << "( "; + + if (!commandData.className.empty()) + { + // the command is part of a class -> the first argument is the member variable, starting with "m_" + assert(commandData.className == commandData.params[0].type); + os << "m_" << startLowerCase(commandData.className); + } + + // list all the arguments + for (size_t i = commandData.className.empty() ? 0 : 1; i < commandData.params.size(); i++) + { + if (0 < i) + { + os << ", "; + } + + if (m_vkTypes.find(commandData.params[i].pureType) != m_vkTypes.end()) + { + // the parameter is a vulkan type + if (commandData.params[i].type.back() == '*') + { + // it's a pointer -> need to reinterpret_cast it + writeReinterpretCast(os, commandData.params[i].type.find("const") == 0, true, commandData.params[i].pureType, commandData.params[i].type.find("* const") != std::string::npos); + } + else + { + // it's a value -> need to static_cast ist + os << "static_cast"; + } + os << "( " << commandData.params[i].name << " )"; + } + else + { + // it's a non-vulkan type -> just use it + os << commandData.params[i].name; + } + } + os << " )"; + + if (castReturn) + { + // if we cast the return -> close the static_cast + os << " )"; + } + os << ";" << std::endl; +} + +void VulkanHppGenerator::writeFunctionHeaderArguments(std::ostream & os, CommandData const& commandData, bool enhanced, bool singular, bool withDefaults) +{ + os << "("; + if (enhanced) + { + writeFunctionHeaderArgumentsEnhanced(os, commandData, singular, withDefaults); + } + else + { + writeFunctionHeaderArgumentsStandard(os, commandData, withDefaults); + } + os << ")"; + if (!commandData.className.empty()) + { + os << " const"; + } +} + +void VulkanHppGenerator::writeFunctionHeaderArgumentsEnhanced(std::ostream & os, CommandData const& commandData, bool singular, bool withDefaults) +{ + // check if there's at least one argument left to put in here + if (commandData.skippedParams.size() + (commandData.className.empty() ? 0 : 1) < commandData.params.size()) + { + // determine the last argument, where we might provide some default for + size_t lastArgument = INVALID_INDEX; + for (size_t i = commandData.params.size() - 1; i < commandData.params.size(); i--) + { + if (commandData.skippedParams.find(i) == commandData.skippedParams.end()) + { + lastArgument = i; + break; + } + } + + os << " "; + bool argEncountered = false; + for (size_t i = commandData.className.empty() ? 0 : 1; i < commandData.params.size(); i++) + { + if (commandData.skippedParams.find(i) == commandData.skippedParams.end()) + { + if (argEncountered) + { + os << ", "; + } + std::string strippedParameterName = startLowerCase(strip(commandData.params[i].name, "p")); + + std::map::const_iterator it = commandData.vectorParams.find(i); + size_t rightStarPos = commandData.params[i].type.rfind('*'); + if (it == commandData.vectorParams.end()) + { + // the argument ist not a vector + if (rightStarPos == std::string::npos) + { + // and its not a pointer -> just use its type and name here + os << commandData.params[i].type << " " << commandData.params[i].name; + if (!commandData.params[i].arraySize.empty()) + { + os << "[" << commandData.params[i].arraySize << "]"; + } + + if (withDefaults && (lastArgument == i)) + { + // check if the very last argument is a flag without any bits -> provide some empty default for it + std::map::const_iterator bitmasksIt = m_bitmasks.find(commandData.params[i].pureType); + if (bitmasksIt != m_bitmasks.end()) + { + // get the enum corresponding to this flag, to check if it's empty + std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&bitmasksIt](DependencyData const& dd) { return(dd.name == bitmasksIt->first); }); + assert((depIt != m_dependencies.end()) && (depIt->dependencies.size() == 1)); + std::map::const_iterator enumIt = m_enums.find(*depIt->dependencies.begin()); + assert(enumIt != m_enums.end()); + if (enumIt->second.values.empty()) + { + // there are no bits in this flag -> provide the default + os << " = " << commandData.params[i].pureType << "()"; + } + } + } + } + else + { + // the argument is not a vector, but a pointer + assert(commandData.params[i].type[rightStarPos] == '*'); + if (commandData.params[i].optional) + { + // for an optional argument, trim the trailing '*' from the type, and the leading 'p' from the name + os << "Optional<" << trimEnd(commandData.params[i].type.substr(0, rightStarPos)) << "> " << strippedParameterName; + if (withDefaults) + { + os << " = nullptr"; + } + } + else if (commandData.params[i].pureType == "void") + { + // for void-pointer, just use type and name + os << commandData.params[i].type << " " << commandData.params[i].name; + } + else if (commandData.params[i].pureType != "char") + { + // for non-char-pointer, change to reference + os << trimEnd(commandData.params[i].type.substr(0, rightStarPos)) << " & " << strippedParameterName; + } + else + { + // for char-pointer, change to const reference to std::string + os << "const std::string & " << strippedParameterName; + } + } + } + else + { + // the argument is a vector + // it's optional, if it's marked as optional and there's no size specified + bool optional = commandData.params[i].optional && (it->second == INVALID_INDEX); + assert((rightStarPos != std::string::npos) && (commandData.params[i].type[rightStarPos] == '*')); + if (commandData.params[i].type.find("char") != std::string::npos) + { + // it's a char-vector -> use a std::string (either optional or a const-reference + if (optional) + { + os << "Optional " << strippedParameterName; + if (withDefaults) + { + os << " = nullptr"; + } + } + else + { + os << "const std::string & " << strippedParameterName; + } + } + else + { + // it's a non-char vector (they are never optional) + assert(!optional); + if (singular) + { + // in singular case, change from pointer to reference + os << trimEnd(commandData.params[i].type.substr(0, rightStarPos)) << " & " << stripPluralS(strippedParameterName); + } + else + { + // otherwise, use our ArrayProxy + bool isConst = (commandData.params[i].type.find("const") != std::string::npos); + os << "ArrayProxy<" << ((commandData.templateParam == i) ? (isConst ? "const T" : "T") : trimEnd(commandData.params[i].type.substr(0, rightStarPos))) << "> " << strippedParameterName; + } + } + } + argEncountered = true; + } + } + + if (argEncountered) + { + os << ", "; + } + } + os << "Dispatch const &d"; + if (withDefaults) + { + os << " = Dispatch()"; + } + + os << " "; +} + +void VulkanHppGenerator::writeFunctionHeaderArgumentsStandard(std::ostream & os, CommandData const& commandData, bool withDefaults) +{ + // for the standard case, just list all the arguments as we've got them + bool argEncountered = false; + + // determine the last argument, where we might provide some default for + size_t lastArgument = commandData.params.size() - 1; + + for (size_t i = commandData.className.empty() ? 0 : 1; i < commandData.params.size(); i++) + { + if (argEncountered) + { + os << ","; + } + + os << " " << commandData.params[i].type << " " << commandData.params[i].name; + if (!commandData.params[i].arraySize.empty()) + { + os << "[" << commandData.params[i].arraySize << "]"; + } + + if (withDefaults && (lastArgument == i)) + { + // check if the very last argument is a flag without any bits -> provide some empty default for it + std::map::const_iterator flagIt = m_bitmasks.find(commandData.params[i].pureType); + if (flagIt != m_bitmasks.end()) + { + // get the enum corresponding to this flag, to check if it's empty + std::list::const_iterator depIt = std::find_if(m_dependencies.begin(), m_dependencies.end(), [&flagIt](DependencyData const& dd) { return(dd.name == flagIt->first); }); + assert((depIt != m_dependencies.end()) && (depIt->dependencies.size() == 1)); + std::map::const_iterator enumIt = m_enums.find(*depIt->dependencies.begin()); + assert(enumIt != m_enums.end()); + if (enumIt->second.values.empty()) + { + // there are no bits in this flag -> provide the default + os << " = " << commandData.params[i].pureType << "()"; + } + } + } + argEncountered = true; + } + if (argEncountered) + { + os << ", "; + } + + os << "Dispatch const &d"; + if (withDefaults) + { + os << " = Dispatch() "; + } +} + +void VulkanHppGenerator::writeFunctionHeaderReturnType(std::ostream & os, CommandData const& commandData, bool enhanced, bool singular, bool unique, bool isStructureChain) +{ + std::string templateString; + std::string returnType; + if (enhanced) + { + // the enhanced function might return some pretty complex return stuff + if (isStructureChain || (!singular && (commandData.enhancedReturnType.find("Allocator") != std::string::npos))) + { + // for the non-singular case with allocation, we need to prepend with 'typename' to keep compilers happy + templateString = "typename "; + } + if (unique) + { + // the unique version returns something prefixed with 'Unique'; potentially a vector of that stuff + // it's a vector, if it's not the singular version and the return parameter is a vector parameter + bool returnsVector = !singular && (commandData.vectorParams.find(commandData.returnParam) != commandData.vectorParams.end()); + + templateString += returnsVector ? "ResultValueType,Allocator>>::type " : "typename ResultValueType>::type "; + returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; + } + else if ((commandData.enhancedReturnType != commandData.returnType) && (commandData.returnType != "void")) + { + // if the enhanced return type differs from the original return type, and it's not void, we return a ResultValueType<...>::type + templateString += "ResultValueType<${returnType}>::type "; + + assert(commandData.returnType == "Result"); + // in singular case, we create the ResultValueType from the pure return type, otherwise from the enhanced return type + if (isStructureChain) + { + returnType = "StructureChain"; + } + else + { + returnType = singular ? commandData.params[commandData.returnParam].pureType : commandData.enhancedReturnType; + } + } + else if ((commandData.returnParam != INVALID_INDEX) && (1 < commandData.successCodes.size())) + { + // if there is a return parameter at all, and there are multiple success codes, we return a ResultValue<...> with the pure return type + assert(commandData.returnType == "Result"); + templateString = "ResultValue<${returnType}> "; + returnType = isStructureChain ? "StructureChain" : commandData.params[commandData.returnParam].pureType; + } + else + { + // and in every other case, we just return the enhanced return type. + templateString = "${returnType} "; + returnType = isStructureChain ? "StructureChain" : commandData.enhancedReturnType; + } + } + else + { + // the non-enhanced function just uses the return type + templateString = "${returnType} "; + returnType = commandData.returnType; + } + os << replaceWithMap(templateString, { { "returnType", returnType } }); +} + +void VulkanHppGenerator::writeFunctionHeaderTemplate(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool enhanced, bool unique, bool withDefault, bool isStructureChain) +{ + std::string dispatch = withDefault ? std::string("typename Dispatch = DispatchLoaderStatic") : std::string("typename Dispatch"); + if (enhanced && isStructureChain) + { + os << indentation << "template " << std::endl; + } + else if (enhanced && (commandData.templateParam != INVALID_INDEX) && ((commandData.templateParam != commandData.returnParam) || (commandData.enhancedReturnType == "Result"))) + { + // if there's a template parameter, not being the return parameter or where the enhanced return type is 'Result' -> templatize on type 'T' + assert(commandData.enhancedReturnType.find("Allocator") == std::string::npos); + os << indentation << "template " << std::endl; + } + else if (enhanced && (commandData.enhancedReturnType.find("Allocator") != std::string::npos)) + { + // otherwise, if there's an Allocator used in the enhanced return type, we templatize on that Allocator + assert((commandData.enhancedReturnType.substr(0, 12) == "std::vector<") && (commandData.enhancedReturnType.find(',') != std::string::npos) && (12 < commandData.enhancedReturnType.find(','))); + os << indentation << "template ' + os << " = std::allocator<" << (unique ? "Unique" : "") << commandData.enhancedReturnType.substr(12, commandData.enhancedReturnType.find(',') - 12) << ">"; + } + os << ", " << dispatch; + os << "> " << std::endl; + } + else + { + os << indentation << "template<" << dispatch << ">" << std::endl; + } +} + +void VulkanHppGenerator::writeResultEnum(std::ostream & os) +{ + std::list::const_iterator it = std::find_if(m_dependencies.begin(), m_dependencies.end(), [](DependencyData const& dp) { return dp.name == "Result"; }); + assert(it != m_dependencies.end()); + writeTypeEnum(os, m_enums.find(it->name)->second); + writeEnumsToString(os, m_enums.find(it->name)->second); + os << "#ifndef VULKAN_HPP_NO_EXCEPTIONS"; + os << exceptionHeader; + os << exceptionClassesHeader; + writeExceptionsForEnum(os, m_enums.find(it->name)->second); + writeThrowExceptions(os, m_enums.find(it->name)->second); + os << "#endif" << std::endl; + m_dependencies.erase(it); +} + +void VulkanHppGenerator::writeStructConstructor(std::ostream & os, std::string const& name, StructData const& structData, std::map const& defaultValues) +{ + // the constructor with all the elements as arguments, with defaults + std::string ctorOpening = " " + name + "( "; + size_t indentSize = ctorOpening.size(); + os << ctorOpening; + + bool listedArgument = false; + for (size_t i = 0; i < structData.members.size(); i++) + { + listedArgument = writeStructConstructorArgument(os, listedArgument, indentSize, structData.members[i], defaultValues); + } + os << " )" << std::endl; + + // copy over the simple arguments + bool firstArgument = true; + for (size_t i = 0; i < structData.members.size(); i++) + { + // skip members 'pNext' and 'sType' are directly set by initializers + if ((structData.members[i].name != "pNext") && (structData.members[i].name != "sType") && (structData.members[i].arraySize.empty())) + { + // here, we can only handle non-array arguments + std::string templateString = " ${sep} ${member}( ${value} )\n"; + std::string sep = firstArgument ? ":" : ","; + std::string member = structData.members[i].name; + std::string value = structData.members[i].name + "_"; // the elements are initialized by the corresponding argument (with trailing '_', as mentioned above) + + os << replaceWithMap(templateString, { { "sep", sep },{ "member", member },{ "value", value } }); + firstArgument = false; + } + } + + // the body of the constructor, copying over data from argument list into wrapped struct + os << " {" << std::endl; + for (size_t i = 0; i < structData.members.size(); i++) + { + if (!structData.members[i].arraySize.empty()) + { + // here we can handle the arrays, copying over from argument (with trailing '_') to member + // size is arraySize times sizeof type + std::string member = structData.members[i].name; + std::string arraySize = structData.members[i].arraySize; + std::string type = structData.members[i].type; + os << replaceWithMap(" memcpy( &${member}, ${member}_.data(), ${arraySize} * sizeof( ${type} ) );\n", + { { "member", member },{ "arraySize", arraySize },{ "type", type } }); + } + } + os << " }\n\n"; + + if (!structData.subStruct.empty()) + { + auto const& subStruct = m_structs.find(structData.subStruct); + assert(subStruct != m_structs.end()); + + std::string subStructArgumentName = startLowerCase(strip(subStruct->first, "vk")); + ctorOpening = " explicit " + name + "( "; + indentSize = ctorOpening.size(); + + os << ctorOpening << subStruct->first << " const& " << subStructArgumentName; + + for (size_t i = subStruct->second.members.size(); i < structData.members.size(); i++) + { + writeStructConstructorArgument(os, true, indentSize, structData.members[i], defaultValues); + } + os << " )" << std::endl; + + firstArgument = true; + std::string templateString = " ${sep} ${member}( ${value} )\n"; + for (size_t i = 0; i < subStruct->second.members.size(); i++) + { + assert(structData.members[i].arraySize.empty()); + std::string sep = firstArgument ? ":" : ","; + std::string member = structData.members[i].name; + std::string value = subStructArgumentName + "." + subStruct->second.members[i].name; + + os << replaceWithMap(templateString, { { "sep", sep },{ "member", member },{ "value", value } }); + firstArgument = false; + } + for (size_t i = subStruct->second.members.size(); i < structData.members.size(); i++) + { + assert(structData.members[i].arraySize.empty()); + std::string member = structData.members[i].name; + std::string value = structData.members[i].name + "_"; // the elements are initialized by the corresponding argument (with trailing '_', as mentioned above) + + os << replaceWithMap(templateString, { { "sep", "," },{ "member", member },{ "value", value } }); + } + os << " {}" << std::endl << std::endl; + } + + std::string templateString = + R"( ${name}( Vk${name} const & rhs ) + { + memcpy( this, &rhs, sizeof( ${name} ) ); + } + + ${name}& operator=( Vk${name} const & rhs ) + { + memcpy( this, &rhs, sizeof( ${name} ) ); + return *this; + } +)"; + + os << replaceWithMap(templateString, { { "name", name } }); +} + +void VulkanHppGenerator::writeIndentation(std::ostream & os, size_t indentLength) +{ + for(size_t i = 0; i < indentLength; i++) + { + os << " "; + } +} + +bool VulkanHppGenerator::writeStructConstructorArgument(std::ostream & os, bool listedArgument, size_t indentLength, MemberData const& memberData, std::map const& defaultValues) +{ + if (listedArgument) + { + os << ",\n"; + writeIndentation(os, indentLength); + } + + // skip members 'pNext' and 'sType', as they are never explicitly set + if ((memberData.name != "pNext") && (memberData.name != "sType")) + { + // find a default value for the given pure type + std::map::const_iterator defaultIt = defaultValues.find(memberData.pureType); + assert(defaultIt != defaultValues.end()); + + if (memberData.arraySize.empty()) + { + // the arguments name get a trailing '_', to distinguish them from the actual struct members + // pointer arguments get a nullptr as default + os << memberData.type << " " << memberData.name << "_ = " << (memberData.type.back() == '*' ? "nullptr" : defaultIt->second); + } + else + { + // array members are provided as const reference to a std::array + // the arguments name get a trailing '_', to distinguish them from the actual struct members + // list as many default values as there are elements in the array + os << "std::array<" << memberData.type << "," << memberData.arraySize << "> const& " << memberData.name << "_ = { { " << defaultIt->second; + size_t n = atoi(memberData.arraySize.c_str()); + assert(0 < n); + for (size_t j = 1; j < n; j++) + { + os << ", " << defaultIt->second; + } + os << " } }"; + } + listedArgument = true; + } + return listedArgument; +} + +void VulkanHppGenerator::writeStructSetter(std::ostream & os, std::string const& structureName, MemberData const& memberData) +{ + if (memberData.type != "StructureType") // filter out StructureType, which is supposed to be immutable ! + { + // the setters return a reference to the structure + os << " " << structureName << "& set" << startUpperCase(memberData.name) << "( "; + if (memberData.arraySize.empty()) + { + os << memberData.type << " "; + } + else + { + os << "std::array<" << memberData.type << "," << memberData.arraySize << "> "; + } + // add a trailing '_' to the argument to distinguish it from the structure member + os << memberData.name << "_ )" << std::endl + << " {" << std::endl; + // copy over the argument, either by assigning simple data, or by memcpy array data + if (memberData.arraySize.empty()) + { + os << " " << memberData.name << " = " << memberData.name << "_"; + } + else + { + os << " memcpy( &" << memberData.name << ", " << memberData.name << "_.data(), " << memberData.arraySize << " * sizeof( " << memberData.type << " ) )"; + } + os << ";" << std::endl + << " return *this;" << std::endl + << " }" << std::endl + << std::endl; + } +} + +void VulkanHppGenerator::writeStructureChainValidation(std::ostream & os) +{ + // write all template functions for the structure pointer chain validation + for (auto it = m_dependencies.begin(); it != m_dependencies.end(); ++it) + { + if (it->category == DependencyData::Category::STRUCT) + { + writeStructureChainValidation(os, *it); + } + } +} + +void VulkanHppGenerator::writeStructureChainValidation(std::ostream & os, DependencyData const& dependencyData) +{ + std::map::const_iterator it = m_structs.find(dependencyData.name); + assert(it != m_structs.end()); + + if (!it->second.structExtends.empty()) + { + enterProtect(os, it->second.protect); + + // write out allowed structure chains + for (auto extendName : it->second.structExtends) + { + std::map::const_iterator itExtend = m_structs.find(extendName); + if (itExtend == m_structs.end()) { + std::stringstream errorString; + errorString << extendName << " does not specify a struct in structextends field."; + + // check if symbol name is an alias to a struct + auto itAlias = std::find_if(m_structs.begin(), m_structs.end(), [&extendName](std::pair const &it) -> bool {return it.second.alias == extendName;}); + if (itAlias != m_structs.end()) + { + errorString << " The symbol is an alias and maps to " << itAlias->first << "."; + } + + errorString << std::endl; + throw std::runtime_error(errorString.str()); + } + enterProtect(os, itExtend->second.protect); + + os << " template <> struct isStructureChainValid<" << extendName << ", " << dependencyData.name << ">{ enum { value = true }; };" << std::endl; + + leaveProtect(os, itExtend->second.protect); + } + leaveProtect(os, it->second.protect); + } +} + +void VulkanHppGenerator::writeThrowExceptions(std::ostream & os, EnumData const& enumData) +{ + enterProtect(os, enumData.protect); + os << + R"( VULKAN_HPP_INLINE void throwResultException( Result result, char const * message ) + { + switch ( result ) + { +)"; + for (size_t i = 0; icategory) + { + case DependencyData::Category::BITMASK: + writeBitmaskToString(os, it->name, m_enums.find(*it->dependencies.begin())->second); + break; + case DependencyData::Category::ENUM: + assert(m_enums.find(it->name) != m_enums.end()); + writeEnumsToString(os, m_enums.find(it->name)->second); + break; + default: + break; + } + } +} + +void VulkanHppGenerator::writeTypeBitmask(std::ostream & os, std::string const& bitmaskName, BitmaskData const& bitmaskData, EnumData const& enumData) +{ + enterProtect(os, bitmaskData.protect); + + // each Flags class is using on the class 'Flags' with the corresponding FlagBits enum as the template parameter + os << " using " << bitmaskName << " = Flags<" << enumData.name << ", Vk" << bitmaskName << ">;" << std::endl; + + std::stringstream allFlags; + for (size_t i = 0; i < enumData.values.size(); i++) + { + if (i != 0) + { + allFlags << " | "; + } + allFlags << "VkFlags(" << enumData.name << "::" << enumData.values[i].name << ")"; + } + + if (!enumData.values.empty()) + { + const std::string templateString = R"( + VULKAN_HPP_INLINE ${bitmaskName} operator|( ${enumName} bit0, ${enumName} bit1 ) + { + return ${bitmaskName}( bit0 ) | bit1; + } + + VULKAN_HPP_INLINE ${bitmaskName} operator~( ${enumName} bits ) + { + return ~( ${bitmaskName}( bits ) ); + } + + template <> struct FlagTraits<${enumName}> + { + enum + { + allFlags = ${allFlags} + }; + }; +)"; + os << replaceWithMap(templateString, { { "bitmaskName", bitmaskName },{ "enumName", enumData.name },{ "allFlags", allFlags.str() } }); + } + + if (!bitmaskData.alias.empty()) + { + os << std::endl + << " using " << bitmaskData.alias << " = " << bitmaskName << ";" << std::endl; + } + + leaveProtect(os, bitmaskData.protect); + os << std::endl; +} + +void VulkanHppGenerator::writeTypeCommand(std::ostream & os, DependencyData const& dependencyData) +{ + assert(m_commands.find(dependencyData.name) != m_commands.end()); + CommandData const& commandData = m_commands.find(dependencyData.name)->second; + if (commandData.className.empty()) + { + if (commandData.fullName == "createInstance") + { + // special handling for createInstance, as we need to explicitly place the forward declarations and the deleter classes here +#if !defined(NDEBUG) + auto deleterTypesIt = m_deleterTypes.find(""); + assert((deleterTypesIt != m_deleterTypes.end()) && (deleterTypesIt->second.size() == 2)); + assert(deleterTypesIt->second.find("Instance") != deleterTypesIt->second.end()); +#endif + + writeUniqueTypes(os, std::make_pair>("", { "Instance" })); + writeTypeCommand(os, " ", commandData, false); + } + else + { + writeTypeCommand(os, " ", commandData, false); + } + writeTypeCommand(os, " ", commandData, true); + os << std::endl; + } +} + +void VulkanHppGenerator::writeTypeCommand(std::ostream & os, std::string const& indentation, CommandData const& commandData, bool definition) +{ + enterProtect(os, commandData.protect); + + bool isStructureChain = m_extendedStructs.find(commandData.enhancedReturnType) != m_extendedStructs.end(); + + // first create the standard version of the function + std::ostringstream standard; + writeFunction(standard, indentation, commandData, definition, false, false, false, false); + + // then the enhanced version, composed by up to five parts + std::ostringstream enhanced; + writeFunction(enhanced, indentation, commandData, definition, true, false, false, false); + + if (isStructureChain) + { + writeFunction(enhanced, indentation, commandData, definition, true, false, false, true); + } + + // then a singular version, if a sized vector would be returned + std::map::const_iterator returnVector = commandData.vectorParams.find(commandData.returnParam); + bool singular = (returnVector != commandData.vectorParams.end()) && + (returnVector->second != INVALID_INDEX) && + (commandData.params[returnVector->first].pureType != "void") && + (commandData.params[returnVector->second].type.back() != '*'); + if (singular) + { + writeFunction(enhanced, indentation, commandData, definition, true, true, false, false); + } + + // special handling for createDevice and createInstance ! + bool specialWriteUnique = (commandData.reducedName == "createDevice") || (commandData.reducedName == "createInstance"); + + // and then the same for the Unique* versions (a Deleter is available for the commandData's class, and the function starts with 'allocate' or 'create') + if (((m_deleters.find(commandData.className) != m_deleters.end()) || specialWriteUnique) && ((commandData.reducedName.substr(0, 8) == "allocate") || (commandData.reducedName.substr(0, 6) == "create"))) + { + enhanced << "#ifndef VULKAN_HPP_NO_SMART_HANDLE" << std::endl; + writeFunction(enhanced, indentation, commandData, definition, true, false, true, false); + + if (singular) + { + writeFunction(enhanced, indentation, commandData, definition, true, true, true, false); + } + enhanced << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl; + } + + // and write one or both of them + writeStandardOrEnhanced(os, standard.str(), enhanced.str()); + + leaveProtect(os, commandData.protect); + os << std::endl; +} + +void VulkanHppGenerator::writeTypeEnum(std::ostream & os, EnumData const& enumData) +{ + // a named enum per enum, listing all its values by setting them to the original Vulkan names + enterProtect(os, enumData.protect); + os << " enum class " << enumData.name << std::endl + << " {" << std::endl; + for (size_t i = 0; i list them first + if (!dependencyData.forwardDependencies.empty()) + { + os << " // forward declarations" << std::endl; + for (std::set::const_iterator it = dependencyData.forwardDependencies.begin(); it != dependencyData.forwardDependencies.end(); ++it) + { + assert(m_structs.find(*it) != m_structs.end()); + os << " struct " << *it << ";" << std::endl; + } + os << std::endl; + } + + // then write any forward declaration of Deleters used by this handle + std::map>::const_iterator deleterTypesIt = m_deleterTypes.find(dependencyData.name); + if (deleterTypesIt != m_deleterTypes.end()) + { + writeUniqueTypes(os, *deleterTypesIt); + } + else if (dependencyData.name == "PhysicalDevice") + { + // special handling for class Device, as it's created from PhysicalDevice, but destroys itself + writeUniqueTypes(os, std::make_pair>("", { "Device" })); + } + + const std::string memberName = startLowerCase(dependencyData.name); + const std::string templateString = + R"( class ${className} + { + public: + VULKAN_HPP_CONSTEXPR ${className}() + : m_${memberName}(VK_NULL_HANDLE) + {} + + VULKAN_HPP_CONSTEXPR ${className}( std::nullptr_t ) + : m_${memberName}(VK_NULL_HANDLE) + {} + + VULKAN_HPP_TYPESAFE_EXPLICIT ${className}( Vk${className} ${memberName} ) + : m_${memberName}( ${memberName} ) + {} + +#if defined(VULKAN_HPP_TYPESAFE_CONVERSION) + ${className} & operator=(Vk${className} ${memberName}) + { + m_${memberName} = ${memberName}; + return *this; + } +#endif + + ${className} & operator=( std::nullptr_t ) + { + m_${memberName} = VK_NULL_HANDLE; + return *this; + } + + bool operator==( ${className} const & rhs ) const + { + return m_${memberName} == rhs.m_${memberName}; + } + + bool operator!=(${className} const & rhs ) const + { + return m_${memberName} != rhs.m_${memberName}; + } + + bool operator<(${className} const & rhs ) const + { + return m_${memberName} < rhs.m_${memberName}; + } + +${commands} + + VULKAN_HPP_TYPESAFE_EXPLICIT operator Vk${className}() const + { + return m_${memberName}; + } + + explicit operator bool() const + { + return m_${memberName} != VK_NULL_HANDLE; + } + + bool operator!() const + { + return m_${memberName} == VK_NULL_HANDLE; + } + + private: + Vk${className} m_${memberName}; + }; + + static_assert( sizeof( ${className} ) == sizeof( Vk${className} ), "handle and wrapper have different size!" ); + +)"; + + std::ostringstream commands; + // now list all the commands that are mapped to members of this class + for (size_t i = 0; i < handleData.commands.size(); i++) + { + std::map::const_iterator cit = m_commands.find(handleData.commands[i]); + assert((cit != m_commands.end()) && !cit->second.className.empty()); + writeTypeCommand(commands, " ", cit->second, false); + + // special handling for destroy functions which are not aliased. + if (!cit->second.isAlias && (((cit->second.fullName.substr(0, 7) == "destroy") && (cit->second.reducedName != "destroy")) || (cit->second.fullName.substr(0, 4) == "free"))) + { + CommandData shortenedCommand = cit->second; + shortenedCommand.reducedName = (cit->second.fullName.substr(0, 7) == "destroy") ? "destroy" : "free"; + writeTypeCommand(commands, " ", shortenedCommand, false); + } + } + + os << replaceWithMap(templateString, { + { "className", dependencyData.name }, + { "memberName", memberName }, + { "commands", commands.str() } + }); + + // and finally the commands, that are member functions of this handle + for (size_t i = 0; i < handleData.commands.size(); i++) + { + std::string commandName = handleData.commands[i]; + std::map::const_iterator cit = m_commands.find(commandName); + assert((cit != m_commands.end()) && !cit->second.className.empty()); + std::list::const_iterator dep = std::find_if(m_dependencies.begin(), m_dependencies.end(), [commandName](DependencyData const& dd) { return dd.name == commandName; }); + assert(dep != m_dependencies.end() && (dep->name == cit->second.fullName)); + writeTypeCommand(os, " ", cit->second, true); + + // special handling for destroy functions + if (!cit->second.isAlias && (((cit->second.fullName.substr(0, 7) == "destroy") && (cit->second.reducedName != "destroy")) || (cit->second.fullName.substr(0, 4) == "free"))) + { + CommandData shortenedCommand = cit->second; + shortenedCommand.reducedName = (cit->second.fullName.substr(0, 7) == "destroy") ? "destroy" : "free"; + writeTypeCommand(os, " ", shortenedCommand, true); + } + } + + if (!handleData.alias.empty()) + { + os << " using " << handleData.alias << " = " << dependencyData.name << ";" << std::endl + << std::endl; + } + + leaveProtect(os, handleData.protect); +} + +void VulkanHppGenerator::writeTypes(std::ostream & os, std::map const& defaultValues) +{ + assert(m_deleterTypes.find("") != m_deleterTypes.end()); + + for (std::list::const_iterator it = m_dependencies.begin(); it != m_dependencies.end(); ++it) + { + switch (it->category) + { + case DependencyData::Category::BITMASK: + assert(m_bitmasks.find(it->name) != m_bitmasks.end()); + writeTypeBitmask(os, it->name, m_bitmasks.find(it->name)->second, m_enums.find(generateEnumNameForFlags(it->name))->second); + break; + case DependencyData::Category::COMMAND: + writeTypeCommand(os, *it); + break; + case DependencyData::Category::ENUM: + assert(m_enums.find(it->name) != m_enums.end()); + writeTypeEnum(os, m_enums.find(it->name)->second); + break; + case DependencyData::Category::FUNC_POINTER: + case DependencyData::Category::REQUIRED: + // skip FUNC_POINTER and REQUIRED, they just needed to be in the dependencies list to resolve dependencies + break; + case DependencyData::Category::HANDLE: + assert(m_handles.find(it->name) != m_handles.end()); + writeTypeHandle(os, *it, m_handles.find(it->name)->second); + break; + case DependencyData::Category::SCALAR: + writeTypeScalar(os, *it); + break; + case DependencyData::Category::STRUCT: + writeTypeStruct(os, *it, defaultValues); + break; + case DependencyData::Category::UNION: + assert(m_structs.find(it->name) != m_structs.end()); + writeTypeUnion(os, *it, defaultValues); + break; + default: + assert(false); + break; + } + } +} + +void VulkanHppGenerator::writeTypeScalar(std::ostream & os, DependencyData const& dependencyData) +{ + assert(dependencyData.dependencies.size() == 1); + os << " using " << dependencyData.name << " = " << *dependencyData.dependencies.begin() << ";" << std::endl + << std::endl; +} + +void VulkanHppGenerator::writeTypeStruct(std::ostream & os, DependencyData const& dependencyData, std::map const& defaultValues) +{ + std::map::const_iterator it = m_structs.find(dependencyData.name); + assert(it != m_structs.end()); + + enterProtect(os, it->second.protect); + os << " struct " << dependencyData.name << std::endl + << " {" << std::endl; + + // only structs that are not returnedOnly get a constructor! + if (!it->second.returnedOnly) + { + writeStructConstructor(os, dependencyData.name, it->second, defaultValues); + } + + // create the setters + if (!it->second.returnedOnly) + { + for (size_t i = 0; i < it->second.members.size(); i++) + { + writeStructSetter(os, dependencyData.name, it->second.members[i]); + } + } + + // the implicit cast-operators to the native type + os << " operator Vk" << dependencyData.name << " const&() const" << std::endl + << " {" << std::endl + << " return *reinterpret_cast(this);" << std::endl + << " }" << std::endl + << std::endl + << " operator Vk" << dependencyData.name << " &()" << std::endl + << " {" << std::endl + << " return *reinterpret_cast(this);" << std::endl + << " }" << std::endl + << std::endl; + + // operator==() and operator!=() + // only structs without a union as a member can have a meaningfull == and != operation; we filter them out + if (!containsUnion(dependencyData.name, m_structs)) + { + // two structs are compared by comparing each of the elements + os << " bool operator==( " << dependencyData.name << " const& rhs ) const" << std::endl + << " {" << std::endl + << " return "; + for (size_t i = 0; i < it->second.members.size(); i++) + { + if (i != 0) + { + os << std::endl << " && "; + } + if (!it->second.members[i].arraySize.empty()) + { + os << "( memcmp( " << it->second.members[i].name << ", rhs." << it->second.members[i].name << ", " << it->second.members[i].arraySize << " * sizeof( " << it->second.members[i].type << " ) ) == 0 )"; + } + else + { + os << "( " << it->second.members[i].name << " == rhs." << it->second.members[i].name << " )"; + } + } + os << ";" << std::endl + << " }" << std::endl + << std::endl + << " bool operator!=( " << dependencyData.name << " const& rhs ) const" << std::endl + << " {" << std::endl + << " return !operator==( rhs );" << std::endl + << " }" << std::endl + << std::endl; + } + + // the member variables + for (size_t i = 0; i < it->second.members.size(); i++) + { + if (it->second.members[i].type == "StructureType") + { + assert((i == 0) && (it->second.members[i].name == "sType")); + if (!it->second.members[i].values.empty()) + { + assert(!it->second.members[i].values.empty()); + auto nameIt = m_nameMap.find(it->second.members[i].values); + assert(nameIt != m_nameMap.end()); + os << " private:" << std::endl + << " StructureType sType = " << nameIt->second << ";" << std::endl + << std::endl + << " public:" << std::endl; + } + else + { + os << " StructureType sType;" << std::endl; + } + } + else + { + os << " " << it->second.members[i].type << " " << it->second.members[i].name; + if (it->second.members[i].name == "pNext") + { + os << " = nullptr"; + } + else if (!it->second.members[i].arraySize.empty()) + { + os << "[" << it->second.members[i].arraySize << "]"; + } + os << ";" << std::endl; + } + } + os << " };" << std::endl + << " static_assert( sizeof( " << dependencyData.name << " ) == sizeof( Vk" << dependencyData.name << " ), \"struct and wrapper have different size!\" );" << std::endl; + + if (!it->second.alias.empty()) + { + os << std::endl + << " using " << it->second.alias << " = " << dependencyData.name << ";" << std::endl; + } + + leaveProtect(os, it->second.protect); + os << std::endl; +} + +void VulkanHppGenerator::writeUniqueTypes(std::ostream &os, std::pair> const& deleterTypes) +{ + os << "#ifndef VULKAN_HPP_NO_SMART_HANDLE" << std::endl; + if (!deleterTypes.first.empty()) + { + os << " class " << deleterTypes.first << ";" << std::endl; + } + os << std::endl; + + for (auto const& dt : deleterTypes.second) + { + auto ddit = m_deleters.find(dt); + assert(ddit != m_deleters.end()); + + os << " template class UniqueHandleTraits<" << dt << ",Dispatch> {public: using deleter = " << (ddit->second.pool.empty() ? "Object" : "Pool") << ((ddit->second.call.substr(0, 4) == "free") ? "Free<" : "Destroy<") << (deleterTypes.first.empty() ? "NoParent" : deleterTypes.first) << (ddit->second.pool.empty() ? "" : ", " + ddit->second.pool) << ",Dispatch>; };\n"; + os << " using Unique" << dt << " = UniqueHandle<" << dt << ",DispatchLoaderStatic>;" << std::endl; + } + os << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl + << std::endl; +} + +void VulkanHppGenerator::writeTypeUnion(std::ostream & os, DependencyData const& dependencyData, std::map const& defaultValues) +{ + std::map::const_iterator it = m_structs.find(dependencyData.name); + assert(it != m_structs.end()); + + std::ostringstream oss; + os << " union " << dependencyData.name << std::endl + << " {" << std::endl; + + for (size_t i = 0; isecond.members.size(); i++) + { + // one constructor per union element + os << " " << dependencyData.name << "( "; + if (it->second.members[i].arraySize.empty()) + { + os << it->second.members[i].type << " "; + } + else + { + os << "const std::array<" << it->second.members[i].type << "," << it->second.members[i].arraySize << ">& "; + } + os << it->second.members[i].name << "_"; + + // just the very first constructor gets default arguments + if (i == 0) + { + std::map::const_iterator defaultIt = defaultValues.find(it->second.members[i].pureType); + assert(defaultIt != defaultValues.end()); + if (it->second.members[i].arraySize.empty()) + { + os << " = " << defaultIt->second; + } + else + { + os << " = { {" << defaultIt->second << "} }"; + } + } + os << " )" << std::endl + << " {" << std::endl + << " "; + if (it->second.members[i].arraySize.empty()) + { + os << it->second.members[i].name << " = " << it->second.members[i].name << "_"; + } + else + { + os << "memcpy( &" << it->second.members[i].name << ", " << it->second.members[i].name << "_.data(), " << it->second.members[i].arraySize << " * sizeof( " << it->second.members[i].type << " ) )"; + } + os << ";" << std::endl + << " }" << std::endl + << std::endl; + } + + for (size_t i = 0; isecond.members.size(); i++) + { + // one setter per union element + assert(!it->second.returnedOnly); + writeStructSetter(os, dependencyData.name, it->second.members[i]); + } + + // the implicit cast operators to the native type + os << " operator Vk" << dependencyData.name << " const&() const" << std::endl + << " {" << std::endl + << " return *reinterpret_cast(this);" << std::endl + << " }" << std::endl + << std::endl + << " operator Vk" << dependencyData.name << " &()" << std::endl + << " {" << std::endl + << " return *reinterpret_cast(this);" << std::endl + << " }" << std::endl + << std::endl; + + // the union member variables + // if there's at least one Vk... type in this union, check for unrestricted unions support + bool needsUnrestrictedUnions = false; + for (size_t i = 0; i < it->second.members.size() && !needsUnrestrictedUnions; i++) + { + needsUnrestrictedUnions = (m_vkTypes.find(it->second.members[i].type) != m_vkTypes.end()); + } + if (needsUnrestrictedUnions) + { + os << "#ifdef VULKAN_HPP_HAS_UNRESTRICTED_UNIONS" << std::endl; + for (size_t i = 0; i < it->second.members.size(); i++) + { + os << " " << it->second.members[i].type << " " << it->second.members[i].name; + if (!it->second.members[i].arraySize.empty()) + { + os << "[" << it->second.members[i].arraySize << "]"; + } + os << ";" << std::endl; + } + os << "#else" << std::endl; + } + for (size_t i = 0; i < it->second.members.size(); i++) + { + os << " "; + if (m_vkTypes.find(it->second.members[i].type) != m_vkTypes.end()) + { + os << "Vk"; + } + os << it->second.members[i].type << " " << it->second.members[i].name; + if (!it->second.members[i].arraySize.empty()) + { + os << "[" << it->second.members[i].arraySize << "]"; + } + os << ";" << std::endl; + } + if (needsUnrestrictedUnions) + { + os << "#endif // VULKAN_HPP_HAS_UNRESTRICTED_UNIONS" << std::endl; + } + os << " };" << std::endl + << std::endl; +} + +#if !defined(NDEBUG) +void VulkanHppGenerator::checkExtensionRequirements() +{ + for (auto const& ext : m_extensions) + { + for (auto const& req : ext.second.requires) + { + auto reqExt = m_extensions.find(req); + assert(reqExt != m_extensions.end()); + assert(reqExt->second.protect.empty() || (reqExt->second.protect == ext.second.protect)); + } + } +} + +void VulkanHppGenerator::skipVendorID(tinyxml2::XMLElement const* element) +{ + std::map attributes = getAttributes(element); + checkAttributes(attributes, element->GetLineNum(), { { "comment",{} },{ "id",{} },{ "name",{} } }, {}); + checkElements(getChildElements(element), {}); + + VendorIDData vendorID; + for (auto const& attribute : attributes) + { + std::string name = attribute.first; + if (name == "comment") + { + vendorID.comment = attribute.second; + } + else if (name == "id") + { + vendorID.id = attribute.second; + } + else + { + assert(name == "name"); + vendorID.name = attribute.second; + } + } + m_vendorIDs.push_back(vendorID); +} + +void VulkanHppGenerator::skipVendorIDs(tinyxml2::XMLElement const* element) +{ + checkAttributes(getAttributes(element), element->GetLineNum(), { { "comment",{} } }, {}); + std::vector children = getChildElements(element); + checkElements(children, { "vendorid" }); + + for (auto child : children) + { + skipVendorID(child); + } +} +#endif + +void VulkanHppGenerator::EnumData::addEnumValue(std::string const &enumName, std::string const& tag, std::map & nameMap) +{ + EnumValueData evd; + evd.name = createEnumValueName(enumName, prefix, postfix, bitmask, tag); + evd.value = enumName; + + auto it = std::find_if(values.begin(), values.end(), [&evd](EnumValueData const& _evd) { return _evd.name == evd.name; }); + if (it == values.end()) + { + values.push_back(evd); + assert(nameMap.find(enumName) == nameMap.end()); + nameMap[enumName] = this->name + "::" + evd.name; + } + else + { + assert(it->value == evd.value); + } +} + +void VulkanHppGenerator::writeDelegationClassStatic(std::ostream &os) +{ + os << "class DispatchLoaderStatic" << std::endl + << "{" << std::endl + << "public:\n"; + + for (auto command : m_commands) + { + enterProtect(os, command.second.protect); + os << " " << command.second.unchangedReturnType << " vk" << startUpperCase(command.second.fullName) << "( "; + bool first = true; + for (auto param : command.second.params) + { + if (!first) { + os << ", "; + } + os << param.unchangedType << " " << param.name; + if (!param.arraySize.empty()) + { + os << "[" << param.arraySize << "]"; + } + first = false; + } + os << " ) const\n" + << " {\n" + << " return ::vk" << startUpperCase(command.second.fullName) << "( "; + first = true; + for (auto param : command.second.params) + { + if (!first) { + os << ", "; + } + os << param.name; + first = false; + } + os << ");\n"; + os << " }\n"; + leaveProtect(os, command.second.protect); + } + os << "};\n"; +} + +void VulkanHppGenerator::writeDelegationClassDynamic(std::ostream &os) +{ + os << " class DispatchLoaderDynamic" << std::endl + << " {" << std::endl + << " public:" << std::endl; + + for (auto command : m_commands) + { + enterProtect(os, command.second.protect); + os << " PFN_vk" << startUpperCase(command.second.fullName) << " vk" << startUpperCase(command.second.fullName) << " = 0;" << std::endl; + leaveProtect(os, command.second.protect); + } + + // write initialization function to fetch function pointers + os << " public:" << std::endl + << " DispatchLoaderDynamic(Instance instance = Instance(), Device device = Device())" << std::endl + << " {" << std::endl + << " if (instance)" << std::endl + << " {" << std::endl + << " init(instance, device);" << std::endl + << " }" << std::endl + << " }" << std::endl << std::endl + << " void init(Instance instance, Device device = Device())" << std::endl + << " {" << std::endl; + + for (auto command : m_commands) + { + enterProtect(os, command.second.protect); + if (!command.second.params.empty() + && m_handles.find(command.second.params[0].type) != m_handles.end() + && command.second.params[0].type != "Instance" + && command.second.params[0].type != "PhysicalDevice") + { + os << " vk" << startUpperCase(command.second.fullName) << " = PFN_vk" << startUpperCase(command.second.fullName) + << "(device ? device.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\") : instance.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\"));" << std::endl; + } + else { + os << " vk" << startUpperCase(command.second.fullName) << " = PFN_vk" << startUpperCase(command.second.fullName) << "(instance.getProcAddr( \"vk" << startUpperCase(command.second.fullName) << "\"));" << std::endl; + } + leaveProtect(os, command.second.protect); + } + os << " }" << std::endl; + os << " };\n"; +} + +int main( int argc, char **argv ) +{ + try { + tinyxml2::XMLDocument doc; + + std::string filename = (argc == 1) ? VK_SPEC : argv[1]; + std::cout << "Loading vk.xml from " << filename << std::endl; + std::cout << "Writing vulkan.hpp to " << VULKAN_HPP_FILE << std::endl; + + tinyxml2::XMLError error = doc.LoadFile(filename.c_str()); + if (error != tinyxml2::XML_SUCCESS) + { + std::cout << "VkGenerate: failed to load file " << filename << " . Error code: " << error << std::endl; + return -1; + } + + VulkanHppGenerator generator; + + bool foundLicense = false; + + tinyxml2::XMLElement const* registryElement = doc.FirstChildElement(); + checkAttributes(getAttributes(registryElement), registryElement->GetLineNum(), {}, {}); + assert(strcmp(registryElement->Value(), "registry") == 0); + assert(!registryElement->NextSiblingElement()); + + std::vector children = getChildElements(registryElement); + checkElements(children, { "commands", "comment", "enums", "extensions", "feature", "tags", "types", "vendorids", "platforms" }); + for (auto child : children) + { + const std::string value = child->Value(); + if (value == "commands") + { + generator.readCommands(child); + } + else if (value == "comment") + { + if (!foundLicense) + { + // get the vulkan license header and skip any leading spaces + generator.readComment(child); + foundLicense = true; + } + } + else if (value == "enums") + { + generator.readEnums(child); + } + else if (value == "extensions") + { + generator.readExtensions(child); + } + else if (value == "feature") + { + generator.readFeature(child); + } + else if (value == "tags") + { + generator.readTags(child); + } + else if (value == "types") + { + generator.readTypes(child); + } + else if (value == "vendorids") + { +#if !defined(NDEBUG) + generator.skipVendorIDs(child); +#endif + } + else if (value == "platforms") + { + // skip this tag + } + else + { + std::stringstream lineNumber; + lineNumber << child->GetLineNum(); + std::cerr << "warning: Unhandled tag " << value << " at line number: " << lineNumber.str() << "!" << std::endl; + } + } + + generator.sortDependencies(); + +#if !defined(NDEBUG) + generator.checkExtensionRequirements(); +#endif + + std::map defaultValues = generator.createDefaults(); + + std::ofstream ofs(VULKAN_HPP_FILE); + ofs << generator.getVulkanLicenseHeader() << std::endl + << R"( +#ifndef VULKAN_HPP +#define VULKAN_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE +# include +# include +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ +#if !defined(VULKAN_HPP_ASSERT) +# include +# define VULKAN_HPP_ASSERT assert +#endif + +// includes through some other header +// this results in major(x) being resolved to gnu_dev_major(x) +// which is an expression in a constructor initializer list. +#if defined(major) + #undef major +#endif +#if defined(minor) + #undef minor +#endif + +// Windows defines MemoryBarrier which is deprecated and collides +// with the vk::MemoryBarrier struct. +#ifdef MemoryBarrier + #undef MemoryBarrier +#endif + +)"; + + writeVersionCheck(ofs, generator.getVersion()); + writeTypesafeCheck(ofs, generator.getTypesafeCheck()); + ofs << versionCheckHeader + << inlineHeader + << explicitHeader + << constExprHeader + << std::endl + << vkNamespace + << flagsHeader + << optionalClassHeader + << arrayProxyHeader + << uniqueHandleHeader + << structureChainHeader; + + // first of all, write out vk::Result and the exception handling stuff + generator.writeResultEnum(ofs); + + ofs << "} // namespace VULKAN_HPP_NAMESPACE" << std::endl + << std::endl + << "namespace std" << std::endl + << "{" << std::endl + << " template <>" << std::endl + << " struct is_error_code_enum : public true_type" << std::endl + << " {};" << std::endl + << "}" << std::endl + << std::endl + << "namespace VULKAN_HPP_NAMESPACE" << std::endl + << "{" << std::endl + << resultValueHeader + << createResultValueHeader; + generator.writeDelegationClassStatic(ofs); + ofs << deleterClassString; + + generator.writeTypes(ofs, defaultValues); + generator.writeStructureChainValidation(ofs); + generator.writeToStringFunctions(ofs); + + generator.writeDelegationClassDynamic(ofs); + + ofs << "} // namespace VULKAN_HPP_NAMESPACE" << std::endl + << std::endl + << "#endif" << std::endl; + } + catch (std::exception const& e) + { + std::cout << "caught exception: " << e.what() << std::endl; + return -1; + } + catch (...) + { + std::cout << "caught unknown exception" << std::endl; + return -1; + } +}