Merge pull request #1293 from asuessenbach/function

Combine two types of commands into one generation function
This commit is contained in:
Andreas Süßenbach 2022-04-27 15:31:55 +02:00 committed by GitHub
commit 0130a3e280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 173 additions and 137 deletions

View File

@ -2268,7 +2268,8 @@ std::string VulkanHppGenerator::generateAllocatorTemplates( std::vector<size_t>
std::map<size_t, size_t> const & vectorParams, std::map<size_t, size_t> const & vectorParams,
bool definition, bool definition,
bool singular, bool singular,
bool unique ) const bool unique,
bool chained ) const
{ {
assert( returnParams.size() == returnDataTypes.size() ); assert( returnParams.size() == returnDataTypes.size() );
std::string allocatorTemplates; std::string allocatorTemplates;
@ -2278,10 +2279,21 @@ std::string VulkanHppGenerator::generateAllocatorTemplates( std::vector<size_t>
{ {
if ( vectorParams.find( returnParams[i] ) != vectorParams.end() ) if ( vectorParams.find( returnParams[i] ) != vectorParams.end() )
{ {
allocatorTemplates += "typename " + startUpperCase( stripPrefix( returnDataTypes[i], "VULKAN_HPP_NAMESPACE::" ) ) + "Allocator"; if ( chained )
if ( !definition )
{ {
allocatorTemplates += " = std::allocator<" + ( unique ? ( "UniqueHandle<" + returnDataTypes[i] + ", Dispatch>" ) : returnDataTypes[i] ) + ">"; allocatorTemplates += "typename StructureChainAllocator";
if ( !definition )
{
allocatorTemplates += " = std::allocator<StructureChain>";
}
}
else
{
allocatorTemplates += "typename " + startUpperCase( stripPrefix( returnDataTypes[i], "VULKAN_HPP_NAMESPACE::" ) ) + "Allocator";
if ( !definition )
{
allocatorTemplates += " = std::allocator<" + ( unique ? ( "UniqueHandle<" + returnDataTypes[i] + ", Dispatch>" ) : returnDataTypes[i] ) + ">";
}
} }
allocatorTemplates += ", "; allocatorTemplates += ", ";
} }
@ -2962,7 +2974,9 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
std::map<size_t, size_t> const & vectorParams, std::map<size_t, size_t> const & vectorParams,
size_t initialSkipCount, size_t initialSkipCount,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams ) const std::set<size_t> const & templatedParams,
bool withAllocator,
bool chained ) const
{ {
// if at least one returnParam is a size value of a vector param (and no singular params), we need two calls // if at least one returnParam is a size value of a vector param (and no singular params), we need two calls
if ( singularParams.empty() && if ( singularParams.empty() &&
@ -2982,17 +2996,46 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) ); std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) );
std::string vectorSize = startLowerCase( stripPrefix( commandData.params[vectorParamIt->second].name, "p" ) ); std::string vectorSize = startLowerCase( stripPrefix( commandData.params[vectorParamIt->second].name, "p" ) );
std::string const callSequenceTemplate = R"(d.${vkCommand}( ${firstCallArguments} ); if ( chained )
{
// chained data needs some more handling!!
std::string vectorElementType = stripPostfix( commandData.params[vectorParamIt->first].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
const std::string callSequenceTemplate =
R"(d.${vkCommand}( ${firstCallArguments} );
std::vector<StructureChain, StructureChainAllocator> structureChains( ${counterName}${structureChainAllocator} );
std::vector<${vectorElementType}> ${vectorName}( ${counterName} );
for ( ${counterType} i = 0; i < ${counterName}; i++ )
{
${vectorName}[i].pNext = structureChains[i].template get<${vectorElementType}>().pNext;
}
d.${vkCommand}( ${secondCallArguments} );
VULKAN_HPP_ASSERT( ${counterName} <= ${vectorName}.size() );)";
return replaceWithMap( callSequenceTemplate,
{ { "counterName", startLowerCase( stripPrefix( commandData.params[vectorParamIt->second].name, "p" ) ) },
{ "counterType", commandData.params[vectorParamIt->second].type.type },
{ "firstCallArguments", firstCallArguments },
{ "secondCallArguments", secondCallArguments },
{ "structureChainAllocator", withAllocator ? ( ", structureChainAllocator" ) : "" },
{ "vectorElementType", vectorElementType },
{ "vectorName", vectorName },
{ "vkCommand", name } } );
}
else
{
std::string const callSequenceTemplate = R"(d.${vkCommand}( ${firstCallArguments} );
${vectorName}.resize( ${vectorSize} ); ${vectorName}.resize( ${vectorSize} );
d.${vkCommand}( ${secondCallArguments} ); d.${vkCommand}( ${secondCallArguments} );
VULKAN_HPP_ASSERT( ${vectorSize} <= ${vectorName}.size() );)"; VULKAN_HPP_ASSERT( ${vectorSize} <= ${vectorName}.size() );)";
return replaceWithMap( callSequenceTemplate, return replaceWithMap( callSequenceTemplate,
{ { "firstCallArguments", firstCallArguments }, { { "firstCallArguments", firstCallArguments },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "vectorName", vectorName }, { "vectorName", vectorName },
{ "vectorSize", vectorSize }, { "vectorSize", vectorSize },
{ "vkCommand", name } } ); { "vkCommand", name } } );
}
} }
else else
{ {
@ -3005,6 +3048,12 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
} }
} }
std::string VulkanHppGenerator::generateChainTemplates( std::vector<size_t> const & returnParams, bool chained ) const
{
assert( !chained || ( returnParams.size() == 1 ) || ( returnParams.size() == 2 ) );
return chained ? ( ( returnParams.size() == 1 ) ? "typename X, typename Y, typename... Z, " : "typename StructureChain, " ) : "";
}
std::string VulkanHppGenerator::generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const std::string VulkanHppGenerator::generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const
{ {
std::string str; std::string str;
@ -3158,9 +3207,7 @@ std::string VulkanHppGenerator::generateCommandEnhanced( std::string const &
{ {
assert( returnParams.size() <= 2 ); assert( returnParams.size() <= 2 );
assert( vectorParams.empty() || ( vectorParams.begin()->second != INVALID_INDEX ) ); assert( vectorParams.empty() || ( vectorParams.begin()->second != INVALID_INDEX ) );
assert( !singular || !returnParams.empty() ); // if singular is true, then there is at least one returnParam ! assert( !singular || !returnParams.empty() ); // if singular is true, then there is at least one returnParam !
assert( !chained || ( returnParams.size() == 1 ) ); // if chained is true, then there is one returnParam !
assert( !chained || isStructureChainAnchor( commandData.params[returnParams[0]].type.type ) );
std::set<size_t> skippedParams = determineSkippedParams( commandData.params, initialSkipCount, vectorParams, returnParams, singular ); std::set<size_t> skippedParams = determineSkippedParams( commandData.params, initialSkipCount, vectorParams, returnParams, singular );
// special handling for vkGetMemoryHostPointerPropertiesEXT: here, we really need to stick with the const void * parameter ! // special handling for vkGetMemoryHostPointerPropertiesEXT: here, we really need to stick with the const void * parameter !
@ -3230,15 +3277,15 @@ std::string VulkanHppGenerator::generateCommandEnhanced( std::string const &
} }
std::string argumentTemplates = generateArgumentTemplates( commandData.params, templatedParams, false ); std::string argumentTemplates = generateArgumentTemplates( commandData.params, templatedParams, false );
std::string chainTemplates = chained ? "typename X, typename Y, typename... Z, " : ""; std::string chainTemplates = generateChainTemplates( returnParams, chained );
std::string allocatorTemplates = generateAllocatorTemplates( returnParams, dataTypes, vectorParams, definition, singular, unique ); std::string allocatorTemplates = generateAllocatorTemplates( returnParams, dataTypes, vectorParams, definition, singular, unique, chained );
std::string uniqueHandleAllocatorTemplates; std::string uniqueHandleAllocatorTemplates;
if ( unique && !allocatorTemplates.empty() ) if ( unique && !allocatorTemplates.empty() )
{ {
uniqueHandleAllocatorTemplates = ", " + stripPostfix( allocatorTemplates, ", " ); uniqueHandleAllocatorTemplates = ", " + stripPostfix( allocatorTemplates, ", " );
allocatorTemplates.clear(); allocatorTemplates.clear();
} }
std::string typenameCheck = generateTypenameCheck( commandData, returnParams, vectorParams, definition, singular, withAllocator, unique ); std::string typenameCheck = generateTypenameCheck( commandData, returnParams, vectorParams, definition, singular, withAllocator, unique, chained );
std::string nodiscard = generateNoDiscard( !returnParams.empty(), 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() ); std::string nodiscard = generateNoDiscard( !returnParams.empty(), 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
std::string returnType = generateReturnType( commandData, returnParams, vectorParams, singular, unique, chained, dataType ); std::string returnType = generateReturnType( commandData, returnParams, vectorParams, singular, unique, chained, dataType );
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : ""; std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "";
@ -3265,9 +3312,10 @@ std::string VulkanHppGenerator::generateCommandEnhanced( std::string const &
std::string dataDeclarations = generateDataDeclarations( std::string dataDeclarations = generateDataDeclarations(
commandData, returnParams, vectorParams, templatedParams, singular, withAllocator, chained, unique, dataTypes, returnType, returnVariable ); commandData, returnParams, vectorParams, templatedParams, singular, withAllocator, chained, unique, dataTypes, returnType, returnVariable );
std::string dataPreparation = std::string dataPreparation =
generateDataPreparation( commandData, initialSkipCount, returnParams, vectorParams, templatedParams, singular, withAllocator, unique ); generateDataPreparation( commandData, initialSkipCount, returnParams, vectorParams, templatedParams, singular, withAllocator, unique, chained );
std::string dataSizeChecks = generateDataSizeChecks( commandData, returnParams, dataTypes, vectorParams, templatedParams, singular ); std::string dataSizeChecks = generateDataSizeChecks( commandData, returnParams, dataTypes, vectorParams, templatedParams, singular );
std::string callSequence = generateCallSequence( name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, templatedParams ); std::string callSequence =
generateCallSequence( name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, templatedParams, withAllocator, chained );
std::string resultCheck = generateResultCheck( commandData, className, classSeparator, commandName ); std::string resultCheck = generateResultCheck( commandData, className, classSeparator, commandName );
std::string returnStatement = generateReturnStatement( std::string returnStatement = generateReturnStatement(
name, commandData, returnVariable, returnType, dataType, initialSkipCount, returnParams.empty() ? INVALID_INDEX : returnParams[0], unique ); name, commandData, returnVariable, returnType, dataType, initialSkipCount, returnParams.empty() ? INVALID_INDEX : returnParams[0], unique );
@ -4697,8 +4745,8 @@ std::string VulkanHppGenerator::generateCommandVoid2Return(
generateCommandStandard( name, commandData, initialSkipCount, definition ), generateCommandStandard( name, commandData, initialSkipCount, definition ),
generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, false, false, false, false ), generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, false, false, false, false ),
generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, false, true, false, false ), generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, false, true, false, false ),
generateCommandVoidEnumerateChained( name, commandData, initialSkipCount, definition, *vectorParams.begin(), returnParams, false ), generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, false, false, true, false ),
generateCommandVoidEnumerateChained( name, commandData, initialSkipCount, definition, *vectorParams.begin(), returnParams, true ) ); generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, false, true, true, false ) );
} }
else if ( !isHandleType( commandData.params[returnParams[1]].type.type ) ) else if ( !isHandleType( commandData.params[returnParams[1]].type.type ) )
{ {
@ -4715,81 +4763,6 @@ std::string VulkanHppGenerator::generateCommandVoid2Return(
return ""; return "";
} }
std::string VulkanHppGenerator::generateCommandVoidEnumerateChained( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParams,
bool withAllocators ) const
{
assert( ( commandData.params[0].type.type == commandData.handle ) && ( commandData.returnType == "void" ) && commandData.successCodes.empty() &&
commandData.errorCodes.empty() );
std::set<size_t> skippedParams = determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParams, false );
std::string argumentList = generateArgumentListEnhanced( commandData.params, skippedParams, {}, {}, definition, withAllocators, true, true );
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags, false, false );
std::string vectorElementType = stripPostfix( commandData.params[vectorParamIndex.first].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
if ( definition )
{
const std::string functionTemplate =
R"( template <typename StructureChain, typename StructureChainAllocator, typename Dispatch${typenameCheck}>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<StructureChain, StructureChainAllocator> ${className}${classSeparator}${commandName}( ${argumentList} ) const
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
${counterType} ${counterName};
d.${vkCommand}( ${firstCallArguments} );
std::vector<StructureChain, StructureChainAllocator> returnVector( ${counterName}${structureChainAllocator} );
std::vector<${vectorElementType}> ${vectorName}( ${counterName} );
for ( ${counterType} i = 0; i < ${counterName}; i++ )
{
${vectorName}[i].pNext =
returnVector[i].template get<${vectorElementType}>().pNext;
}
d.${vkCommand}( ${secondCallArguments} );
VULKAN_HPP_ASSERT( ${counterName} <= ${vectorName}.size() );
for ( ${counterType} i = 0; i < ${counterName}; i++ )
{
returnVector[i].template get<${vectorElementType}>() = ${vectorName}[i];
}
return returnVector;
})";
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndex.first].name, "p" ) );
std::string typenameCheck =
withAllocators ? ( ", typename B, typename std::enable_if<std::is_same<typename B::value_type, StructureChain>::value, int>::type" ) : "";
return replaceWithMap( functionTemplate,
{ { "argumentList", argumentList },
{ "className", initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "" },
{ "classSeparator", commandData.handle.empty() ? "" : "::" },
{ "commandName", commandName },
{ "counterName", startLowerCase( stripPrefix( commandData.params[vectorParamIndex.second].name, "p" ) ) },
{ "counterType", commandData.params[vectorParamIndex.second].type.type },
{ "firstCallArguments", generateCallArgumentsEnhanced( commandData, initialSkipCount, true, {}, {}, false ) },
{ "secondCallArguments", generateCallArgumentsEnhanced( commandData, initialSkipCount, false, {}, {}, false ) },
{ "structureChainAllocator", withAllocators ? ( ", structureChainAllocator" ) : "" },
{ "typenameCheck", typenameCheck },
{ "vectorElementType", vectorElementType },
{ "vectorName", vectorName },
{ "vkCommand", name } } );
}
else
{
const std::string functionTemplate =
R"( template <typename StructureChain, typename StructureChainAllocator = std::allocator<StructureChain>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${typenameCheck}>
VULKAN_HPP_NODISCARD std::vector<StructureChain, StructureChainAllocator> ${commandName}( ${argumentList} ) const;)";
std::string typenameCheck =
withAllocators
? ( ", typename B = StructureChainAllocator, typename std::enable_if<std::is_same<typename B::value_type, StructureChain>::value, int>::type = 0" )
: "";
return replaceWithMap( functionTemplate, { { "argumentList", argumentList }, { "commandName", commandName }, { "typenameCheck", typenameCheck } } );
}
}
std::string VulkanHppGenerator::generateConstexprString( std::string const & structName ) const std::string VulkanHppGenerator::generateConstexprString( std::string const & structName ) const
{ {
// structs with a VkBaseInStructure and VkBaseOutStructure can't be a constexpr! // structs with a VkBaseInStructure and VkBaseOutStructure can't be a constexpr!
@ -4851,6 +4824,22 @@ std::string VulkanHppGenerator::generateDataDeclarations( CommandData const &
} }
break; break;
case 2: case 2:
if ( chained )
{
assert( !singular );
assert( returnParams.size() == 2 );
assert( vectorParams.find( returnParams[0] ) == vectorParams.end() );
auto vectorParamIt = vectorParams.find( returnParams[1] );
assert( vectorParamIt != vectorParams.end() );
assert( vectorParamIt->second == returnParams[0] );
std::string const dataDeclarationTemplate = R"(${counterType} ${counterName};)";
dataDeclarations = replaceWithMap(
dataDeclarationTemplate,
{ { "counterName", startLowerCase( stripPrefix( commandData.params[returnParams[0]].name, "p" ) ) }, { "counterType", dataTypes[0] } } );
}
else
{ {
auto vectorParamIt = vectorParams.find( returnParams[0] ); auto vectorParamIt = vectorParams.find( returnParams[0] );
if ( vectorParamIt == vectorParams.end() || singular ) if ( vectorParamIt == vectorParams.end() || singular )
@ -4882,7 +4871,7 @@ std::string VulkanHppGenerator::generateDataDeclarations( CommandData const &
} }
else else
{ {
assert( !singular && !chained ); assert( !singular );
assert( vectorParamIt->second == returnParams[0] ); assert( vectorParamIt->second == returnParams[0] );
assert( commandData.params[returnParams[0]].type.isNonConstPointer() ); assert( commandData.params[returnParams[0]].type.isNonConstPointer() );
@ -4937,9 +4926,33 @@ std::string VulkanHppGenerator::generateDataPreparation( CommandData const &
std::set<size_t> const & templatedParams, std::set<size_t> const & templatedParams,
bool singular, bool singular,
bool withAllocator, bool withAllocator,
bool unique ) const bool unique,
bool chained ) const
{ {
if ( unique && !singular && ( returnParams.size() == 1 ) && ( vectorParams.find( returnParams[0] ) != vectorParams.end() ) ) if ( chained && ( returnParams.size() == 2 ) )
{
assert( !unique && !singular );
assert( vectorParams.find( returnParams[0] ) == vectorParams.end() );
auto vectorParamIt = vectorParams.find( returnParams[1] );
assert( ( vectorParamIt != vectorParams.end() ) && ( vectorParamIt->second == returnParams[0] ) );
assert( templatedParams.empty() );
std::string vectorElementType = stripPostfix( commandData.params[vectorParamIt->first].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) );
std::string const dataPreparationTemplate =
R"(for ( ${counterType} i = 0; i < ${counterName}; i++ )
{
structureChains[i].template get<${vectorElementType}>() = ${vectorName}[i];
})";
return replaceWithMap( dataPreparationTemplate,
{ { "counterName", startLowerCase( stripPrefix( commandData.params[vectorParamIt->second].name, "p" ) ) },
{ "counterType", commandData.params[vectorParamIt->second].type.type },
{ "vectorElementType", vectorElementType },
{ "vectorName", vectorName } } );
}
else if ( unique && !singular && ( returnParams.size() == 1 ) && ( vectorParams.find( returnParams[0] ) != vectorParams.end() ) )
{ {
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : ""; std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "";
std::string deleterDefinition; std::string deleterDefinition;
@ -10050,13 +10063,24 @@ std::string VulkanHppGenerator::generateReturnType( CommandData const &
std::string returnType; std::string returnType;
if ( chained ) if ( chained )
{ {
assert( ( commandData.returnType == "void" ) || ( commandData.returnType == "VkResult" ) ); assert( !singular && !unique );
assert( returnParams.size() == 1 ); if ( returnParams.size() == 1 )
assert( isStructureChainAnchor( commandData.params[returnParams[0]].type.type ) );
returnType = "StructureChain<X, Y, Z...>";
if ( commandData.returnType == "VkResult" )
{ {
returnType = "typename ResultValueType<" + returnType + ">::type"; assert( ( commandData.returnType == "void" ) || ( commandData.returnType == "VkResult" ) );
assert( isStructureChainAnchor( commandData.params[returnParams[0]].type.type ) );
returnType = "StructureChain<X, Y, Z...>";
if ( commandData.returnType == "VkResult" )
{
returnType = "typename ResultValueType<" + returnType + ">::type";
}
}
else
{
assert( returnParams.size() == 2 );
assert( commandData.returnType == "void" );
auto vectorIt = vectorParams.find( returnParams[1] );
assert( ( vectorIt != vectorParams.end() ) && ( vectorIt->second == returnParams[0] ) );
returnType = "std::vector<StructureChain, StructureChainAllocator>";
} }
} }
else if ( commandData.returnType == "VkResult" ) else if ( commandData.returnType == "VkResult" )
@ -10146,7 +10170,11 @@ std::string VulkanHppGenerator::generateReturnVariable(
} }
break; break;
case 2: case 2:
assert( !chained ); if ( chained )
{
returnVariable = "structureChains";
}
else
{ {
auto vectorParamIt = vectorParams.find( returnParams[1] ); auto vectorParamIt = vectorParams.find( returnParams[1] );
if ( vectorParamIt == vectorParams.end() ) if ( vectorParamIt == vectorParams.end() )
@ -11194,7 +11222,8 @@ std::string VulkanHppGenerator::generateTypenameCheck( CommandData const &
bool definition, bool definition,
bool singular, bool singular,
bool withAllocator, bool withAllocator,
bool unique ) const bool unique,
bool chained ) const
{ {
std::string typenameCheck; std::string typenameCheck;
if ( !singular && withAllocator ) if ( !singular && withAllocator )
@ -11203,7 +11232,7 @@ std::string VulkanHppGenerator::generateTypenameCheck( CommandData const &
{ {
if ( vectorParams.find( returnParam ) != vectorParams.end() ) if ( vectorParams.find( returnParam ) != vectorParams.end() )
{ {
std::string elementType = stripPrefix( commandData.params[returnParam].type.type, "Vk" ); std::string elementType = chained ? "StructureChain" : stripPrefix( commandData.params[returnParam].type.type, "Vk" );
std::string extendedElementType = elementType; std::string extendedElementType = elementType;
if ( unique ) if ( unique )
{ {

View File

@ -423,7 +423,8 @@ private:
std::map<size_t, size_t> const & vectorParams, std::map<size_t, size_t> const & vectorParams,
bool definition, bool definition,
bool singular, bool singular,
bool unique ) const; bool unique,
bool chained ) const;
std::string generateArgumentListEnhanced( std::vector<ParamData> const & params, std::string generateArgumentListEnhanced( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams, std::set<size_t> const & skippedParams,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
@ -466,7 +467,10 @@ private:
std::map<size_t, size_t> const & vectorParams, std::map<size_t, size_t> const & vectorParams,
size_t initialSkipCount, size_t initialSkipCount,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams ) const; std::set<size_t> const & templatedParams,
bool withAllocator,
bool chained ) const;
std::string generateChainTemplates( std::vector<size_t> const & returnParams, bool chained ) const;
std::string generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const;
std::string std::string
generateCommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const; generateCommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
@ -609,13 +613,6 @@ private:
generateCommandVoid1Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam ) const; generateCommandVoid1Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam ) const;
std::string generateCommandVoid2Return( std::string generateCommandVoid2Return(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector<size_t> const & returnParamIndices ) const; std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector<size_t> const & returnParamIndices ) const;
std::string generateCommandVoidEnumerateChained( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices,
bool withAllocators ) const;
std::string generateConstexprString( std::string const & structName ) const; std::string generateConstexprString( std::string const & structName ) const;
std::string generateDataDeclarations( CommandData const & commandData, std::string generateDataDeclarations( CommandData const & commandData,
std::vector<size_t> const & returnParams, std::vector<size_t> const & returnParams,
@ -635,7 +632,8 @@ private:
std::set<size_t> const & templatedParams, std::set<size_t> const & templatedParams,
bool singular, bool singular,
bool withAllocator, bool withAllocator,
bool unique ) const; bool unique,
bool chained ) const;
std::string generateDataSizeChecks( CommandData const & commandData, std::string generateDataSizeChecks( CommandData const & commandData,
std::vector<size_t> const & returnParams, std::vector<size_t> const & returnParams,
std::vector<std::string> const & returnParamTypes, std::vector<std::string> const & returnParamTypes,
@ -991,7 +989,8 @@ private:
bool definition, bool definition,
bool singular, bool singular,
bool withAllocator, bool withAllocator,
bool unique ) const; bool unique,
bool chained ) const;
std::string generateUnion( std::pair<std::string, StructureData> const & structure ) const; std::string generateUnion( std::pair<std::string, StructureData> const & structure ) const;
std::string generateUniqueTypes( std::string const & parentType, std::set<std::string> const & childrenTypes ) const; std::string generateUniqueTypes( std::string const & parentType, std::set<std::string> const & childrenTypes ) const;
std::string generateVectorSizeCheck( std::string const & name, std::string generateVectorSizeCheck( std::string const & name,

View File

@ -5690,22 +5690,24 @@ namespace VULKAN_HPP_NAMESPACE
PhysicalDevice::getQueueFamilyProperties2( Dispatch const & d ) const PhysicalDevice::getQueueFamilyProperties2( Dispatch const & d ) const
{ {
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION ); VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
uint32_t queueFamilyPropertyCount; uint32_t queueFamilyPropertyCount;
d.vkGetPhysicalDeviceQueueFamilyProperties2( m_physicalDevice, &queueFamilyPropertyCount, nullptr ); d.vkGetPhysicalDeviceQueueFamilyProperties2( m_physicalDevice, &queueFamilyPropertyCount, nullptr );
std::vector<StructureChain, StructureChainAllocator> returnVector( queueFamilyPropertyCount ); std::vector<StructureChain, StructureChainAllocator> structureChains( queueFamilyPropertyCount );
std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount ); std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
queueFamilyProperties[i].pNext = returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext; queueFamilyProperties[i].pNext = structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext;
} }
d.vkGetPhysicalDeviceQueueFamilyProperties2( d.vkGetPhysicalDeviceQueueFamilyProperties2(
m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) ); m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) );
VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() ); VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i]; structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i];
} }
return returnVector; return structureChains;
} }
template <typename StructureChain, template <typename StructureChain,
@ -5717,22 +5719,24 @@ namespace VULKAN_HPP_NAMESPACE
PhysicalDevice::getQueueFamilyProperties2( StructureChainAllocator & structureChainAllocator, Dispatch const & d ) const PhysicalDevice::getQueueFamilyProperties2( StructureChainAllocator & structureChainAllocator, Dispatch const & d ) const
{ {
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION ); VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
uint32_t queueFamilyPropertyCount; uint32_t queueFamilyPropertyCount;
d.vkGetPhysicalDeviceQueueFamilyProperties2( m_physicalDevice, &queueFamilyPropertyCount, nullptr ); d.vkGetPhysicalDeviceQueueFamilyProperties2( m_physicalDevice, &queueFamilyPropertyCount, nullptr );
std::vector<StructureChain, StructureChainAllocator> returnVector( queueFamilyPropertyCount, structureChainAllocator ); std::vector<StructureChain, StructureChainAllocator> structureChains( queueFamilyPropertyCount, structureChainAllocator );
std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount ); std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
queueFamilyProperties[i].pNext = returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext; queueFamilyProperties[i].pNext = structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext;
} }
d.vkGetPhysicalDeviceQueueFamilyProperties2( d.vkGetPhysicalDeviceQueueFamilyProperties2(
m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) ); m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) );
VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() ); VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i]; structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i];
} }
return returnVector; return structureChains;
} }
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -10787,22 +10791,24 @@ namespace VULKAN_HPP_NAMESPACE
PhysicalDevice::getQueueFamilyProperties2KHR( Dispatch const & d ) const PhysicalDevice::getQueueFamilyProperties2KHR( Dispatch const & d ) const
{ {
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION ); VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
uint32_t queueFamilyPropertyCount; uint32_t queueFamilyPropertyCount;
d.vkGetPhysicalDeviceQueueFamilyProperties2KHR( m_physicalDevice, &queueFamilyPropertyCount, nullptr ); d.vkGetPhysicalDeviceQueueFamilyProperties2KHR( m_physicalDevice, &queueFamilyPropertyCount, nullptr );
std::vector<StructureChain, StructureChainAllocator> returnVector( queueFamilyPropertyCount ); std::vector<StructureChain, StructureChainAllocator> structureChains( queueFamilyPropertyCount );
std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount ); std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
queueFamilyProperties[i].pNext = returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext; queueFamilyProperties[i].pNext = structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext;
} }
d.vkGetPhysicalDeviceQueueFamilyProperties2KHR( d.vkGetPhysicalDeviceQueueFamilyProperties2KHR(
m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) ); m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) );
VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() ); VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i]; structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i];
} }
return returnVector; return structureChains;
} }
template <typename StructureChain, template <typename StructureChain,
@ -10814,22 +10820,24 @@ namespace VULKAN_HPP_NAMESPACE
PhysicalDevice::getQueueFamilyProperties2KHR( StructureChainAllocator & structureChainAllocator, Dispatch const & d ) const PhysicalDevice::getQueueFamilyProperties2KHR( StructureChainAllocator & structureChainAllocator, Dispatch const & d ) const
{ {
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION ); VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
uint32_t queueFamilyPropertyCount; uint32_t queueFamilyPropertyCount;
d.vkGetPhysicalDeviceQueueFamilyProperties2KHR( m_physicalDevice, &queueFamilyPropertyCount, nullptr ); d.vkGetPhysicalDeviceQueueFamilyProperties2KHR( m_physicalDevice, &queueFamilyPropertyCount, nullptr );
std::vector<StructureChain, StructureChainAllocator> returnVector( queueFamilyPropertyCount, structureChainAllocator ); std::vector<StructureChain, StructureChainAllocator> structureChains( queueFamilyPropertyCount, structureChainAllocator );
std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount ); std::vector<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2> queueFamilyProperties( queueFamilyPropertyCount );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
queueFamilyProperties[i].pNext = returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext; queueFamilyProperties[i].pNext = structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>().pNext;
} }
d.vkGetPhysicalDeviceQueueFamilyProperties2KHR( d.vkGetPhysicalDeviceQueueFamilyProperties2KHR(
m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) ); m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast<VkQueueFamilyProperties2 *>( queueFamilyProperties.data() ) );
VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() ); VULKAN_HPP_ASSERT( queueFamilyPropertyCount <= queueFamilyProperties.size() );
for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ ) for ( uint32_t i = 0; i < queueFamilyPropertyCount; i++ )
{ {
returnVector[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i]; structureChains[i].template get<VULKAN_HPP_NAMESPACE::QueueFamilyProperties2>() = queueFamilyProperties[i];
} }
return returnVector; return structureChains;
} }
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/