Refactor command that returns a vector of values and a single value.

This commit is contained in:
asuessenbach 2020-10-19 09:40:40 +02:00
parent cb6b61fd66
commit 2b47c6f9e5
3 changed files with 521 additions and 219 deletions

View File

@ -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 // two returns but just one vector -> the size is a return value as well -> enumerate the values
auto vectorParamIndexIt = vectorParamIndices.begin(); auto vectorParamIndexIt = vectorParamIndices.begin();
assert( ( vectorParamIndexIt->second == *nonConstPointerParamIndices.begin() ) && assert( ( vectorParamIndexIt->second == nonConstPointerParamIndices[0] ) &&
( vectorParamIndexIt->first == *std::next( nonConstPointerParamIndices.begin() ) ) ); ( vectorParamIndexIt->first == nonConstPointerParamIndices[1] ) );
if ( ( commandData.returnType == "void" ) && if ( ( commandData.returnType == "void" ) &&
!determineStructureChaining( commandData.params[vectorParamIndexIt->first].type.type, !determineStructureChaining( commandData.params[vectorParamIndexIt->first].type.type,
m_extendedStructs ) ) m_extendedStructs ) )
@ -1278,6 +1278,19 @@ void VulkanHppGenerator::appendCommand( std::string & str,
} }
} }
break; 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; break;
case 3: case 3:
@ -1502,12 +1515,12 @@ ${leave})";
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", { { "commandEnhanced",
( commandData.returnType == "void" ) ( commandData.returnType == "void" )
? constructCommandVoidGetValue( name, commandData, nonConstPointerIndex, definition ) ? constructCommandVoidGetValue( name, commandData, definition, nonConstPointerIndex )
: constructCommandResultGetValue( name, commandData, nonConstPointerIndex, definition ) }, : constructCommandResultGetValue( name, commandData, definition, nonConstPointerIndex ) },
{ "commandEnhancedChained", { "commandEnhancedChained",
( commandData.returnType == "void" ) ( commandData.returnType == "void" )
? constructCommandVoidGetChain( name, commandData, nonConstPointerIndex, definition ) ? constructCommandVoidGetChain( name, commandData, definition, nonConstPointerIndex )
: constructCommandResultGetChain( name, commandData, nonConstPointerIndex, definition ) }, : constructCommandResultGetChain( name, commandData, definition, nonConstPointerIndex ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "enter", enter }, { "enter", enter },
{ "leave", leave }, { "leave", leave },
@ -1526,7 +1539,7 @@ void VulkanHppGenerator::appendCommandSingular( std::string &
std::string const functionTemplate = R"( std::string const functionTemplate = R"(
${enter}${commandStandard}${newlineOnDefinition} ${enter}${commandStandard}${newlineOnDefinition}
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
${commandDeprecated}${newlineOnDefinition} ${commandEnhancedDeprecated}${newlineOnDefinition}
${commandEnhanced}${newlineOnDefinition} ${commandEnhanced}${newlineOnDefinition}
${commandEnhancedSingular} ${commandEnhancedSingular}
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -1539,13 +1552,13 @@ ${leave})";
functionTemplate, functionTemplate,
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", { { "commandEnhanced",
constructCommandResultGetVector( name, commandData, vectorParamIndices, returnParamIndex, definition ) }, constructCommandResultGetVector( name, commandData, definition, vectorParamIndices, returnParamIndex ) },
{ "commandDeprecated", { "commandEnhancedDeprecated",
constructCommandResultGetVectorDeprecated( constructCommandResultGetVectorDeprecated(
name, commandData, vectorParamIndices, returnParamIndex, definition ) }, name, commandData, definition, vectorParamIndices, returnParamIndex ) },
{ "commandEnhancedSingular", { "commandEnhancedSingular",
constructCommandResultGetVectorSingular( constructCommandResultGetVectorSingular(
name, commandData, vectorParamIndices, returnParamIndex, definition ) }, name, commandData, definition, vectorParamIndices, returnParamIndex ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "enter", enter }, { "enter", enter },
{ "leave", leave }, { "leave", leave },
@ -1609,7 +1622,7 @@ ${leave})";
assert( vectorParamIndices.begin()->second != INVALID_INDEX ); assert( vectorParamIndices.begin()->second != INVALID_INDEX );
assert( vectorParamIndices.begin()->second == std::next( vectorParamIndices.begin() )->second ); assert( vectorParamIndices.begin()->second == std::next( vectorParamIndices.begin() )->second );
assert( commandData.params[vectorParamIndices.begin()->second].type.isValue() ); assert( commandData.params[vectorParamIndices.begin()->second].type.isValue() );
commandEnhanced = constructCommandResultGetTwoVectors( name, commandData, vectorParamIndices, definition ); commandEnhanced = constructCommandResultGetTwoVectors( name, commandData, definition, vectorParamIndices );
} }
} }
else else
@ -1620,8 +1633,8 @@ ${leave})";
case 1: case 1:
commandEnhanced = commandEnhanced =
( commandData.returnType == "void" ) ( commandData.returnType == "void" )
? constructCommandVoidGetValue( name, commandData, nonConstPointerParamIndices[0], definition ) ? constructCommandVoidGetValue( name, commandData, definition, nonConstPointerParamIndices[0] )
: constructCommandResultGetValue( name, commandData, nonConstPointerParamIndices[0], definition ); : constructCommandResultGetValue( name, commandData, definition, nonConstPointerParamIndices[0] );
break; break;
default: assert( false ); break; default: assert( false ); break;
} }
@ -1635,6 +1648,49 @@ ${leave})";
{ "newlineOnDefinition", definition ? "\n" : "" } } ) ); { "newlineOnDefinition", definition ? "\n" : "" } } ) );
} }
void VulkanHppGenerator::appendCommandStandardEnhancedDeprecatedAllocator(
std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> 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<std::string, std::string>(
{ { "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, void VulkanHppGenerator::appendCommandStandardOrEnhanced( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
@ -1684,9 +1740,9 @@ ${leave})";
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", constructCommandResultGetValue( name, commandData, nonConstPointerIndex, definition ) }, { { "commandEnhanced", constructCommandResultGetValue( name, commandData, definition, nonConstPointerIndex ) },
{ "commandEnhancedUnique", { "commandEnhancedUnique",
constructCommandResultGetHandleUnique( name, commandData, nonConstPointerIndex, definition ) }, constructCommandResultGetHandleUnique( name, commandData, definition, nonConstPointerIndex ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "enter", enter }, { "enter", enter },
{ "leave", leave }, { "leave", leave },
@ -1716,9 +1772,9 @@ ${commandEnhancedWithAllocators}
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", constructCommandVoidEnumerate( name, commandData, vectorParamIndex, definition, false ) }, { { "commandEnhanced", constructCommandVoidEnumerate( name, commandData, definition, vectorParamIndex, false ) },
{ "commandEnhancedWithAllocators", { "commandEnhancedWithAllocators",
constructCommandVoidEnumerate( name, commandData, vectorParamIndex, definition, true ) }, constructCommandVoidEnumerate( name, commandData, definition, vectorParamIndex, true ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "newlineOnDefinition", definition ? "\n" : "" } } ) ); { "newlineOnDefinition", definition ? "\n" : "" } } ) );
} }
@ -1750,15 +1806,15 @@ ${commandEnhancedWithAllocators}
functionTemplate, functionTemplate,
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", { { "commandEnhanced",
constructCommandResultEnumerateTwoVectors( name, commandData, vectorParamIndices, definition, false ) }, constructCommandResultEnumerateTwoVectors( name, commandData, definition, vectorParamIndices, false ) },
{ "commandEnhancedDeprecated", { "commandEnhancedDeprecated",
constructCommandResultEnumerateTwoVectorsDeprecated( constructCommandResultEnumerateTwoVectorsDeprecated(
name, commandData, vectorParamIndices, definition, false ) }, name, commandData, definition, vectorParamIndices, false ) },
{ "commandEnhancedWithAllocators", { "commandEnhancedWithAllocators",
constructCommandResultEnumerateTwoVectors( name, commandData, vectorParamIndices, definition, true ) }, constructCommandResultEnumerateTwoVectors( name, commandData, definition, vectorParamIndices, true ) },
{ "commandEnhancedWithAllocatorsDeprecated", { "commandEnhancedWithAllocatorsDeprecated",
constructCommandResultEnumerateTwoVectorsDeprecated( constructCommandResultEnumerateTwoVectorsDeprecated(
name, commandData, vectorParamIndices, definition, true ) }, name, commandData, definition, vectorParamIndices, true ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "newlineOnDefinition", definition ? "\n" : "" } } ) ); { "newlineOnDefinition", definition ? "\n" : "" } } ) );
} }
@ -1793,22 +1849,22 @@ ${leave})";
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", { { "commandEnhanced",
constructCommandResultGetVectorOfHandles( constructCommandResultGetVectorOfHandles(
name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, false ) },
{ "commandEnhancedSingular", { "commandEnhancedSingular",
constructCommandResultGetVectorOfHandlesSingular( constructCommandResultGetVectorOfHandlesSingular(
name, commandData, vectorParamIndices, returnParamIndex, definition ) }, name, commandData, definition, vectorParamIndices, returnParamIndex ) },
{ "commandEnhancedUnique", { "commandEnhancedUnique",
constructCommandResultGetVectorOfHandlesUnique( constructCommandResultGetVectorOfHandlesUnique(
name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, false ) },
{ "commandEnhancedUniqueSingular", { "commandEnhancedUniqueSingular",
constructCommandResultGetVectorOfHandlesUniqueSingular( constructCommandResultGetVectorOfHandlesUniqueSingular(
name, commandData, vectorParamIndices, returnParamIndex, definition ) }, name, commandData, definition, vectorParamIndices, returnParamIndex ) },
{ "commandEnhancedUniqueWithAllocators", { "commandEnhancedUniqueWithAllocators",
constructCommandResultGetVectorOfHandlesUnique( constructCommandResultGetVectorOfHandlesUnique(
name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, true ) },
{ "commandEnhancedWithAllocators", { "commandEnhancedWithAllocators",
constructCommandResultGetVectorOfHandles( constructCommandResultGetVectorOfHandles(
name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, true ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "enter", enter }, { "enter", enter },
{ "leave", leave }, { "leave", leave },
@ -1843,16 +1899,16 @@ ${leave})";
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "commandEnhanced", { { "commandEnhanced",
constructCommandResultGetVectorOfHandles( constructCommandResultGetVectorOfHandles(
name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, false ) },
{ "commandEnhancedUnique", { "commandEnhancedUnique",
constructCommandResultGetVectorOfHandlesUnique( constructCommandResultGetVectorOfHandlesUnique(
name, commandData, vectorParamIndices, returnParamIndex, definition, false ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, false ) },
{ "commandEnhancedUniqueWithAllocators", { "commandEnhancedUniqueWithAllocators",
constructCommandResultGetVectorOfHandlesUnique( constructCommandResultGetVectorOfHandlesUnique(
name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, true ) },
{ "commandEnhancedWithAllocators", { "commandEnhancedWithAllocators",
constructCommandResultGetVectorOfHandles( constructCommandResultGetVectorOfHandles(
name, commandData, vectorParamIndices, returnParamIndex, definition, true ) }, name, commandData, definition, vectorParamIndices, returnParamIndex, true ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) }, { "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "enter", enter }, { "enter", enter },
{ "leave", leave }, { "leave", leave },
@ -3577,8 +3633,6 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector<Param
} }
else if ( params[i].type.isNonConstPointer() ) else if ( params[i].type.isNonConstPointer() )
{ {
assert( params[i].type.type ==
"Display" ); // this is the only type provided by a non-const pointer, but not an output value!
assert( params[i].len.empty() && !params[i].optional ); assert( params[i].len.empty() && !params[i].optional );
argumentList += params[i].type.type + " & " + params[i].name; argumentList += params[i].type.type + " & " + params[i].name;
} }
@ -3605,7 +3659,7 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector<Param
{ {
if ( !params[sp].len.empty() ) if ( !params[sp].len.empty() )
{ {
std::string type = stripPrefix( params[sp].type.type, "Vk" ); std::string type = startUpperCase( stripPrefix( params[sp].type.type, "Vk" ) );
argumentList += type + "Allocator & " + startLowerCase( type ) + "Allocator, "; argumentList += type + "Allocator & " + startLowerCase( type ) + "Allocator, ";
} }
} }
@ -3716,20 +3770,8 @@ std::string
} }
else else
{ {
switch ( vectorParamIndices.size() ) arguments += "reinterpret_cast<" + params[i].type.compose( false ) + ">( " +
{ startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )";
case 1:
assert( beginsWith( params[i].name, "p" ) );
arguments += "reinterpret_cast<" + params[i].type.type + " *>( " +
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 );
}
} }
} }
else else
@ -3779,25 +3821,41 @@ std::string VulkanHppGenerator::constructCallArgumentsGetValue( std::string cons
} }
std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::vector<ParamData> const & params, std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::vector<ParamData> const & params,
std::vector<size_t> const & returnParamIndices,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool singular ) const bool singular ) const
{ {
std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) ); std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) );
for ( size_t i = 1; i < params.size(); i++ ) for ( size_t i = 1; i < params.size(); i++ )
{ {
arguments += ", "; 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 ) + ">( &" + assert( !beginsWith( params[i].type.type, "Vk" ) );
stripPluralS( startLowerCase( stripPrefix( params[i].name, "p" ) ) ) + " )"; arguments += "&" + startLowerCase( stripPrefix( params[i].name, "p" ) );
} }
else else
{ {
arguments += "reinterpret_cast<" + params[i].type.compose( false ) + ">( " + if ( singular )
startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )"; {
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 else
@ -3971,8 +4029,8 @@ std::string VulkanHppGenerator::constructCommandResult( std::string const &
std::string std::string
VulkanHppGenerator::constructCommandResultEnumerateTwoVectors( std::string const & name, VulkanHppGenerator::constructCommandResultEnumerateTwoVectors( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const bool withAllocators ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4004,7 +4062,9 @@ std::string
R"( template <typename ${templateTypeFirst}Allocator, typename ${templateTypeSecond}Allocator, typename Dispatch${withAllocatorTypenameCheck}> R"( template <typename ${templateTypeFirst}Allocator, typename ${templateTypeSecond}Allocator, typename Dispatch${withAllocatorTypenameCheck}>
${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<std::pair<std::vector<${templateTypeFirst}, ${templateTypeFirst}Allocator>, std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator>>>::type ${className}::${commandName}( ${argumentList} ) const ${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<std::pair<std::vector<${templateTypeFirst}, ${templateTypeFirst}Allocator>, std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator>>>::type ${className}::${commandName}( ${argumentList} ) const
{ {
std::pair<std::vector<${templateTypeFirst}, ${templateTypeFirst}Allocator>, std::vector<${templateTypeSecond}, ${templateTypeSecond}Allocator>> enumeratedData${pairConstructor}; std::pair<std::vector<${templateTypeFirst}, ${templateTypeFirst}Allocator>, 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}; ${counterType} ${counterName};
Result result; Result result;
do do
@ -4012,28 +4072,23 @@ std::string
result = static_cast<Result>( d.${vkCommand}( ${firstCallArguments} ) ); result = static_cast<Result>( d.${vkCommand}( ${firstCallArguments} ) );
if ( ( result == Result::eSuccess ) && counterCount ) if ( ( result == Result::eSuccess ) && counterCount )
{ {
enumeratedData.first.resize( ${counterName} ); ${firstVectorName}.resize( ${counterName} );
enumeratedData.second.resize( ${counterName} ); ${secondVectorName}.resize( ${counterName} );
result = static_cast<Result>( d.${vkCommand}( ${secondCallArguments} ) ); result = static_cast<Result>( d.${vkCommand}( ${secondCallArguments} ) );
VULKAN_HPP_ASSERT( ${counterName} <= enumeratedData.first.size() ); VULKAN_HPP_ASSERT( ${counterName} <= ${firstVectorName}.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( ( result == Result::eSuccess ) && ( ${counterName} < enumeratedData.first.size() ) ) if ( ( result == Result::eSuccess ) && ( ${counterName} < ${firstVectorName}.size() ) )
{ {
enumeratedData.first.resize( ${counterName} ); ${firstVectorName}.resize( ${counterName} );
enumeratedData.second.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->first].name, "p" ) );
assert( beginsWith( commandData.params[firstVectorParamIt->second].name, "p" ) ); assert( beginsWith( commandData.params[firstVectorParamIt->second].name, "p" ) );
assert( beginsWith( commandData.params[secondVectorParamIt->first].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 = std::string withAllocatorsTypenameCheck =
", typename B1, typename B2, typename std::enable_if<std::is_same<typename B1::value_type, " + templateTypeFirst + ", typename B1, typename B2, typename std::enable_if<std::is_same<typename B1::value_type, " + templateTypeFirst +
">::value && std::is_same<typename B2::value_type, " + templateTypeSecond + ">::value, int>::type "; ">::value && std::is_same<typename B2::value_type, " + templateTypeSecond + ">::value, int>::type ";
@ -4049,6 +4104,8 @@ std::string
{ "counterType", commandData.params[firstVectorParamIt->second].type.type }, { "counterType", commandData.params[firstVectorParamIt->second].type.type },
{ "firstCallArguments", { "firstCallArguments",
constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, true ) }, constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, true ) },
{ "firstVectorName",
startLowerCase( stripPrefix( commandData.params[firstVectorParamIt->first].name, "p" ) ) },
{ "nodiscard", nodiscard }, { "nodiscard", nodiscard },
{ "pairConstructor", { "pairConstructor",
withAllocators withAllocators
@ -4060,6 +4117,8 @@ std::string
: "" }, : "" },
{ "secondCallArguments", { "secondCallArguments",
constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, false ) }, constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, false ) },
{ "secondVectorName",
startLowerCase( stripPrefix( commandData.params[secondVectorParamIt->first].name, "p" ) ) },
{ "templateTypeFirst", templateTypeFirst }, { "templateTypeFirst", templateTypeFirst },
{ "templateTypeSecond", templateTypeSecond }, { "templateTypeSecond", templateTypeSecond },
{ "vkCommand", name }, { "vkCommand", name },
@ -4091,8 +4150,8 @@ std::string
std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectorsDeprecated( std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectorsDeprecated(
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const bool withAllocators ) const
{ {
std::string str; std::string str;
@ -4166,8 +4225,8 @@ std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectorsDepreca
std::string VulkanHppGenerator::constructCommandResultGetChain( std::string const & name, std::string VulkanHppGenerator::constructCommandResultGetChain( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const size_t nonConstPointerIndex ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) && assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) &&
( commandData.successCodes.size() == 1 ) && !commandData.errorCodes.empty() ); ( 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, std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const size_t nonConstPointerIndex ) const
{ {
assert( ( commandData.returnType == "VkResult" ) && ( commandData.successCodes.size() == 1 ) ); assert( ( commandData.returnType == "VkResult" ) && ( commandData.successCodes.size() == 1 ) );
@ -4325,8 +4384,8 @@ std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::stri
std::string std::string
VulkanHppGenerator::constructCommandResultGetTwoVectors( std::string const & name, VulkanHppGenerator::constructCommandResultGetTwoVectors( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices, bool definition,
bool definition ) const std::map<size_t, size_t> const & vectorParamIndices ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4389,8 +4448,8 @@ std::string
std::string VulkanHppGenerator::constructCommandResultGetValue( std::string const & name, std::string VulkanHppGenerator::constructCommandResultGetValue( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const size_t nonConstPointerIndex ) const
{ {
assert( commandData.returnType == "VkResult" ); assert( commandData.returnType == "VkResult" );
@ -4462,11 +4521,76 @@ std::string VulkanHppGenerator::constructCommandResultGetValue( std::string cons
return str; return str;
} }
std::string
VulkanHppGenerator::constructCommandResultGetValueDeprecated( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> 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 <typename Dispatch>
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<std::string, std::string>( { { "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 <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
${nodiscard}typename ResultValueType<${returnType}>::type ${commandName}( ${argumentList} ) const;)";
str = replaceWithMap( functionTemplate,
std::map<std::string, std::string>( { { "argumentList", argumentList },
{ "commandName", commandName },
{ "nodiscard", nodiscard },
{ "returnType", returnType } } ) );
}
return str;
}
std::string VulkanHppGenerator::constructCommandResultGetVector( std::string const & name, std::string VulkanHppGenerator::constructCommandResultGetVector( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const
bool definition ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4495,7 +4619,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVector( std::string con
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "callArguments", { "callArguments",
constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, false ) }, constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, false ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) }, { "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "dataName", startLowerCase( stripPrefix( commandData.params[returnParamIndex].name, "p" ) ) }, { "dataName", startLowerCase( stripPrefix( commandData.params[returnParamIndex].name, "p" ) ) },
@ -4521,12 +4645,105 @@ std::string VulkanHppGenerator::constructCommandResultGetVector( std::string con
return str; return str;
} }
std::string
VulkanHppGenerator::constructCommandResultGetVectorAndValue( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> 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<size_t> 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<T,Allocator>" );
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 <typename ${allocatorType}, typename Dispatch${typenameCheck}>
${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<std::pair<std::vector<${vectorElementType}, ${allocatorType}>, ${valueType}>>::type ${className}::${commandName}( ${argumentList} ) const
{
std::pair<std::vector<${vectorElementType}, ${allocatorType}>,${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<Result>( d.${vkCommand}( ${callArguments} ) );
return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}"${successCodeList} );
})";
std::string typenameCheck = ", typename B, typename std::enable_if<std::is_same<typename B::value_type, " +
vectorElementType + ">::value, int>::type ";
str = replaceWithMap(
functionTemplate,
std::map<std::string, std::string>(
{ { "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 ${allocatorType} = std::allocator<${vectorElementType}>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${typenameCheck}>
${nodiscard}typename ResultValueType<std::pair<std::vector<${vectorElementType}, ${allocatorType}>, ${valueType}>>::type ${commandName}( ${argumentList} ) const;)";
std::string typenameCheck = ", typename B = " + allocatorType +
", typename std::enable_if<std::is_same<typename B::value_type, " + vectorElementType +
">::value, int>::type = 0";
str = replaceWithMap( functionTemplate,
std::map<std::string, std::string>( { { "allocatorType", allocatorType },
{ "argumentList", argumentList },
{ "commandName", commandName },
{ "nodiscard", nodiscard },
{ "typenameCheck", withAllocator ? typenameCheck : "" },
{ "valueType", valueType },
{ "vectorElementType", vectorElementType } } ) );
}
return str;
}
std::string std::string
VulkanHppGenerator::constructCommandResultGetVectorDeprecated( std::string const & name, VulkanHppGenerator::constructCommandResultGetVectorDeprecated( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const
bool definition ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4586,9 +4803,9 @@ std::string
std::string std::string
VulkanHppGenerator::constructCommandResultGetVectorOfHandles( std::string const & name, VulkanHppGenerator::constructCommandResultGetVectorOfHandles( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex,
bool definition,
bool withAllocator ) const bool withAllocator ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4628,7 +4845,7 @@ std::string
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "callArguments", { "callArguments",
constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, false ) }, constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, false ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) }, { "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "nodiscard", nodiscard }, { "nodiscard", nodiscard },
@ -4667,9 +4884,9 @@ std::string
std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular( std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular(
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const
bool definition ) const
{ {
assert( !commandData.handle.empty() ); assert( !commandData.handle.empty() );
assert( ( vectorParamIndices.size() == 2 ) && assert( ( vectorParamIndices.size() == 2 ) &&
@ -4709,7 +4926,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "callArguments", { "callArguments",
constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, true ) }, constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, true ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) }, { "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "nodiscard", nodiscard }, { "nodiscard", nodiscard },
@ -4739,9 +4956,9 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular
std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique( std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique(
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex,
bool definition,
bool withAllocator ) const bool withAllocator ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4817,7 +5034,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique(
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "callArguments", { "callArguments",
constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, false ) }, constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, false ) },
{ "className", className }, { "className", className },
{ "commandName", commandName }, { "commandName", commandName },
{ "deleterDefinition", deleterDefinition }, { "deleterDefinition", deleterDefinition },
@ -4860,9 +5077,9 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique(
std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSingular( std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSingular(
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const
bool definition ) const
{ {
assert( !commandData.handle.empty() ); assert( !commandData.handle.empty() );
assert( ( vectorParamIndices.size() == 2 ) && assert( ( vectorParamIndices.size() == 2 ) &&
@ -4903,7 +5120,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSi
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "callArguments", { "callArguments",
constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, true ) }, constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, true ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) }, { "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "handleName", { "handleName",
@ -4935,9 +5152,9 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSi
std::string std::string
VulkanHppGenerator::constructCommandResultGetVectorSingular( std::string const & name, VulkanHppGenerator::constructCommandResultGetVectorSingular( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const
bool definition ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) ); assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) );
@ -4969,7 +5186,7 @@ std::string
std::map<std::string, std::string>( std::map<std::string, std::string>(
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "callArguments", { "callArguments",
constructCallArgumentsGetVector( commandData.params, vectorParamIndices, returnParamIndex, true ) }, constructCallArgumentsGetVector( commandData.params, { returnParamIndex }, vectorParamIndices, true ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) }, { "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "dataName", startLowerCase( stripPrefix( commandData.params[returnParamIndex].name, "p" ) ) }, { "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, std::string VulkanHppGenerator::constructCommandVoidGetChain( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const size_t nonConstPointerIndex ) const
{ {
assert( !commandData.handle.empty() && ( commandData.returnType == "void" ) && commandData.successCodes.empty() && assert( !commandData.handle.empty() && ( commandData.returnType == "void" ) && commandData.successCodes.empty() &&
commandData.errorCodes.empty() ); commandData.errorCodes.empty() );
@ -5252,8 +5469,8 @@ std::string VulkanHppGenerator::constructCommandVoid( std::string const &
std::string VulkanHppGenerator::constructCommandVoidEnumerate( std::string const & name, std::string VulkanHppGenerator::constructCommandVoidEnumerate( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndex,
bool definition, bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
bool withAllocators ) const bool withAllocators ) const
{ {
assert( !commandData.handle.empty() && commandData.params[0].type.type == commandData.handle && 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, std::string VulkanHppGenerator::constructCommandVoidGetValue( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const size_t nonConstPointerIndex ) const
{ {
assert( !commandData.handle.empty() ); assert( !commandData.handle.empty() );
assert( ( commandData.returnType == "void" ) && commandData.successCodes.empty() && commandData.errorCodes.empty() ); assert( ( commandData.returnType == "void" ) && commandData.successCodes.empty() && commandData.errorCodes.empty() );

View File

@ -272,68 +272,75 @@ private:
}; };
private: private:
void appendArgumentPlainType( std::string & str, ParamData const & paramData ) const; void appendArgumentPlainType( std::string & str, ParamData const & paramData ) const;
void appendArguments( std::string & str, void appendArguments( std::string & str,
CommandData const & commandData, CommandData const & commandData,
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep, bool twoStep,
bool firstCall, bool firstCall,
size_t from, size_t from,
size_t to ) const; size_t to ) const;
void appendArgumentVector( std::string & str, void appendArgumentVector( std::string & str,
size_t paramIndex, size_t paramIndex,
ParamData const & paramData, ParamData const & paramData,
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
bool twoStep, bool twoStep,
bool firstCall ) const; bool firstCall ) const;
void appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const; void appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const;
void appendBitmask( std::string & os, void appendBitmask( std::string & os,
std::string const & bitmaskName, std::string const & bitmaskName,
std::string const & bitmaskType, std::string const & bitmaskType,
std::string const & bitmaskAlias, std::string const & bitmaskAlias,
std::string const & enumName, std::string const & enumName,
std::vector<EnumValueData> const & enumValues ) const; std::vector<EnumValueData> const & enumValues ) const;
void appendBitmaskToStringFunction( std::string & str, void appendBitmaskToStringFunction( std::string & str,
std::string const & flagsName, std::string const & flagsName,
std::string const & enumName, std::string const & enumName,
std::vector<EnumValueData> const & enumValues ) const; std::vector<EnumValueData> const & enumValues ) const;
void appendCall( std::string & str, void appendCall( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep, bool twoStep,
bool firstCall ) const; bool firstCall ) const;
void appendCommand( std::string & str, void appendCommand( std::string & str,
std::string const & indentation, std::string const & indentation,
std::string const & name,
CommandData const & commandData,
bool definition ) const;
void appendCommandChained( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex,
bool definition ) const; bool definition ) const;
void appendCommandChained( std::string & str, void appendCommandSingular( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const; size_t returnParamIndex,
void appendCommandSingular( std::string & str, bool definition ) const;
std::string const & name, void appendCommandStandard( std::string & str,
CommandData const & commandData, std::string const & name,
std::map<size_t, size_t> const & vectorParamIndices, CommandData const & commandData,
size_t returnParamIndex, bool definition ) const;
bool definition ) const; void appendCommandStandardAndEnhanced( std::string & str,
void appendCommandStandard( std::string & str, std::string const & name,
std::string const & name, CommandData const & commandData,
CommandData const & commandData, bool definition,
bool definition ) const; std::map<size_t, size_t> const & vectorParamIndices,
void appendCommandStandardAndEnhanced( std::string & str, std::vector<size_t> const & nonConstPointerParamIndices ) const;
std::string const & name, void
CommandData const & commandData, appendCommandStandardEnhancedDeprecatedAllocator( std::string & str,
bool definition, std::string const & name,
std::map<size_t, size_t> const & vectorParamIndices, CommandData const & commandData,
std::vector<size_t> const & nonConstPointerParamIndices ) const; bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
void appendCommandStandardOrEnhanced( std::string & str, void appendCommandStandardOrEnhanced( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
@ -521,8 +528,8 @@ private:
std::vector<ParamData> const & params, std::vector<ParamData> const & params,
size_t skippedParams ) const; size_t skippedParams ) const;
std::string constructCallArgumentsGetVector( std::vector<ParamData> const & params, std::string constructCallArgumentsGetVector( std::vector<ParamData> const & params,
std::vector<size_t> const & returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool singular ) const; bool singular ) const;
std::string constructCallArgumentsStandard( std::string const & handle, std::vector<ParamData> const & params ) const; std::string constructCallArgumentsStandard( std::string const & handle, std::vector<ParamData> const & params ) const;
std::string constructCallArgumentsVectors( std::vector<ParamData> const & params, std::string constructCallArgumentsVectors( std::vector<ParamData> const & params,
@ -533,68 +540,79 @@ private:
std::map<size_t, size_t> const & vectorParamIndices ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructCommandResultEnumerateTwoVectors( std::string const & name, std::string constructCommandResultEnumerateTwoVectors( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const; bool withAllocators ) const;
std::string constructCommandResultEnumerateTwoVectorsDeprecated( std::string const & name, std::string constructCommandResultEnumerateTwoVectorsDeprecated( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const; bool withAllocators ) const;
std::string constructCommandResultGetChain( std::string const & name, std::string constructCommandResultGetChain( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const; size_t nonConstPointerIndex ) const;
std::string constructCommandResultGetHandleUnique( std::string const & name, std::string constructCommandResultGetHandleUnique( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const; size_t nonConstPointerIndex ) const;
std::string constructCommandResultGetTwoVectors( std::string const & name, std::string constructCommandResultGetTwoVectors( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices, bool definition,
bool definition ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructCommandResultGetValue( std::string const & name, std::string constructCommandResultGetValue( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const; size_t nonConstPointerIndex ) const;
std::string constructCommandResultGetValueDeprecated( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructCommandResultGetVector( std::string const & name, std::string constructCommandResultGetVector( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const;
bool definition ) const; std::string constructCommandResultGetVectorAndValue( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndex,
bool withAllocator ) const;
std::string constructCommandResultGetVectorDeprecated( std::string const & name, std::string constructCommandResultGetVectorDeprecated( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const;
bool definition ) const;
std::string constructCommandResultGetVectorOfHandles( std::string const & name, std::string constructCommandResultGetVectorOfHandles( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex,
bool definition,
bool withAllocator ) const; bool withAllocator ) const;
std::string constructCommandResultGetVectorOfHandlesSingular( std::string const & name, std::string constructCommandResultGetVectorOfHandlesSingular( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const;
bool definition ) const;
std::string constructCommandResultGetVectorOfHandlesUnique( std::string const & name, std::string constructCommandResultGetVectorOfHandlesUnique( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex,
bool definition,
bool withAllocator ) const; bool withAllocator ) const;
std::string std::string
constructCommandResultGetVectorOfHandlesUniqueSingular( std::string const & name, constructCommandResultGetVectorOfHandlesUniqueSingular( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const;
bool definition ) const;
std::string constructCommandResultGetVectorSingular( std::string const & name, std::string constructCommandResultGetVectorSingular( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex, size_t returnParamIndex ) const;
bool definition ) const;
std::string std::string
constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const; constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const;
std::string constructCommandType( std::string const & name, std::string constructCommandType( std::string const & name,
@ -607,17 +625,17 @@ private:
std::map<size_t, size_t> const & vectorParamIndices ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructCommandVoidEnumerate( std::string const & name, std::string constructCommandVoidEnumerate( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndex,
bool definition, bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
bool withAllocators ) const; bool withAllocators ) const;
std::string constructCommandVoidGetChain( std::string const & name, std::string constructCommandVoidGetChain( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const; size_t nonConstPointerIndex ) const;
std::string constructCommandVoidGetValue( std::string const & name, std::string constructCommandVoidGetValue( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t nonConstPointerIndex, bool definition,
bool definition ) const; size_t nonConstPointerIndex ) const;
std::string constructConstexprString( std::pair<std::string, StructureData> const & structData ) const; std::string constructConstexprString( std::pair<std::string, StructureData> const & structData ) const;
std::string constructFunctionBodyEnhanced( std::string const & indentation, std::string constructFunctionBodyEnhanced( std::string const & indentation,
std::string const & name, std::string const & name,

View File

@ -54409,6 +54409,23 @@ namespace VULKAN_HPP_NAMESPACE
ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos, ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos,
ArrayProxy<uint64_t> const & timestamps, ArrayProxy<uint64_t> const & timestamps,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Uint64_tAllocator = std::allocator<uint64_t>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t>>::type
getCalibratedTimestampsEXT(
ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Uint64_tAllocator = std::allocator<uint64_t>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = Uint64_tAllocator,
typename std::enable_if<std::is_same<typename B::value_type, uint64_t>::value, int>::type = 0>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t>>::type
getCalibratedTimestampsEXT(
ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos,
Uint64_tAllocator & uint64_tAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
#ifdef VK_ENABLE_BETA_EXTENSIONS #ifdef VK_ENABLE_BETA_EXTENSIONS
@ -97657,10 +97674,12 @@ namespace VULKAN_HPP_NAMESPACE
pTimestamps, pTimestamps,
pMaxDeviation ) ); pMaxDeviation ) );
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch> template <typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<uint64_t>::type VULKAN_HPP_DEPRECATED( "This function is deprecated. Use one of the other flavours of it." )
Device::getCalibratedTimestampsEXT( VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<uint64_t>::type Device::getCalibratedTimestampsEXT(
ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos, ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos,
ArrayProxy<uint64_t> const & timestamps, ArrayProxy<uint64_t> const & timestamps,
Dispatch const & d ) const Dispatch const & d ) const
@ -97684,6 +97703,52 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue( return createResultValue(
result, maxDeviation, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" ); result, maxDeviation, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" );
} }
template <typename Uint64_tAllocator, typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t>>::type
Device::getCalibratedTimestampsEXT(
ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos,
Dispatch const & d ) const
{
std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t> data(
std::piecewise_construct, std::forward_as_tuple( timestampInfos.size() ), std::forward_as_tuple( 0 ) );
std::vector<uint64_t, Uint64_tAllocator> & timestamps = data.first;
uint64_t & maxDeviation = data.second;
Result result = static_cast<Result>(
d.vkGetCalibratedTimestampsEXT( m_device,
timestampInfos.size(),
reinterpret_cast<const VkCalibratedTimestampInfoEXT *>( timestampInfos.data() ),
timestamps.data(),
&maxDeviation ) );
return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" );
}
template <typename Uint64_tAllocator,
typename Dispatch,
typename B,
typename std::enable_if<std::is_same<typename B::value_type, uint64_t>::value, int>::type>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t>>::type
Device::getCalibratedTimestampsEXT(
ArrayProxy<const VULKAN_HPP_NAMESPACE::CalibratedTimestampInfoEXT> const & timestampInfos,
Uint64_tAllocator & uint64_tAllocator,
Dispatch const & d ) const
{
std::pair<std::vector<uint64_t, Uint64_tAllocator>, uint64_t> data(
std::piecewise_construct,
std::forward_as_tuple( timestampInfos.size(), uint64_tAllocator ),
std::forward_as_tuple( 0 ) );
std::vector<uint64_t, Uint64_tAllocator> & timestamps = data.first;
uint64_t & maxDeviation = data.second;
Result result = static_cast<Result>(
d.vkGetCalibratedTimestampsEXT( m_device,
timestampInfos.size(),
reinterpret_cast<const VkCalibratedTimestampInfoEXT *>( timestampInfos.data() ),
timestamps.data(),
&maxDeviation ) );
return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getCalibratedTimestampsEXT" );
}
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
#ifdef VK_ENABLE_BETA_EXTENSIONS #ifdef VK_ENABLE_BETA_EXTENSIONS
@ -102675,7 +102740,10 @@ namespace VULKAN_HPP_NAMESPACE
{ {
std::pair<std::vector<PerformanceCounterKHR, PerformanceCounterKHRAllocator>, std::pair<std::vector<PerformanceCounterKHR, PerformanceCounterKHRAllocator>,
std::vector<PerformanceCounterDescriptionKHR, PerformanceCounterDescriptionKHRAllocator>> std::vector<PerformanceCounterDescriptionKHR, PerformanceCounterDescriptionKHRAllocator>>
enumeratedData; data;
std::vector<PerformanceCounterKHR, PerformanceCounterKHRAllocator> & counters = data.first;
std::vector<PerformanceCounterDescriptionKHR, PerformanceCounterDescriptionKHRAllocator> & counterDescriptions =
data.second;
uint32_t counterCount; uint32_t counterCount;
Result result; Result result;
do do
@ -102684,26 +102752,24 @@ namespace VULKAN_HPP_NAMESPACE
m_physicalDevice, queueFamilyIndex, &counterCount, nullptr, nullptr ) ); m_physicalDevice, queueFamilyIndex, &counterCount, nullptr, nullptr ) );
if ( ( result == Result::eSuccess ) && counterCount ) if ( ( result == Result::eSuccess ) && counterCount )
{ {
enumeratedData.first.resize( counterCount ); counters.resize( counterCount );
enumeratedData.second.resize( counterCount ); counterDescriptions.resize( counterCount );
result = static_cast<Result>( d.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( result = static_cast<Result>( d.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
m_physicalDevice, m_physicalDevice,
queueFamilyIndex, queueFamilyIndex,
&counterCount, &counterCount,
reinterpret_cast<VkPerformanceCounterKHR *>( enumeratedData.first.data() ), reinterpret_cast<VkPerformanceCounterKHR *>( counters.data() ),
reinterpret_cast<VkPerformanceCounterDescriptionKHR *>( enumeratedData.second.data() ) ) ); reinterpret_cast<VkPerformanceCounterDescriptionKHR *>( counterDescriptions.data() ) ) );
VULKAN_HPP_ASSERT( counterCount <= enumeratedData.first.size() ); VULKAN_HPP_ASSERT( counterCount <= counters.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( ( result == Result::eSuccess ) && ( counterCount < enumeratedData.first.size() ) ) if ( ( result == Result::eSuccess ) && ( counterCount < counters.size() ) )
{ {
enumeratedData.first.resize( counterCount ); counters.resize( counterCount );
enumeratedData.second.resize( counterCount ); counterDescriptions.resize( counterCount );
} }
return createResultValue( result, return createResultValue(
enumeratedData, result, data, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" );
VULKAN_HPP_NAMESPACE_STRING
"::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" );
} }
template <typename PerformanceCounterKHRAllocator, template <typename PerformanceCounterKHRAllocator,
@ -102725,9 +102791,12 @@ namespace VULKAN_HPP_NAMESPACE
{ {
std::pair<std::vector<PerformanceCounterKHR, PerformanceCounterKHRAllocator>, std::pair<std::vector<PerformanceCounterKHR, PerformanceCounterKHRAllocator>,
std::vector<PerformanceCounterDescriptionKHR, PerformanceCounterDescriptionKHRAllocator>> std::vector<PerformanceCounterDescriptionKHR, PerformanceCounterDescriptionKHRAllocator>>
enumeratedData( std::piecewise_construct, data( std::piecewise_construct,
std::forward_as_tuple( performanceCounterKHRAllocator ), std::forward_as_tuple( performanceCounterKHRAllocator ),
std::forward_as_tuple( performanceCounterDescriptionKHRAllocator ) ); std::forward_as_tuple( performanceCounterDescriptionKHRAllocator ) );
std::vector<PerformanceCounterKHR, PerformanceCounterKHRAllocator> & counters = data.first;
std::vector<PerformanceCounterDescriptionKHR, PerformanceCounterDescriptionKHRAllocator> & counterDescriptions =
data.second;
uint32_t counterCount; uint32_t counterCount;
Result result; Result result;
do do
@ -102736,26 +102805,24 @@ namespace VULKAN_HPP_NAMESPACE
m_physicalDevice, queueFamilyIndex, &counterCount, nullptr, nullptr ) ); m_physicalDevice, queueFamilyIndex, &counterCount, nullptr, nullptr ) );
if ( ( result == Result::eSuccess ) && counterCount ) if ( ( result == Result::eSuccess ) && counterCount )
{ {
enumeratedData.first.resize( counterCount ); counters.resize( counterCount );
enumeratedData.second.resize( counterCount ); counterDescriptions.resize( counterCount );
result = static_cast<Result>( d.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( result = static_cast<Result>( d.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
m_physicalDevice, m_physicalDevice,
queueFamilyIndex, queueFamilyIndex,
&counterCount, &counterCount,
reinterpret_cast<VkPerformanceCounterKHR *>( enumeratedData.first.data() ), reinterpret_cast<VkPerformanceCounterKHR *>( counters.data() ),
reinterpret_cast<VkPerformanceCounterDescriptionKHR *>( enumeratedData.second.data() ) ) ); reinterpret_cast<VkPerformanceCounterDescriptionKHR *>( counterDescriptions.data() ) ) );
VULKAN_HPP_ASSERT( counterCount <= enumeratedData.first.size() ); VULKAN_HPP_ASSERT( counterCount <= counters.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( ( result == Result::eSuccess ) && ( counterCount < enumeratedData.first.size() ) ) if ( ( result == Result::eSuccess ) && ( counterCount < counters.size() ) )
{ {
enumeratedData.first.resize( counterCount ); counters.resize( counterCount );
enumeratedData.second.resize( counterCount ); counterDescriptions.resize( counterCount );
} }
return createResultValue( result, return createResultValue(
enumeratedData, result, data, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" );
VULKAN_HPP_NAMESPACE_STRING
"::PhysicalDevice::enumerateQueueFamilyPerformanceQueryCountersKHR" );
} }
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/