diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index cc72544..547c8aa 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -5682,7 +5682,6 @@ void VulkanHppGenerator::appendStructConstructorsEnhanced( std::string & if ( litit != lenIts.end() ) { // len arguments just have an initalizer, from the ArrayProxyNoTemporaries size - assert( ( litit->second.size() == 1 ) || !litit->second.front()->optional ); initializers += ( firstArgument ? ": " : ", " ) + mit->name + "( " + generateLenInitializer( mit, litit ) + " )"; sizeChecks += generateSizeCheck( litit->second, stripPrefix( structData.first, "Vk" ), prefix ); @@ -7162,16 +7161,16 @@ std::string std::string secondName = startLowerCase( stripPrefix( arrayIts[second]->name, "p" ) ) + "_"; std::string assertionCheck = firstName + ".size() == " + secondName + ".size()"; std::string throwCheck = firstName + ".size() != " + secondName + ".size()"; - if ( arrayIts[first]->optional || arrayIts[second]->optional ) + if ( ( !arrayIts[first]->optional.empty() && arrayIts[first]->optional.front() ) || ( !arrayIts[second]->optional.empty() && arrayIts[second]->optional.front() ) ) { assertionCheck = "( " + assertionCheck + " )"; throwCheck = "( " + throwCheck + " )"; - if ( arrayIts[second]->optional ) + if ( !arrayIts[second]->optional.empty() && arrayIts[second]->optional.front() ) { assertionCheck = secondName + ".empty() || " + assertionCheck; throwCheck = "!" + secondName + ".empty() && " + throwCheck; } - if ( arrayIts[first]->optional ) + if ( !arrayIts[first]->optional.empty() && arrayIts[first]->optional.front() ) { assertionCheck = firstName + ".empty() || " + assertionCheck; throwCheck = "!" + firstName + ".empty() && " + throwCheck; @@ -9288,7 +9287,12 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element, } else if ( attribute.first == "optional" ) { - memberData.optional = ( attribute.second == "true" ); + std::vector optional = tokenize( attribute.second, "," ); + memberData.optional.reserve( optional.size() ); + for ( auto const & o : optional ) + { + memberData.optional.push_back( o == "true" ); + } } else if ( attribute.first == "selection" ) { diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index ed4ebbe..c757be6 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -222,7 +222,7 @@ private: std::string bitCount; std::vector len; bool noAutoValidity = false; - bool optional = false; + std::vector optional; std::string selection; std::string selector; std::vector values; diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 54d4e25..a0081ec 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -17850,13 +17850,13 @@ namespace VULKAN_HPP_NAMESPACE , scratchData( scratchData_ ) { # ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( geometries_.size() == pGeometries_.size() ); + VULKAN_HPP_ASSERT( geometries_.empty() || pGeometries_.empty() || ( geometries_.size() == pGeometries_.size() ) ); # else - if ( geometries_.size() != pGeometries_.size() ) + if ( !geometries_.empty() && !pGeometries_.empty() && ( geometries_.size() != pGeometries_.size() ) ) { throw LogicError( VULKAN_HPP_NAMESPACE_STRING - "::AccelerationStructureBuildGeometryInfoKHR::AccelerationStructureBuildGeometryInfoKHR: geometries_.size() != pGeometries_.size()" ); + "::AccelerationStructureBuildGeometryInfoKHR::AccelerationStructureBuildGeometryInfoKHR: !geometries_.empty() && !pGeometries_.empty() && ( geometries_.size() != pGeometries_.size() )" ); } # endif /*VULKAN_HPP_NO_EXCEPTIONS*/ }