From 2b47c6f9e50cecb0a73687d4aeeeae72ba0aa02c Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Mon, 19 Oct 2020 09:40:40 +0200 Subject: [PATCH] Refactor command that returns a vector of values and a single value. --- VulkanHppGenerator.cpp | 421 +++++++++++++++++++++++++++++++---------- VulkanHppGenerator.hpp | 192 ++++++++++--------- vulkan/vulkan.hpp | 127 ++++++++++--- 3 files changed, 521 insertions(+), 219 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 83d14b1..089b0f9 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1265,8 +1265,8 @@ void VulkanHppGenerator::appendCommand( std::string & str, { // two returns but just one vector -> the size is a return value as well -> enumerate the values auto vectorParamIndexIt = vectorParamIndices.begin(); - assert( ( vectorParamIndexIt->second == *nonConstPointerParamIndices.begin() ) && - ( vectorParamIndexIt->first == *std::next( nonConstPointerParamIndices.begin() ) ) ); + assert( ( vectorParamIndexIt->second == nonConstPointerParamIndices[0] ) && + ( vectorParamIndexIt->first == nonConstPointerParamIndices[1] ) ); if ( ( commandData.returnType == "void" ) && !determineStructureChaining( commandData.params[vectorParamIndexIt->first].type.type, m_extendedStructs ) ) @@ -1278,6 +1278,19 @@ void VulkanHppGenerator::appendCommand( std::string & str, } } break; + case 2: + { + // two returns and two vectors! But one input vector, one output vector of the same size, and one output value + assert( vectorParamIndices.find( nonConstPointerParamIndices[0] ) != vectorParamIndices.end() ); + assert( vectorParamIndices.find( nonConstPointerParamIndices[1] ) == vectorParamIndices.end() ); + assert( commandData.returnType == "VkResult" ); + // provide standard, enhanced deprecated, enhanced, and enhanced with allocator calls + appendCommandStandardEnhancedDeprecatedAllocator( + str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices ); + appendedFunction = true; + } + break; + default: break; } break; case 3: @@ -1502,12 +1515,12 @@ ${leave})"; std::map( { { "commandEnhanced", ( commandData.returnType == "void" ) - ? constructCommandVoidGetValue( name, commandData, nonConstPointerIndex, definition ) - : constructCommandResultGetValue( name, commandData, nonConstPointerIndex, definition ) }, + ? constructCommandVoidGetValue( name, commandData, definition, nonConstPointerIndex ) + : constructCommandResultGetValue( name, commandData, definition, nonConstPointerIndex ) }, { "commandEnhancedChained", ( commandData.returnType == "void" ) - ? constructCommandVoidGetChain( name, commandData, nonConstPointerIndex, definition ) - : constructCommandResultGetChain( name, commandData, nonConstPointerIndex, definition ) }, + ? constructCommandVoidGetChain( name, commandData, definition, nonConstPointerIndex ) + : constructCommandResultGetChain( name, commandData, definition, nonConstPointerIndex ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "enter", enter }, { "leave", leave }, @@ -1526,7 +1539,7 @@ void VulkanHppGenerator::appendCommandSingular( std::string & std::string const functionTemplate = R"( ${enter}${commandStandard}${newlineOnDefinition} #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE -${commandDeprecated}${newlineOnDefinition} +${commandEnhancedDeprecated}${newlineOnDefinition} ${commandEnhanced}${newlineOnDefinition} ${commandEnhancedSingular} #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ @@ -1539,13 +1552,13 @@ ${leave})"; functionTemplate, std::map( { { "commandEnhanced", - constructCommandResultGetVector( name, commandData, vectorParamIndices, returnParamIndex, definition ) }, - { "commandDeprecated", + constructCommandResultGetVector( name, commandData, definition, vectorParamIndices, returnParamIndex ) }, + { "commandEnhancedDeprecated", constructCommandResultGetVectorDeprecated( - name, commandData, vectorParamIndices, returnParamIndex, definition ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex ) }, { "commandEnhancedSingular", constructCommandResultGetVectorSingular( - name, commandData, vectorParamIndices, returnParamIndex, definition ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "enter", enter }, { "leave", leave }, @@ -1609,7 +1622,7 @@ ${leave})"; assert( vectorParamIndices.begin()->second != INVALID_INDEX ); assert( vectorParamIndices.begin()->second == std::next( vectorParamIndices.begin() )->second ); assert( commandData.params[vectorParamIndices.begin()->second].type.isValue() ); - commandEnhanced = constructCommandResultGetTwoVectors( name, commandData, vectorParamIndices, definition ); + commandEnhanced = constructCommandResultGetTwoVectors( name, commandData, definition, vectorParamIndices ); } } else @@ -1620,8 +1633,8 @@ ${leave})"; case 1: commandEnhanced = ( commandData.returnType == "void" ) - ? constructCommandVoidGetValue( name, commandData, nonConstPointerParamIndices[0], definition ) - : constructCommandResultGetValue( name, commandData, nonConstPointerParamIndices[0], definition ); + ? constructCommandVoidGetValue( name, commandData, definition, nonConstPointerParamIndices[0] ) + : constructCommandResultGetValue( name, commandData, definition, nonConstPointerParamIndices[0] ); break; default: assert( false ); break; } @@ -1635,6 +1648,49 @@ ${leave})"; { "newlineOnDefinition", definition ? "\n" : "" } } ) ); } +void VulkanHppGenerator::appendCommandStandardEnhancedDeprecatedAllocator( + std::string & str, + std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + std::vector const & nonConstPointerParamIndices ) const +{ + assert( ( vectorParamIndices.size() == 2 ) && ( nonConstPointerParamIndices.size() == 2 ) ); + assert( vectorParamIndices.find( nonConstPointerParamIndices[0] ) != vectorParamIndices.end() ); + assert( vectorParamIndices.find( nonConstPointerParamIndices[1] ) == vectorParamIndices.end() ); + assert( commandData.returnType == "VkResult" ); + + const std::string functionTemplate = R"( +${enter}${commandStandard}${newlineOnDefinition} +#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE +${commandEnhancedDeprecated}${newlineOnDefinition} +${commandEnhanced}${newlineOnDefinition} +${commandEnhancedWithAllocator} +#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", + constructCommandResultGetVectorAndValue( + name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices, false ) }, + { "commandEnhancedDeprecated", + constructCommandResultGetValueDeprecated( + name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices[1] ) }, + { "commandEnhancedWithAllocator", + constructCommandResultGetVectorAndValue( + name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices, true ) }, + { "commandStandard", constructCommandStandard( name, commandData, definition ) }, + { "enter", enter }, + { "leave", leave }, + { "newlineOnDefinition", definition ? "\n" : "" } } ) ); +} + void VulkanHppGenerator::appendCommandStandardOrEnhanced( std::string & str, std::string const & name, CommandData const & commandData, @@ -1684,9 +1740,9 @@ ${leave})"; str += replaceWithMap( functionTemplate, std::map( - { { "commandEnhanced", constructCommandResultGetValue( name, commandData, nonConstPointerIndex, definition ) }, + { { "commandEnhanced", constructCommandResultGetValue( name, commandData, definition, nonConstPointerIndex ) }, { "commandEnhancedUnique", - constructCommandResultGetHandleUnique( name, commandData, nonConstPointerIndex, definition ) }, + constructCommandResultGetHandleUnique( name, commandData, definition, nonConstPointerIndex ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "enter", enter }, { "leave", leave }, @@ -1716,9 +1772,9 @@ ${commandEnhancedWithAllocators} str += replaceWithMap( functionTemplate, std::map( - { { "commandEnhanced", constructCommandVoidEnumerate( name, commandData, vectorParamIndex, definition, false ) }, + { { "commandEnhanced", constructCommandVoidEnumerate( name, commandData, definition, vectorParamIndex, false ) }, { "commandEnhancedWithAllocators", - constructCommandVoidEnumerate( name, commandData, vectorParamIndex, definition, true ) }, + constructCommandVoidEnumerate( name, commandData, definition, vectorParamIndex, true ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "newlineOnDefinition", definition ? "\n" : "" } } ) ); } @@ -1750,15 +1806,15 @@ ${commandEnhancedWithAllocators} functionTemplate, std::map( { { "commandEnhanced", - constructCommandResultEnumerateTwoVectors( name, commandData, vectorParamIndices, definition, false ) }, + constructCommandResultEnumerateTwoVectors( name, commandData, definition, vectorParamIndices, false ) }, { "commandEnhancedDeprecated", constructCommandResultEnumerateTwoVectorsDeprecated( - name, commandData, vectorParamIndices, definition, false ) }, + name, commandData, definition, vectorParamIndices, false ) }, { "commandEnhancedWithAllocators", - constructCommandResultEnumerateTwoVectors( name, commandData, vectorParamIndices, definition, true ) }, + constructCommandResultEnumerateTwoVectors( name, commandData, definition, vectorParamIndices, true ) }, { "commandEnhancedWithAllocatorsDeprecated", constructCommandResultEnumerateTwoVectorsDeprecated( - name, commandData, vectorParamIndices, definition, true ) }, + name, commandData, definition, vectorParamIndices, true ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "newlineOnDefinition", definition ? "\n" : "" } } ) ); } @@ -1793,22 +1849,22 @@ ${leave})"; std::map( { { "commandEnhanced", constructCommandResultGetVectorOfHandles( - name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, false ) }, { "commandEnhancedSingular", constructCommandResultGetVectorOfHandlesSingular( - name, commandData, vectorParamIndices, returnParamIndex, definition ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex ) }, { "commandEnhancedUnique", constructCommandResultGetVectorOfHandlesUnique( - name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, false ) }, { "commandEnhancedUniqueSingular", constructCommandResultGetVectorOfHandlesUniqueSingular( - name, commandData, vectorParamIndices, returnParamIndex, definition ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex ) }, { "commandEnhancedUniqueWithAllocators", constructCommandResultGetVectorOfHandlesUnique( - name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, true ) }, { "commandEnhancedWithAllocators", constructCommandResultGetVectorOfHandles( - name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, true ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "enter", enter }, { "leave", leave }, @@ -1843,16 +1899,16 @@ ${leave})"; std::map( { { "commandEnhanced", constructCommandResultGetVectorOfHandles( - name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, false ) }, { "commandEnhancedUnique", constructCommandResultGetVectorOfHandlesUnique( - name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, false ) }, { "commandEnhancedUniqueWithAllocators", constructCommandResultGetVectorOfHandlesUnique( - name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, true ) }, { "commandEnhancedWithAllocators", constructCommandResultGetVectorOfHandles( - name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, + name, commandData, definition, vectorParamIndices, returnParamIndex, true ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "enter", enter }, { "leave", leave }, @@ -3577,8 +3633,6 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector( " + - startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )"; - break; - case 2: - arguments += "reinterpret_cast<" + params[i].type.type + " *>( enumeratedData." + - ( ( vectorParamIndices.find( i ) == vectorParamIndices.begin() ) ? "first" : "second" ) + - ".data() )"; - break; - default: assert( false ); - } + arguments += "reinterpret_cast<" + params[i].type.compose( false ) + ">( " + + startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )"; } } else @@ -3779,25 +3821,41 @@ std::string VulkanHppGenerator::constructCallArgumentsGetValue( std::string cons } std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::vector const & params, + std::vector const & returnParamIndices, std::map const & vectorParamIndices, - size_t returnParamIndex, bool singular ) const { std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) ); for ( size_t i = 1; i < params.size(); i++ ) { arguments += ", "; - if ( ( i == returnParamIndex ) || ( vectorParamIndices.find( i ) != vectorParamIndices.end() ) ) + auto vpiIt = vectorParamIndices.find( i ); + if ( ( std::find_if( returnParamIndices.begin(), + returnParamIndices.end(), + [&i]( size_t rpi ) { return i == rpi; } ) != returnParamIndices.end() ) || + ( vpiIt != vectorParamIndices.end() ) ) { - if ( singular ) + if ( vpiIt == vectorParamIndices.end() ) { - arguments += "reinterpret_cast<" + params[i].type.compose( false ) + ">( &" + - stripPluralS( startLowerCase( stripPrefix( params[i].name, "p" ) ) ) + " )"; + assert( !beginsWith( params[i].type.type, "Vk" ) ); + arguments += "&" + startLowerCase( stripPrefix( params[i].name, "p" ) ); } else { - arguments += "reinterpret_cast<" + params[i].type.compose( false ) + ">( " + - startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )"; + if ( singular ) + { + arguments += "reinterpret_cast<" + params[i].type.compose( false ) + ">( &" + + stripPluralS( startLowerCase( stripPrefix( params[i].name, "p" ) ) ) + " )"; + } + else + { + std::string argument = startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data()"; + if ( beginsWith( params[i].type.type, "Vk" ) || ( params[i].type.type == "void" ) ) + { + argument = "reinterpret_cast<" + params[i].type.compose( false ) + ">( " + argument + " )"; + } + arguments += argument; + } } } else @@ -3971,8 +4029,8 @@ std::string VulkanHppGenerator::constructCommandResult( std::string const & std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectors( std::string const & name, CommandData const & commandData, - std::map const & vectorParamIndices, bool definition, + std::map const & vectorParamIndices, bool withAllocators ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4004,7 +4062,9 @@ std::string R"( template ${nodiscard}VULKAN_HPP_INLINE typename ResultValueType, std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator>>>::type ${className}::${commandName}( ${argumentList} ) const { - std::pair, std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator>> enumeratedData${pairConstructor}; + std::pair, std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator>> data${pairConstructor}; + std::vector<${templateTypeFirst}, ${templateTypeFirst}Allocator> & ${firstVectorName} = data.first; + std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator> & ${secondVectorName} = data.second; ${counterType} ${counterName}; Result result; do @@ -4012,28 +4072,23 @@ std::string result = static_cast( d.${vkCommand}( ${firstCallArguments} ) ); if ( ( result == Result::eSuccess ) && counterCount ) { - enumeratedData.first.resize( ${counterName} ); - enumeratedData.second.resize( ${counterName} ); + ${firstVectorName}.resize( ${counterName} ); + ${secondVectorName}.resize( ${counterName} ); result = static_cast( d.${vkCommand}( ${secondCallArguments} ) ); - VULKAN_HPP_ASSERT( ${counterName} <= enumeratedData.first.size() ); + VULKAN_HPP_ASSERT( ${counterName} <= ${firstVectorName}.size() ); } } while ( result == Result::eIncomplete ); - if ( ( result == Result::eSuccess ) && ( ${counterName} < enumeratedData.first.size() ) ) + if ( ( result == Result::eSuccess ) && ( ${counterName} < ${firstVectorName}.size() ) ) { - enumeratedData.first.resize( ${counterName} ); - enumeratedData.second.resize( ${counterName} ); + ${firstVectorName}.resize( ${counterName} ); + ${secondVectorName}.resize( ${counterName} ); } - return createResultValue( result, enumeratedData, VULKAN_HPP_NAMESPACE_STRING"::${className}::${commandName}" ); + return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING"::${className}::${commandName}" ); })"; assert( beginsWith( commandData.params[firstVectorParamIt->first].name, "p" ) ); assert( beginsWith( commandData.params[firstVectorParamIt->second].name, "p" ) ); assert( beginsWith( commandData.params[secondVectorParamIt->first].name, "p" ) ); - std::string firstVectorName = - startLowerCase( stripPrefix( commandData.params[firstVectorParamIt->first].name, "p" ) ); - std::string secondVectorName = - startLowerCase( stripPrefix( commandData.params[secondVectorParamIt->first].name, "p" ) ); - std::string withAllocatorsTypenameCheck = ", typename B1, typename B2, typename std::enable_if::value && std::is_same::value, int>::type "; @@ -4049,6 +4104,8 @@ std::string { "counterType", commandData.params[firstVectorParamIt->second].type.type }, { "firstCallArguments", constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, true ) }, + { "firstVectorName", + startLowerCase( stripPrefix( commandData.params[firstVectorParamIt->first].name, "p" ) ) }, { "nodiscard", nodiscard }, { "pairConstructor", withAllocators @@ -4060,6 +4117,8 @@ std::string : "" }, { "secondCallArguments", constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, false ) }, + { "secondVectorName", + startLowerCase( stripPrefix( commandData.params[secondVectorParamIt->first].name, "p" ) ) }, { "templateTypeFirst", templateTypeFirst }, { "templateTypeSecond", templateTypeSecond }, { "vkCommand", name }, @@ -4091,8 +4150,8 @@ std::string std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectorsDeprecated( std::string const & name, CommandData const & commandData, - std::map const & vectorParamIndices, bool definition, + std::map const & vectorParamIndices, bool withAllocators ) const { std::string str; @@ -4166,8 +4225,8 @@ std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectorsDepreca std::string VulkanHppGenerator::constructCommandResultGetChain( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const + bool definition, + size_t nonConstPointerIndex ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) && ( commandData.successCodes.size() == 1 ) && !commandData.errorCodes.empty() ); @@ -4224,8 +4283,8 @@ std::string VulkanHppGenerator::constructCommandResultGetChain( std::string cons std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const + bool definition, + size_t nonConstPointerIndex ) const { assert( ( commandData.returnType == "VkResult" ) && ( commandData.successCodes.size() == 1 ) ); @@ -4325,8 +4384,8 @@ std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::stri std::string VulkanHppGenerator::constructCommandResultGetTwoVectors( std::string const & name, CommandData const & commandData, - std::map const & vectorParamIndices, - bool definition ) const + bool definition, + std::map const & vectorParamIndices ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4389,8 +4448,8 @@ std::string std::string VulkanHppGenerator::constructCommandResultGetValue( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const + bool definition, + size_t nonConstPointerIndex ) const { assert( commandData.returnType == "VkResult" ); @@ -4462,11 +4521,76 @@ std::string VulkanHppGenerator::constructCommandResultGetValue( std::string cons return str; } +std::string + VulkanHppGenerator::constructCommandResultGetValueDeprecated( std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + size_t returnParamIndex ) const +{ + assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); + assert( ( vectorParamIndices.find( returnParamIndex ) == vectorParamIndices.end() ) ); + + std::string str; + + std::string argumentList = constructFunctionHeaderArgumentsEnhanced( + commandData, returnParamIndex, INVALID_INDEX, vectorParamIndices, !definition, false ); + std::string commandName = determineCommandName( name, commandData.params[0].type.type ); + std::string nodiscard = constructNoDiscardEnhanced( commandData ); + + assert( !beginsWith( commandData.params[returnParamIndex].type.type, "Vk" ) ); + std::string returnType = commandData.params[returnParamIndex].type.type; + + if ( definition ) + { + std::string const functionTemplate = + R"( template + VULKAN_HPP_DEPRECATED( "This function is deprecated. Use one of the other flavours of it.") + ${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<${returnType}>::type ${className}::${commandName}( ${argumentList} ) const + { + ${functionBody} + })"; + + str = + replaceWithMap( functionTemplate, + std::map( { { "argumentList", argumentList }, + { "className", stripPrefix( commandData.handle, "Vk" ) }, + { "commandName", commandName }, + { "functionBody", + constructFunctionBodyEnhanced( " ", + name, + commandData, + returnParamIndex, + INVALID_INDEX, + vectorParamIndices, + false, + returnType, + false, + false ) }, + { "nodiscard", nodiscard }, + { "returnType", returnType } } ) ); + } + else + { + std::string const functionTemplate = + R"( template + ${nodiscard}typename ResultValueType<${returnType}>::type ${commandName}( ${argumentList} ) const;)"; + + str = replaceWithMap( functionTemplate, + std::map( { { "argumentList", argumentList }, + { "commandName", commandName }, + { "nodiscard", nodiscard }, + { "returnType", returnType } } ) ); + } + + return str; +} + std::string VulkanHppGenerator::constructCommandResultGetVector( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const + size_t returnParamIndex ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4495,7 +4619,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVector( std::string con std::map( { { "argumentList", argumentList }, { "callArguments", - constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, false ) }, + constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, false ) }, { "className", stripPrefix( commandData.handle, "Vk" ) }, { "commandName", commandName }, { "dataName", startLowerCase( stripPrefix( commandData.params[returnParamIndex].name, "p" ) ) }, @@ -4521,12 +4645,105 @@ std::string VulkanHppGenerator::constructCommandResultGetVector( std::string con return str; } +std::string + VulkanHppGenerator::constructCommandResultGetVectorAndValue( std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + std::vector const & returnParamIndices, + bool withAllocator ) const +{ + assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); + assert( ( vectorParamIndices.size() == 2 ) && ( returnParamIndices.size() == 2 ) ); + assert( vectorParamIndices.find( returnParamIndices[0] ) != vectorParamIndices.end() ); + assert( vectorParamIndices.find( returnParamIndices[1] ) == vectorParamIndices.end() ); + assert( vectorParamIndices.begin()->second == std::next( vectorParamIndices.begin() )->second ); + assert( commandData.returnType == "VkResult" ); + + std::string str; + + std::set skippedParameters = { + 0, vectorParamIndices.begin()->second, returnParamIndices[0], returnParamIndices[1] + }; + + std::string argumentList = + constructArgumentListEnhanced( commandData.params, skippedParameters, INVALID_INDEX, definition, withAllocator ); + std::string commandName = determineCommandName( name, commandData.params[0].type.type ); + std::string nodiscard = constructNoDiscardEnhanced( commandData ); + std::string returnType = constructReturnType( commandData, "std::vector" ); + + assert( !beginsWith( commandData.params[returnParamIndices[0]].type.type, "Vk" ) ); + std::string vectorElementType = commandData.params[returnParamIndices[0]].type.type; + std::string allocatorType = startUpperCase( vectorElementType ) + "Allocator"; + assert( !beginsWith( commandData.params[returnParamIndices[1]].type.type, "Vk" ) ); + std::string valueType = commandData.params[returnParamIndices[1]].type.type; + + if ( definition ) + { + std::string const functionTemplate = + R"( template + ${nodiscard}VULKAN_HPP_INLINE typename ResultValueType, ${valueType}>>::type ${className}::${commandName}( ${argumentList} ) const + { + std::pair,${valueType}> data( std::piecewise_construct, std::forward_as_tuple( ${vectorSize}${allocateInitializer} ), std::forward_as_tuple( 0 ) ); + std::vector<${vectorElementType}, ${allocatorType}> & ${vectorName} = data.first; + ${valueType} & ${valueName} = data.second; + Result result = static_cast( d.${vkCommand}( ${callArguments} ) ); + return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}"${successCodeList} ); + })"; + + std::string typenameCheck = ", typename B, typename std::enable_if::value, int>::type "; + + str = replaceWithMap( + functionTemplate, + std::map( + { { "allocateInitializer", withAllocator ? ( ", " + vectorElementType + "Allocator" ) : "" }, + { "allocatorType", allocatorType }, + { "argumentList", argumentList }, + { "callArguments", + constructCallArgumentsGetVector( commandData.params, returnParamIndices, vectorParamIndices, false ) }, + { "className", stripPrefix( commandData.handle, "Vk" ) }, + { "commandName", commandName }, + { "nodiscard", nodiscard }, + { "successCodeList", constructSuccessCodeList( commandData.successCodes ) }, + { "typenameCheck", withAllocator ? typenameCheck : "" }, + { "valueName", startLowerCase( stripPrefix( commandData.params[returnParamIndices[1]].name, "p" ) ) }, + { "valueType", valueType }, + { "vectorElementType", vectorElementType }, + { "vectorName", startLowerCase( stripPrefix( commandData.params[returnParamIndices[0]].name, "p" ) ) }, + { "vectorSize", + startLowerCase( stripPrefix( commandData.params[vectorParamIndices.begin()->first].name, "p" ) ) + + ".size()" }, + { "vkCommand", name } } ) ); + } + else + { + std::string const functionTemplate = + R"( template , typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${typenameCheck}> + ${nodiscard}typename ResultValueType, ${valueType}>>::type ${commandName}( ${argumentList} ) const;)"; + + std::string typenameCheck = ", typename B = " + allocatorType + + ", typename std::enable_if::value, int>::type = 0"; + + str = replaceWithMap( functionTemplate, + std::map( { { "allocatorType", allocatorType }, + { "argumentList", argumentList }, + { "commandName", commandName }, + { "nodiscard", nodiscard }, + { "typenameCheck", withAllocator ? typenameCheck : "" }, + { "valueType", valueType }, + { "vectorElementType", vectorElementType } } ) ); + } + return str; +} + std::string VulkanHppGenerator::constructCommandResultGetVectorDeprecated( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const + size_t returnParamIndex ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4586,9 +4803,9 @@ std::string std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandles( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, size_t returnParamIndex, - bool definition, bool withAllocator ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4628,7 +4845,7 @@ std::string std::map( { { "argumentList", argumentList }, { "callArguments", - constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, false ) }, + constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, false ) }, { "className", stripPrefix( commandData.handle, "Vk" ) }, { "commandName", commandName }, { "nodiscard", nodiscard }, @@ -4667,9 +4884,9 @@ std::string std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const + size_t returnParamIndex ) const { assert( !commandData.handle.empty() ); assert( ( vectorParamIndices.size() == 2 ) && @@ -4709,7 +4926,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular std::map( { { "argumentList", argumentList }, { "callArguments", - constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, true ) }, + constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, true ) }, { "className", stripPrefix( commandData.handle, "Vk" ) }, { "commandName", commandName }, { "nodiscard", nodiscard }, @@ -4739,9 +4956,9 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, size_t returnParamIndex, - bool definition, bool withAllocator ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4817,7 +5034,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique( std::map( { { "argumentList", argumentList }, { "callArguments", - constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, false ) }, + constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, false ) }, { "className", className }, { "commandName", commandName }, { "deleterDefinition", deleterDefinition }, @@ -4860,9 +5077,9 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique( std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSingular( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const + size_t returnParamIndex ) const { assert( !commandData.handle.empty() ); assert( ( vectorParamIndices.size() == 2 ) && @@ -4903,7 +5120,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSi std::map( { { "argumentList", argumentList }, { "callArguments", - constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, true ) }, + constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, true ) }, { "className", stripPrefix( commandData.handle, "Vk" ) }, { "commandName", commandName }, { "handleName", @@ -4935,9 +5152,9 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSi std::string VulkanHppGenerator::constructCommandResultGetVectorSingular( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const + size_t returnParamIndex ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); @@ -4969,7 +5186,7 @@ std::string std::map( { { "argumentList", argumentList }, { "callArguments", - constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, true ) }, + constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, true ) }, { "className", stripPrefix( commandData.handle, "Vk" ) }, { "commandName", commandName }, { "dataName", startLowerCase( stripPrefix( commandData.params[returnParamIndex].name, "p" ) ) }, @@ -5064,8 +5281,8 @@ std::string VulkanHppGenerator::constructCommandStandard( std::string const & na std::string VulkanHppGenerator::constructCommandVoidGetChain( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const + bool definition, + size_t nonConstPointerIndex ) const { assert( !commandData.handle.empty() && ( commandData.returnType == "void" ) && commandData.successCodes.empty() && commandData.errorCodes.empty() ); @@ -5252,8 +5469,8 @@ std::string VulkanHppGenerator::constructCommandVoid( std::string const & std::string VulkanHppGenerator::constructCommandVoidEnumerate( std::string const & name, CommandData const & commandData, - std::pair const & vectorParamIndex, bool definition, + std::pair const & vectorParamIndex, bool withAllocators ) const { assert( !commandData.handle.empty() && commandData.params[0].type.type == commandData.handle && @@ -5332,8 +5549,8 @@ std::string VulkanHppGenerator::constructCommandVoidEnumerate( std::string const std::string VulkanHppGenerator::constructCommandVoidGetValue( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const + bool definition, + size_t nonConstPointerIndex ) const { assert( !commandData.handle.empty() ); assert( ( commandData.returnType == "void" ) && commandData.successCodes.empty() && commandData.errorCodes.empty() ); diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 43f7e7d..a1c12e3 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -272,68 +272,75 @@ private: }; private: - void appendArgumentPlainType( std::string & str, ParamData const & paramData ) const; - void appendArguments( std::string & str, - CommandData const & commandData, - size_t returnParamIndex, - size_t templateParamIndex, - std::map const & vectorParamIndices, - bool twoStep, - bool firstCall, - size_t from, - size_t to ) const; - void appendArgumentVector( std::string & str, - size_t paramIndex, - ParamData const & paramData, - size_t returnParamIndex, - size_t templateParamIndex, - bool twoStep, - bool firstCall ) const; - void appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const; - void appendBitmask( std::string & os, - std::string const & bitmaskName, - std::string const & bitmaskType, - std::string const & bitmaskAlias, - std::string const & enumName, - std::vector const & enumValues ) const; - void appendBitmaskToStringFunction( std::string & str, - std::string const & flagsName, - std::string const & enumName, - std::vector const & enumValues ) const; - void appendCall( std::string & str, - std::string const & name, - CommandData const & commandData, - size_t returnParamIndex, - size_t templateParamIndex, - std::map const & vectorParamIndices, - bool twoStep, - bool firstCall ) const; - void appendCommand( std::string & str, - std::string const & indentation, + void appendArgumentPlainType( std::string & str, ParamData const & paramData ) const; + void appendArguments( std::string & str, + CommandData const & commandData, + size_t returnParamIndex, + size_t templateParamIndex, + std::map const & vectorParamIndices, + bool twoStep, + bool firstCall, + size_t from, + size_t to ) const; + void appendArgumentVector( std::string & str, + size_t paramIndex, + ParamData const & paramData, + size_t returnParamIndex, + size_t templateParamIndex, + bool twoStep, + bool firstCall ) const; + void appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const; + void appendBitmask( std::string & os, + std::string const & bitmaskName, + std::string const & bitmaskType, + std::string const & bitmaskAlias, + std::string const & enumName, + std::vector const & enumValues ) const; + void appendBitmaskToStringFunction( std::string & str, + std::string const & flagsName, + std::string const & enumName, + std::vector const & enumValues ) const; + void appendCall( std::string & str, + std::string const & name, + CommandData const & commandData, + size_t returnParamIndex, + size_t templateParamIndex, + std::map const & vectorParamIndices, + bool twoStep, + bool firstCall ) const; + void appendCommand( std::string & str, + std::string const & indentation, + std::string const & name, + CommandData const & commandData, + bool definition ) const; + void appendCommandChained( std::string & str, std::string const & name, CommandData const & commandData, + size_t nonConstPointerIndex, bool definition ) const; - void appendCommandChained( std::string & str, - std::string const & name, - CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const; - void appendCommandSingular( std::string & str, - std::string const & name, - CommandData const & commandData, - std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const; - void appendCommandStandard( std::string & str, - std::string const & name, - CommandData const & commandData, - bool definition ) const; - void appendCommandStandardAndEnhanced( std::string & str, - std::string const & name, - CommandData const & commandData, - bool definition, - std::map const & vectorParamIndices, - std::vector const & nonConstPointerParamIndices ) const; + void appendCommandSingular( std::string & str, + std::string const & name, + CommandData const & commandData, + std::map const & vectorParamIndices, + size_t returnParamIndex, + bool definition ) const; + void appendCommandStandard( std::string & str, + std::string const & name, + CommandData const & commandData, + bool definition ) const; + void appendCommandStandardAndEnhanced( std::string & str, + std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + std::vector const & nonConstPointerParamIndices ) const; + void + appendCommandStandardEnhancedDeprecatedAllocator( std::string & str, + std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + std::vector const & nonConstPointerParamIndices ) const; void appendCommandStandardOrEnhanced( std::string & str, std::string const & name, CommandData const & commandData, @@ -521,8 +528,8 @@ private: std::vector const & params, size_t skippedParams ) const; std::string constructCallArgumentsGetVector( std::vector const & params, + std::vector const & returnParamIndex, std::map const & vectorParamIndices, - size_t returnParamIndex, bool singular ) const; std::string constructCallArgumentsStandard( std::string const & handle, std::vector const & params ) const; std::string constructCallArgumentsVectors( std::vector const & params, @@ -533,68 +540,79 @@ private: std::map const & vectorParamIndices ) const; std::string constructCommandResultEnumerateTwoVectors( std::string const & name, CommandData const & commandData, - std::map const & vectorParamIndices, bool definition, + std::map const & vectorParamIndices, bool withAllocators ) const; std::string constructCommandResultEnumerateTwoVectorsDeprecated( std::string const & name, CommandData const & commandData, - std::map const & vectorParamIndices, bool definition, + std::map const & vectorParamIndices, bool withAllocators ) const; std::string constructCommandResultGetChain( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const; + bool definition, + size_t nonConstPointerIndex ) const; std::string constructCommandResultGetHandleUnique( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const; + bool definition, + size_t nonConstPointerIndex ) const; std::string constructCommandResultGetTwoVectors( std::string const & name, CommandData const & commandData, - std::map const & vectorParamIndices, - bool definition ) const; + bool definition, + std::map const & vectorParamIndices ) const; std::string constructCommandResultGetValue( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const; + bool definition, + size_t nonConstPointerIndex ) const; + std::string constructCommandResultGetValueDeprecated( std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + size_t returnParamIndex ) const; std::string constructCommandResultGetVector( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const; + size_t returnParamIndex ) const; + std::string constructCommandResultGetVectorAndValue( std::string const & name, + CommandData const & commandData, + bool definition, + std::map const & vectorParamIndices, + std::vector const & returnParamIndex, + bool withAllocator ) const; std::string constructCommandResultGetVectorDeprecated( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const; + size_t returnParamIndex ) const; std::string constructCommandResultGetVectorOfHandles( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, size_t returnParamIndex, - bool definition, bool withAllocator ) const; std::string constructCommandResultGetVectorOfHandlesSingular( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const; + size_t returnParamIndex ) const; std::string constructCommandResultGetVectorOfHandlesUnique( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, size_t returnParamIndex, - bool definition, bool withAllocator ) const; std::string constructCommandResultGetVectorOfHandlesUniqueSingular( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const; + size_t returnParamIndex ) const; std::string constructCommandResultGetVectorSingular( std::string const & name, CommandData const & commandData, + bool definition, std::map const & vectorParamIndices, - size_t returnParamIndex, - bool definition ) const; + size_t returnParamIndex ) const; std::string constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const; std::string constructCommandType( std::string const & name, @@ -607,17 +625,17 @@ private: std::map const & vectorParamIndices ) const; std::string constructCommandVoidEnumerate( std::string const & name, CommandData const & commandData, - std::pair const & vectorParamIndex, bool definition, + std::pair const & vectorParamIndex, bool withAllocators ) const; std::string constructCommandVoidGetChain( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const; + bool definition, + size_t nonConstPointerIndex ) const; std::string constructCommandVoidGetValue( std::string const & name, CommandData const & commandData, - size_t nonConstPointerIndex, - bool definition ) const; + bool definition, + size_t nonConstPointerIndex ) const; std::string constructConstexprString( std::pair const & structData ) const; std::string constructFunctionBodyEnhanced( std::string const & indentation, std::string const & name, diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 3661fa5..2b549f9 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -54409,6 +54409,23 @@ namespace VULKAN_HPP_NAMESPACE ArrayProxy const & timestampInfos, ArrayProxy const & timestamps, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + template , + typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS + typename ResultValueType, uint64_t>>::type + getCalibratedTimestampsEXT( + ArrayProxy const & timestampInfos, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + template , + typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, + typename B = Uint64_tAllocator, + typename std::enable_if::value, int>::type = 0> + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS + typename ResultValueType, uint64_t>>::type + getCalibratedTimestampsEXT( + ArrayProxy const & timestampInfos, + Uint64_tAllocator & uint64_tAllocator, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_ENABLE_BETA_EXTENSIONS @@ -97657,10 +97674,12 @@ namespace VULKAN_HPP_NAMESPACE pTimestamps, pMaxDeviation ) ); } + #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE template - VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type - Device::getCalibratedTimestampsEXT( + VULKAN_HPP_DEPRECATED( "This function is deprecated. Use one of the other flavours of it." ) + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE + typename ResultValueType::type Device::getCalibratedTimestampsEXT( ArrayProxy const & timestampInfos, ArrayProxy const & timestamps, Dispatch const & d ) const @@ -97684,6 +97703,52 @@ namespace VULKAN_HPP_NAMESPACE return createResultValue( result, maxDeviation, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" ); } + + template + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE + typename ResultValueType, uint64_t>>::type + Device::getCalibratedTimestampsEXT( + ArrayProxy const & timestampInfos, + Dispatch const & d ) const + { + std::pair, uint64_t> data( + std::piecewise_construct, std::forward_as_tuple( timestampInfos.size() ), std::forward_as_tuple( 0 ) ); + std::vector & timestamps = data.first; + uint64_t & maxDeviation = data.second; + Result result = static_cast( + d.vkGetCalibratedTimestampsEXT( m_device, + timestampInfos.size(), + reinterpret_cast( timestampInfos.data() ), + timestamps.data(), + &maxDeviation ) ); + return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" ); + } + + template ::value, int>::type> + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE + typename ResultValueType, uint64_t>>::type + Device::getCalibratedTimestampsEXT( + ArrayProxy const & timestampInfos, + Uint64_tAllocator & uint64_tAllocator, + Dispatch const & d ) const + { + std::pair, uint64_t> data( + std::piecewise_construct, + std::forward_as_tuple( timestampInfos.size(), uint64_tAllocator ), + std::forward_as_tuple( 0 ) ); + std::vector & timestamps = data.first; + uint64_t & maxDeviation = data.second; + Result result = static_cast( + d.vkGetCalibratedTimestampsEXT( m_device, + timestampInfos.size(), + reinterpret_cast( timestampInfos.data() ), + timestamps.data(), + &maxDeviation ) ); + return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" ); + } #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_ENABLE_BETA_EXTENSIONS @@ -102675,7 +102740,10 @@ namespace VULKAN_HPP_NAMESPACE { std::pair, std::vector> - enumeratedData; + data; + std::vector & counters = data.first; + std::vector & counterDescriptions = + data.second; uint32_t counterCount; Result result; do @@ -102684,26 +102752,24 @@ namespace VULKAN_HPP_NAMESPACE m_physicalDevice, queueFamilyIndex, &counterCount, nullptr, nullptr ) ); if ( ( result == Result::eSuccess ) && counterCount ) { - enumeratedData.first.resize( counterCount ); - enumeratedData.second.resize( counterCount ); + counters.resize( counterCount ); + counterDescriptions.resize( counterCount ); result = static_cast( d.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( m_physicalDevice, queueFamilyIndex, &counterCount, - reinterpret_cast( enumeratedData.first.data() ), - reinterpret_cast( enumeratedData.second.data() ) ) ); - VULKAN_HPP_ASSERT( counterCount <= enumeratedData.first.size() ); + reinterpret_cast( counters.data() ), + reinterpret_cast( counterDescriptions.data() ) ) ); + VULKAN_HPP_ASSERT( counterCount <= counters.size() ); } } while ( result == Result::eIncomplete ); - if ( ( result == Result::eSuccess ) && ( counterCount < enumeratedData.first.size() ) ) + if ( ( result == Result::eSuccess ) && ( counterCount < counters.size() ) ) { - enumeratedData.first.resize( counterCount ); - enumeratedData.second.resize( counterCount ); + counters.resize( counterCount ); + counterDescriptions.resize( counterCount ); } - return createResultValue( result, - enumeratedData, - VULKAN_HPP_NAMESPACE_STRING - "::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" ); + return createResultValue( + result, data, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" ); } template , std::vector> - enumeratedData( std::piecewise_construct, - std::forward_as_tuple( performanceCounterKHRAllocator ), - std::forward_as_tuple( performanceCounterDescriptionKHRAllocator ) ); + data( std::piecewise_construct, + std::forward_as_tuple( performanceCounterKHRAllocator ), + std::forward_as_tuple( performanceCounterDescriptionKHRAllocator ) ); + std::vector & counters = data.first; + std::vector & counterDescriptions = + data.second; uint32_t counterCount; Result result; do @@ -102736,26 +102805,24 @@ namespace VULKAN_HPP_NAMESPACE m_physicalDevice, queueFamilyIndex, &counterCount, nullptr, nullptr ) ); if ( ( result == Result::eSuccess ) && counterCount ) { - enumeratedData.first.resize( counterCount ); - enumeratedData.second.resize( counterCount ); + counters.resize( counterCount ); + counterDescriptions.resize( counterCount ); result = static_cast( d.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( m_physicalDevice, queueFamilyIndex, &counterCount, - reinterpret_cast( enumeratedData.first.data() ), - reinterpret_cast( enumeratedData.second.data() ) ) ); - VULKAN_HPP_ASSERT( counterCount <= enumeratedData.first.size() ); + reinterpret_cast( counters.data() ), + reinterpret_cast( counterDescriptions.data() ) ) ); + VULKAN_HPP_ASSERT( counterCount <= counters.size() ); } } while ( result == Result::eIncomplete ); - if ( ( result == Result::eSuccess ) && ( counterCount < enumeratedData.first.size() ) ) + if ( ( result == Result::eSuccess ) && ( counterCount < counters.size() ) ) { - enumeratedData.first.resize( counterCount ); - enumeratedData.second.resize( counterCount ); + counters.resize( counterCount ); + counterDescriptions.resize( counterCount ); } - return createResultValue( result, - enumeratedData, - VULKAN_HPP_NAMESPACE_STRING - "::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" ); + return createResultValue( + result, data, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" ); } #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/