From 87fc3571c6f889538dd6b898835808e14d5602f5 Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Thu, 1 Oct 2020 13:32:23 +0200 Subject: [PATCH] Refactor simple functions getting a single value --- VulkanHppGenerator.cpp | 377 +++++++++++++++++++++++++++++++---------- VulkanHppGenerator.hpp | 24 ++- vulkan/vulkan.hpp | 69 +++++--- 3 files changed, 356 insertions(+), 114 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index afbb0d9..0f16d01 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1283,15 +1283,25 @@ void VulkanHppGenerator::appendCommand( std::string & str, { switch ( vectorParamIndices.size() ) { + case 0: + assert( nonConstPointerParamIndices.size() == 1 ); + if ( ( commandData.returnType == "VkResult" ) && + !isChainableStructure( commandData.params[*nonConstPointerParamIndices.begin()].type.type ) && + !isHandleType( commandData.params[*nonConstPointerParamIndices.begin()].type.type ) ) + { + appendCommandGetValue( str, name, commandData, nonConstPointerParamIndices.front(), definition ); + appendedFunction = true; + } + break; case 1: { // just one vector parameter auto vectorParamIndexIt = vectorParamIndices.begin(); - if ( commandData.params[vectorParamIndexIt->second].type.isValue() ) + if ( ( commandData.params[vectorParamIndexIt->second].type.isValue() ) && + ( commandData.params[vectorParamIndexIt->first].type.type == "void" ) ) { // the size of the vector parameter is given by a value -> just get that stuff assert( commandData.params[vectorParamIndexIt->first].type.isNonConstPointer() ); - assert( commandData.params[vectorParamIndexIt->first].type.type == "void" ); appendCommandGetVector( str, name, commandData, vectorParamIndices, definition ); appendedFunction = true; } @@ -1666,6 +1676,32 @@ ${commandEnhancedWithAllocators} { "newlineOnDefinition", definition ? "\n" : "" } } ) ); } +void VulkanHppGenerator::appendCommandGetValue( std::string & str, + std::string const & name, + CommandData const & commandData, + size_t nonConstPointerIndex, + bool definition ) const +{ + std::string const functionTemplate = R"( +${enter}${commandStandard}${newlineOnDefinition} +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE +${commandEnhanced} +#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ +${leave})"; + + std::string enter, leave; + std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); + + str += replaceWithMap( + functionTemplate, + std::map( + { { "commandEnhanced", constructCommandGetValue( name, commandData, nonConstPointerIndex, definition ) }, + { "commandStandard", constructCommandStandard( name, commandData, definition ) }, + { "enter", enter }, + { "leave", leave }, + { "newlineOnDefinition", definition ? "\n" : "" } } ) ); +} + void VulkanHppGenerator::appendCommandGetVector( std::string & str, std::string const & name, CommandData const & commandData, @@ -1678,9 +1714,9 @@ void VulkanHppGenerator::appendCommandGetVector( std::string & std::string const functionTemplate = R"( ${enter}${commandStandard}${newlineOnDefinition} #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE - ${commandDeprecated}${newlineOnDefinition} - ${commandEnhanced}${newlineOnDefinition} - ${commandEnhancedSingular} +${commandDeprecated}${newlineOnDefinition} +${commandEnhanced}${newlineOnDefinition} +${commandEnhancedSingular} #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ ${leave})"; @@ -2965,7 +3001,7 @@ bool VulkanHppGenerator::appendFunctionHeaderArgumentEnhanced( std::string & if ( param.type.postfix.empty() ) { // and its not a pointer -> just use its type and name here - appendFunctionHeaderArgumentEnhancedSimple( str, param, isLastArgument, withDefaults, withAllocator ); + str += param.type.compose() + " " + param.name + constructCArraySizes( param.arraySizes ); } else { @@ -3023,30 +3059,6 @@ void VulkanHppGenerator::appendFunctionHeaderArgumentEnhancedPointer( std::strin } } -void VulkanHppGenerator::appendFunctionHeaderArgumentEnhancedSimple( - std::string & str, ParamData const & param, bool lastArgument, bool withDefaults, bool withAllocator ) const -{ - str += param.type.compose() + " " + param.name + constructCArraySizes( param.arraySizes ); - - if ( withDefaults && lastArgument && !withAllocator ) - { - // 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( param.type.type ); - if ( bitmasksIt != m_bitmasks.end() ) - { - // get the enum corresponding to this flag, to check if it's empty - std::string strippedBitmaskName = stripPrefix( bitmasksIt->first, "Vk" ); - std::map::const_iterator enumIt = m_enums.find( bitmasksIt->second.requirements ); - assert( ( enumIt == m_enums.end() ) || ( enumIt->second.isBitmask ) ); - if ( ( enumIt == m_enums.end() ) || ( enumIt->second.values.empty() ) ) - { - // there are no bits in this flag -> provide the default - str += " VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT"; - } - } - } -} - void VulkanHppGenerator::appendFunctionHeaderArgumentEnhancedVector( std::string & str, ParamData const & param, std::string const & strippedParameterName, @@ -3757,7 +3769,7 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector const & skippedParams, bool definition ) const { - assert( ( skippedParams.size() == 1 ) && ( *skippedParams.begin() == 0 ) ); - - size_t defaultStartIndex = determineDefaultStartIndex( params ); + size_t defaultStartIndex = determineDefaultStartIndex( params, skippedParams ); std::string argumentList; - for ( size_t i = 1; i < params.size(); ++i ) + for ( size_t i = 0; i < params.size(); ++i ) { - argumentList += - params[i].type.compose() + " " + params[i].name + constructCArraySizes( params[i].arraySizes ) + - ( !definition && params[i].optional && ( defaultStartIndex <= i ) ? " VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT" - : "" ) + - ", "; + if ( skippedParams.find( i ) == skippedParams.end() ) + { + argumentList += + params[i].type.compose() + " " + params[i].name + constructCArraySizes( params[i].arraySizes ) + + ( !definition && params[i].optional && ( defaultStartIndex <= i ) ? " VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT" + : "" ) + + ", "; + } } argumentList += "Dispatch const & d "; return argumentList; @@ -3865,13 +3885,18 @@ std::string VulkanHppGenerator::constructArgumentListStandard( std::vector const & params, + size_t nonConstPointerIndex ) const +{ + std::string arguments; + size_t i = 0; + if ( !handle.empty() ) + { + assert( handle == params[0].type.type ); + arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) ); + ++i; + } + for ( ; i < params.size(); i++ ) + { + if ( 0 < i ) + { + arguments += ", "; + } + if ( i == nonConstPointerIndex ) + { + assert( beginsWith( params[i].name, "p" ) ); + std::string argument = "&" + startLowerCase( stripPrefix( params[i].name, "p" ) ); + if ( beginsWith( params[i].type.type, "Vk" ) ) + { + assert( params[i].arraySizes.empty() ); + argument = "reinterpret_cast<" + ( params[i].type.prefix.empty() ? "" : params[i].type.prefix ) + " " + + params[i].type.type + " " + params[i].type.postfix + ">( " + argument + " )"; + } + arguments += argument; + } + else + { + arguments += constructCallArgument( params[i], true ); + } + } + return arguments; +} + std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::vector const & params, std::pair const & vectorParamIndices, bool singular ) const @@ -3993,12 +4056,24 @@ std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::vector const & params ) const +std::string VulkanHppGenerator::constructCallArgumentsStandard( std::string const & handle, + std::vector const & params ) const { - std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) ); - for ( size_t i = 1; i < params.size(); i++ ) + std::string arguments; + size_t i = 0; + if ( !handle.empty() ) { - arguments += ", " + constructCallArgument( params[i], false ); + assert( handle == params[0].type.type ); + arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) ); + ++i; + } + for ( ; i < params.size(); i++ ) + { + if ( 0 < i ) + { + arguments += ", "; + } + arguments += constructCallArgument( params[i], false ); } return arguments; } @@ -4320,6 +4395,78 @@ std::string VulkanHppGenerator::constructCommandEnumerateVoid( std::string const return str; } +std::string VulkanHppGenerator::constructCommandGetValue( std::string const & name, + CommandData const & commandData, + size_t nonConstPointerIndex, + bool definition ) const +{ + std::string str; + + std::set skippedParams{ nonConstPointerIndex }; + if ( !commandData.handle.empty() ) + { + assert( commandData.params[0].type.type == commandData.handle ); + skippedParams.insert( 0 ); + } + + std::string argumentList = constructArgumentListEnhanced( commandData.params, skippedParams, definition, false ); + std::string commandName = determineCommandName( name, commandData.params[0].type.type ); + std::string nodiscard = constructNoDiscardEnhanced( commandData ); + std::string returnBaseType = commandData.params[nonConstPointerIndex].type.compose(); + assert( endsWith( returnBaseType, "*" ) ); + returnBaseType.pop_back(); + std::string returnType = constructReturnType( commandData, returnBaseType ); + + if ( definition ) + { + std::string const functionTemplate = + R"( template + ${nodiscard}VULKAN_HPP_INLINE ${returnType} ${className}${commandName}( ${argumentList} )${const} + { + ${returnBaseType} ${returnValueName}; + Result result = static_cast( d.${vkCommand}( ${callArguments} ) ); + return createResultValue( result, ${returnValueName}, VULKAN_HPP_NAMESPACE_STRING "::${className}${commandName}"${successCodeList} ); + })"; + + std::string className = stripPrefix( commandData.handle, "Vk" ); + if ( !className.empty() ) + { + className += "::"; + } + + str = replaceWithMap( + functionTemplate, + std::map( + { { "argumentList", argumentList }, + { "callArguments", + constructCallArgumentsGetValue( commandData.handle, commandData.params, nonConstPointerIndex ) }, + { "className", className }, + { "const", commandData.handle.empty() ? "" : " const" }, + { "commandName", commandName }, + { "returnBaseType", returnBaseType }, + { "returnValueName", startLowerCase( stripPrefix( commandData.params[nonConstPointerIndex].name, "p" ) ) }, + { "nodiscard", nodiscard }, + { "returnType", returnType }, + { "successCodeList", constructSuccessCodeList( commandData.successCodes ) }, + { "vkCommand", name } } ) ); + } + else + { + std::string const functionTemplate = + R"( template + ${nodiscard}${returnType} ${commandName}( ${argumentList} )${const};)"; + + str = replaceWithMap( functionTemplate, + std::map( { { "argumentList", argumentList }, + { "commandName", commandName }, + { "const", commandData.handle.empty() ? "" : " const" }, + { "nodiscard", nodiscard }, + { "returnType", returnType } } ) ); + } + + return str; +} + std::string VulkanHppGenerator::constructCommandGetVector( std::string const & name, CommandData const & commandData, std::map const & vectorParamIndices, @@ -4579,8 +4726,7 @@ std::string VulkanHppGenerator::constructCommandSimpleVoid( std::string const & ( commandData.params[vectorParamIndices.begin()->first].type.type == "void" ) ) ? "typename T, " : ""; - std::pair>> vectorSizeCheck = - needsVectorSizeCheck( vectorParamIndices ); + std::pair>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT"; if ( definition ) @@ -4602,7 +4748,7 @@ std::string VulkanHppGenerator::constructCommandSimpleVoid( std::string const & { "noexcept", noexceptString }, { "typenameT", typenameT }, { "vectorSizeCheck", - vectorSizeCheck.first ? constructVectorSizeCheck( name, commandData, vectorSizeCheck.second ) : "" }, + vectorSizeCheck.first ? constructVectorSizeCheck( name, commandData, vectorSizeCheck.second, skippedParameters ) : "" }, { "vkCommand", name } } ) ); } else @@ -4627,14 +4773,27 @@ std::string VulkanHppGenerator::constructCommandStandard( std::string const & na { std::string str; - std::string argumentList = constructArgumentListStandard( commandData.params, { 0 }, definition ); + std::set skippedParams; + if ( !commandData.handle.empty() ) + { + assert( commandData.params[0].type.type == commandData.handle ); + skippedParams.insert( 0 ); + } + + std::string argumentList = constructArgumentListStandard( commandData.params, skippedParams, definition ); std::string commandName = determineCommandName( name, commandData.params[0].type.type ); std::string nodiscard = constructNoDiscardStandard( commandData ); std::string returnType = stripPrefix( commandData.returnType, "Vk" ); if ( definition ) { - std::string functionBody = "d." + name + "( " + constructCallArgumentsStandard( commandData.params ) + " )"; + std::string className = stripPrefix( commandData.handle, "Vk" ); + if ( !className.empty() ) + { + className += "::"; + } + std::string functionBody = + "d." + name + "( " + constructCallArgumentsStandard( commandData.handle, commandData.params ) + " )"; if ( returnType != "void" ) { functionBody = "return static_cast<" + returnType + ">( " + functionBody + " )"; @@ -4642,29 +4801,30 @@ std::string VulkanHppGenerator::constructCommandStandard( std::string const & na std::string const functionTemplate = R"( template - ${nodiscard}VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT + ${nodiscard}VULKAN_HPP_INLINE ${returnType} ${className}${commandName}( ${argumentList} )${const} VULKAN_HPP_NOEXCEPT { ${functionBody}; })"; - str = - replaceWithMap( functionTemplate, - std::map( { { "argumentList", argumentList }, - { "className", stripPrefix( commandData.handle, "Vk" ) }, - { "commandName", commandName }, - { "functionBody", functionBody }, - { "nodiscard", nodiscard }, - { "returnType", returnType } } ) ); + str = replaceWithMap( functionTemplate, + std::map( { { "argumentList", argumentList }, + { "className", className }, + { "commandName", commandName }, + { "const", commandData.handle.empty() ? "" : " const" }, + { "functionBody", functionBody }, + { "nodiscard", nodiscard }, + { "returnType", returnType } } ) ); } else { std::string const functionTemplate = R"( template - ${nodiscard}${returnType} ${commandName}( ${argumentList} VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;)"; + ${nodiscard}${returnType} ${commandName}( ${argumentList} VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT )${const} VULKAN_HPP_NOEXCEPT;)"; str = replaceWithMap( functionTemplate, std::map( { { "argumentList", argumentList }, { "commandName", commandName }, + { "const", commandData.handle.empty() ? "" : " const" }, { "nodiscard", nodiscard }, { "returnType", returnType } } ) ); } @@ -4689,14 +4849,15 @@ std::string VulkanHppGenerator::constructCommandStandardVoid( std::string const d.${vkCommand}( ${callArguments} ); })"; - str = replaceWithMap( functionTemplate, - std::map( { - { "argumentList", argumentList }, - { "callArguments", constructCallArgumentsStandard( commandData.params ) }, - { "className", stripPrefix( commandData.handle, "Vk" ) }, - { "commandName", commandName }, - { "vkCommand", name }, - } ) ); + str = + replaceWithMap( functionTemplate, + std::map( { + { "argumentList", argumentList }, + { "callArguments", constructCallArgumentsStandard( commandData.handle, commandData.params ) }, + { "className", stripPrefix( commandData.handle, "Vk" ) }, + { "commandName", commandName }, + { "vkCommand", name }, + } ) ); } else { @@ -5052,7 +5213,8 @@ std::string VulkanHppGenerator::constructSuccessCodeList( std::vector> const & countToVectorMap ) const + std::map> const & countToVectorMap, + std::set const & skippedParams ) const { std::string str; @@ -5071,7 +5233,7 @@ std::string { assert( !commandData.params[cvm.second[0]].optional ); - size_t defaultStartIndex = determineDefaultStartIndex( commandData.params ); + size_t defaultStartIndex = determineDefaultStartIndex( commandData.params, skippedParams ); std::string firstVectorName = startLowerCase( stripPrefix( commandData.params[cvm.second[0]].name, "p" ) ); for ( size_t i = 1; i < cvm.second.size(); i++ ) @@ -6294,10 +6456,13 @@ bool VulkanHppGenerator::containsUnion( std::string const & type ) const return found; } -size_t VulkanHppGenerator::determineDefaultStartIndex( std::vector const & params ) const +size_t VulkanHppGenerator::determineDefaultStartIndex( std::vector const & params, + std::set const & skippedParams ) const { size_t defaultStartIndex = INVALID_INDEX; - for ( int i = static_cast( params.size() ) - 1; ( 0 <= i ) && params[i].optional; --i ) + for ( int i = static_cast( params.size() ) - 1; + ( 0 <= i ) && ( params[i].optional || ( skippedParams.find( i ) != skippedParams.end() ) ); + --i ) { defaultStartIndex = i; } @@ -6450,7 +6615,8 @@ std::vector VulkanHppGenerator::determineConstPointerParamIndices( std:: for ( size_t i = 0; i < params.size(); i++ ) { - if ( params[i].type.isConstPointer() ) + if ( params[i].type.isConstPointer() || + ( params[i].type.isNonConstPointer() && ( params[i].type.type == "Display" ) ) ) { constPointerParamIndices.push_back( i ); } @@ -6465,7 +6631,10 @@ std::vector for ( size_t i = 0; i < params.size(); i++ ) { - if ( params[i].type.isNonConstPointer() ) + // very special handling of parameters of type "Display", which is an X11 type that always comes as a non-const + // pointer but is not meant to be a potential return value! + assert( ( params[i].type.type != "Display" ) || params[i].type.isNonConstPointer() ); + if ( params[i].type.isNonConstPointer() && ( params[i].type.type != "Display" ) ) { nonConstPointerParamIndices.push_back( i ); } @@ -6512,18 +6681,13 @@ std::map { if ( !it->len.empty() ) { - auto findLambda = [it]( ParamData const & pd ) { - return pd.name == it->len; - }; - auto findIt = - std::find_if( params.begin(), it, findLambda ); // look for a parameter named as the len of this parameter - assert( ( std::count_if( params.begin(), params.end(), findLambda ) == 0 ) || - ( findIt < it ) ); // make sure, there is no other parameter like that + auto findIt = std::find_if( params.begin(), it, [this, ¶ms, &it]( ParamData const & pd ) { + return ( pd.name == it->len ) || isParamIndirect( it->len, params ); + } ); if ( findIt < it ) { - // 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) + // add this parameter as a vector parameter, using the len-name parameter as the second value vectorParamIndices.insert( std::make_pair( std::distance( params.begin(), it ), std::distance( params.begin(), findIt ) ) ); } @@ -6789,6 +6953,42 @@ std::set VulkanHppGenerator::getPlatforms( std::set co return platforms; } +bool VulkanHppGenerator::isChainableStructure( std::string const & type ) const +{ + if ( beginsWith( type, "Vk" ) ) + { + auto it = m_structures.find( type ); + if ( it == m_structures.end() ) + { + it = std::find_if( + m_structures.begin(), m_structures.end(), [&type]( std::pair const & sd ) { + return sd.second.aliases.find( type ) != sd.second.aliases.end(); + } ); + } + if ( it != m_structures.end() ) + { + return ( 1 < it->second.members.size() ) && ( it->second.members[1].name == "pNext" ); + } + } + return false; +} + +bool VulkanHppGenerator::isHandleType( std::string const & type ) const +{ + if ( beginsWith( type, "Vk" ) ) + { + auto it = m_handles.find( type ); + if ( it == m_handles.end() ) + { + it = std::find_if( m_handles.begin(), m_handles.end(), [&type]( std::pair const & hd ) { + return hd.second.alias == type; + } ); + } + return ( it != m_handles.end() ); + } + return false; +} + bool VulkanHppGenerator::isParam( std::string const & name, std::vector const & params ) const { return std::find_if( params.begin(), params.end(), [&name]( ParamData const & pd ) { return pd.name == name; } ) != @@ -6811,11 +7011,12 @@ bool VulkanHppGenerator::isParamIndirect( std::string const & name, std::vector< if ( paramIt != params.end() ) { auto structureIt = m_structures.find( paramIt->type.type ); - return ( structureIt != m_structures.end() ) && ( std::find_if( structureIt->second.members.begin(), - structureIt->second.members.end(), - [&n = nameParts[1]]( MemberData const & md ) { - return md.name == n; - } ) != structureIt->second.members.end() ); + assert( structureIt != m_structures.end() ); + assert( std::find_if( structureIt->second.members.begin(), + structureIt->second.members.end(), + [&n = nameParts[1]]( MemberData const & md ) { return md.name == n; } ) != + structureIt->second.members.end() ); + return true; } } return false; diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 0490653..d720135 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -326,6 +326,11 @@ private: CommandData const & commandData, std::pair const & vectorParamIndex, bool definition ) const; + void appendCommandGetValue( std::string & str, + std::string const & name, + CommandData const & commandData, + size_t nonConstPointerIndex, + bool definition ) const; void appendCommandGetVector( std::string & str, std::string const & name, CommandData const & commandData, @@ -459,8 +464,6 @@ private: std::string const & strippedParameterName, bool withDefaults, bool withAllocator ) const; - void appendFunctionHeaderArgumentEnhancedSimple( - std::string & str, ParamData const & param, bool lastArgument, bool withDefaults, bool withAllocator ) const; void appendFunctionHeaderArgumentEnhancedVector( std::string & str, ParamData const & param, std::string const & strippedParameterName, @@ -543,10 +546,13 @@ private: std::string constructCallArgumentsEnumerateVectors( std::vector const & params, std::map const & vectorParamIndices, bool vectorAsNullptr ) const; + std::string constructCallArgumentsGetValue( std::string const & handle, + std::vector const & params, + size_t skippedParams ) const; std::string constructCallArgumentsGetVector( std::vector const & params, std::pair const & vectorParamIndices, bool singular ) const; - std::string constructCallArgumentsStandard( std::vector const & params ) const; + std::string constructCallArgumentsStandard( std::string const & handle, std::vector const & params ) const; std::string constructCallArgumentsVectors( std::vector const & params, std::map const & vectorParamIndices ) const; std::string constructCommandEnumerateTwoVectors( std::string const & name, @@ -564,6 +570,10 @@ private: std::pair const & vectorParamIndex, bool definition, bool withAllocators ) const; + std::string constructCommandGetValue( std::string const & name, + CommandData const & commandData, + size_t nonConstPointerIndex, + bool definition ) const; std::string constructCommandGetVector( std::string const & name, CommandData const & commandData, std::map const & vectorParamIndices, @@ -630,11 +640,13 @@ private: std::string constructSuccessCodeList( std::vector const & successCodes ) const; std::string constructVectorSizeCheck( std::string const & name, CommandData const & commandData, - std::map> const & countToVectorMap ) const; + std::map> const & countToVectorMap, + std::set const & skippedParams ) const; void checkCorrectness(); bool containsArray( std::string const & type ) const; bool containsUnion( std::string const & type ) const; - size_t determineDefaultStartIndex( std::vector const & params ) const; + size_t determineDefaultStartIndex( std::vector const & params, + std::set const & skippedParams ) const; std::string determineEnhancedReturnType( CommandData const & commandData, size_t returnParamIndex, std::map const & vectorParamIndices, @@ -660,6 +672,8 @@ private: std::string const & structName, std::string const & prefix ) const; std::set getPlatforms( std::set const & extensions ) const; + bool isChainableStructure( std::string const & type ) const; + bool isHandleType( std::string const & type ) const; bool isParam( std::string const & name, std::vector const & params ) const; bool isParamIndirect( std::string const & name, std::vector const & params ) const; bool isTwoStepAlgorithm( std::vector const & params ) const; diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index fd7b36d..3a1fdbc 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -52028,11 +52028,11 @@ namespace VULKAN_HPP_NAMESPACE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD ResultValue - acquireNextImageKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, - uint64_t timeout, - VULKAN_HPP_NAMESPACE::Semaphore semaphore, - VULKAN_HPP_NAMESPACE::Fence fence, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + acquireNextImageKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, + uint64_t timeout, + VULKAN_HPP_NAMESPACE::Semaphore semaphore VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT, + VULKAN_HPP_NAMESPACE::Fence fence VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -60806,13 +60806,14 @@ namespace VULKAN_HPP_NAMESPACE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType::type - getExternalImageFormatPropertiesNV( VULKAN_HPP_NAMESPACE::Format format, - VULKAN_HPP_NAMESPACE::ImageType type, - VULKAN_HPP_NAMESPACE::ImageTiling tiling, - VULKAN_HPP_NAMESPACE::ImageUsageFlags usage, - VULKAN_HPP_NAMESPACE::ImageCreateFlags flags, - VULKAN_HPP_NAMESPACE::ExternalMemoryHandleTypeFlagsNV externalHandleType, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + getExternalImageFormatPropertiesNV( + VULKAN_HPP_NAMESPACE::Format format, + VULKAN_HPP_NAMESPACE::ImageType type, + VULKAN_HPP_NAMESPACE::ImageTiling tiling, + VULKAN_HPP_NAMESPACE::ImageUsageFlags usage, + VULKAN_HPP_NAMESPACE::ImageCreateFlags flags VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT, + VULKAN_HPP_NAMESPACE::ExternalMemoryHandleTypeFlagsNV externalHandleType VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -60926,12 +60927,12 @@ namespace VULKAN_HPP_NAMESPACE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType::type - getImageFormatProperties( VULKAN_HPP_NAMESPACE::Format format, - VULKAN_HPP_NAMESPACE::ImageType type, - VULKAN_HPP_NAMESPACE::ImageTiling tiling, - VULKAN_HPP_NAMESPACE::ImageUsageFlags usage, - VULKAN_HPP_NAMESPACE::ImageCreateFlags flags, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + getImageFormatProperties( VULKAN_HPP_NAMESPACE::Format format, + VULKAN_HPP_NAMESPACE::ImageType type, + VULKAN_HPP_NAMESPACE::ImageTiling tiling, + VULKAN_HPP_NAMESPACE::ImageUsageFlags usage, + VULKAN_HPP_NAMESPACE::ImageCreateFlags flags VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template @@ -89418,8 +89419,8 @@ namespace VULKAN_HPP_NAMESPACE #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template - Result enumerateInstanceVersion( uint32_t * pApiVersion, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) VULKAN_HPP_NOEXCEPT; + VULKAN_HPP_NODISCARD Result enumerateInstanceVersion( + uint32_t * pApiVersion, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) VULKAN_HPP_NOEXCEPT; #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template typename ResultValueType::type @@ -89611,10 +89612,12 @@ namespace VULKAN_HPP_NAMESPACE #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ template - VULKAN_HPP_INLINE Result enumerateInstanceVersion( uint32_t * pApiVersion, Dispatch const & d ) VULKAN_HPP_NOEXCEPT + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result enumerateInstanceVersion( uint32_t * pApiVersion, + Dispatch const & d ) VULKAN_HPP_NOEXCEPT { return static_cast( d.vkEnumerateInstanceVersion( pApiVersion ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_INLINE typename ResultValueType::type enumerateInstanceVersion( Dispatch const & d ) @@ -92206,6 +92209,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkAcquireNextImage2KHR( m_device, reinterpret_cast( pAcquireInfo ), pImageIndex ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ResultValue @@ -92237,6 +92241,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( fence ), pImageIndex ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ResultValue @@ -97568,6 +97573,7 @@ namespace VULKAN_HPP_NAMESPACE reinterpret_cast( pSurfaceInfo ), reinterpret_cast( pModes ) ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -97596,6 +97602,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( surface ), reinterpret_cast( pModes ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -97749,6 +97756,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetFenceFdKHR( m_device, reinterpret_cast( pGetFdInfo ), pFd ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -97789,6 +97797,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetFenceWin32HandleKHR( m_device, reinterpret_cast( pGetWin32HandleInfo ), pHandle ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -98238,6 +98247,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetMemoryAndroidHardwareBufferANDROID( m_device, reinterpret_cast( pInfo ), pBuffer ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -98262,6 +98272,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetMemoryFdKHR( m_device, reinterpret_cast( pGetFdInfo ), pFd ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -98348,6 +98359,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetMemoryWin32HandleKHR( m_device, reinterpret_cast( pGetWin32HandleInfo ), pHandle ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -98375,6 +98387,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( handleType ), pHandle ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -98520,6 +98533,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( parameter ), reinterpret_cast( pValue ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -99233,6 +99247,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( swapchain ), reinterpret_cast( pDisplayTimingProperties ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -99277,6 +99292,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetSemaphoreCounterValue( m_device, static_cast( semaphore ), pValue ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -99296,6 +99312,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetSemaphoreCounterValueKHR( m_device, static_cast( semaphore ), pValue ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -99317,6 +99334,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetSemaphoreFdKHR( m_device, reinterpret_cast( pGetFdInfo ), pFd ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -99339,6 +99357,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetSemaphoreWin32HandleKHR( m_device, reinterpret_cast( pGetWin32HandleInfo ), pHandle ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -99460,6 +99479,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( counter ), pCounterValue ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -99792,6 +99812,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( flags ), ppData ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -101809,6 +101830,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkAcquireXlibDisplayEXT( m_physicalDevice, dpy, static_cast( display ) ) ); } + # ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type @@ -102453,6 +102475,7 @@ namespace VULKAN_HPP_NAMESPACE planeIndex, reinterpret_cast( pCapabilities ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -103098,6 +103121,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( externalHandleType ), reinterpret_cast( pExternalImageFormatProperties ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -103358,6 +103382,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( flags ), reinterpret_cast( pImageFormatProperties ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -104381,6 +104406,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( surface ), reinterpret_cast( pSurfaceCapabilities ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE @@ -104740,6 +104766,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( surface ), reinterpret_cast( pSupported ) ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type