Refactor functions returning a vector of handles.

This commit is contained in:
asuessenbach 2020-10-07 22:44:44 +02:00
parent 637d6f77ef
commit 45c187997b
3 changed files with 503 additions and 186 deletions

View File

@ -1311,14 +1311,21 @@ void VulkanHppGenerator::appendCommand( std::string & str,
{
// the return parameter is the only vector parameter
auto vectorParamIndexIt = vectorParamIndices.begin();
assert( vectorParamIndexIt->first == *nonConstPointerParamIndices.begin() );
assert( commandData.params[vectorParamIndexIt->second].type.isValue() );
if ( commandData.params[vectorParamIndexIt->first].type.type == "void" )
assert( vectorParamIndexIt->first == nonConstPointerParamIndices[0] );
if ( isHandleType( commandData.params[nonConstPointerParamIndices[0]].type.type ) )
{
assert( isParamIndirect( commandData.params[vectorParamIndexIt->first].len,
commandData.params[vectorParamIndexIt->second] ) );
appendCommandGetVectorOfHandles( str, name, commandData, *vectorParamIndexIt, definition );
}
else
{
// the size of the vector parameter is given by a value -> just get that stuff
appendCommandGetVector( str, name, commandData, vectorParamIndices, definition );
appendedFunction = true;
assert( commandData.params[vectorParamIndexIt->first].type.type == "void" );
assert( commandData.params[vectorParamIndexIt->second].type.isValue() );
appendCommandGetVector( str, name, commandData, *vectorParamIndexIt, definition );
}
appendedFunction = true;
}
break;
default: break;
@ -1767,14 +1774,13 @@ ${leave})";
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
}
void VulkanHppGenerator::appendCommandGetVector( std::string & str,
std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const
void VulkanHppGenerator::appendCommandGetVector( std::string & str,
std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const
{
assert( commandData.returnType == "VkResult" );
assert( vectorParamIndices.size() == 1 );
std::string const functionTemplate = R"(
${enter}${commandStandard}${newlineOnDefinition}
@ -1802,6 +1808,46 @@ ${leave})";
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
}
void VulkanHppGenerator::appendCommandGetVectorOfHandles( std::string & str,
std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const
{
assert( commandData.returnType == "VkResult" );
std::string const functionTemplate = R"(
${enter}${commandStandard}${newlineOnDefinition}
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
${commandEnhanced}${newlineOnDefinition}
${commandEnhancedWithAllocators}${newlineOnDefinition}
# ifndef VULKAN_HPP_NO_SMART_HANDLE
${commandEnhancedUnique}${newlineOnDefinition}
${commandEnhancedUniqueWithAllocators}
# endif /*VULKAN_HPP_NO_SMART_HANDLE*/
#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",
constructCommandGetVectorOfHandles( name, commandData, vectorParamIndices, definition, false ) },
{ "commandEnhancedUnique",
constructCommandGetVectorOfUniqueHandles( name, commandData, vectorParamIndices, definition, false ) },
{ "commandEnhancedUniqueWithAllocators",
constructCommandGetVectorOfUniqueHandles( name, commandData, vectorParamIndices, definition, true ) },
{ "commandEnhancedWithAllocators",
constructCommandGetVectorOfHandles( name, commandData, vectorParamIndices, definition, true ) },
{ "commandStandard", constructCommandStandard( name, commandData, definition ) },
{ "enter", enter },
{ "leave", leave },
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
}
void VulkanHppGenerator::appendCommandSimple( std::string & str,
std::string const & name,
CommandData const & commandData,
@ -2633,7 +2679,7 @@ std::string VulkanHppGenerator::appendFunctionBodyEnhancedLocalReturnVariable(
if ( vpiIt != vectorParamIndices.end() && !twoStep )
{
appendFunctionBodyEnhancedLocalReturnVariableVectorSize(
str, commandData.params, *vpiIt, returnParamIndex, vectorParamIndices, withAllocator );
str, commandData.params, *vpiIt, vectorParamIndices, withAllocator );
}
else if ( withAllocator )
{
@ -2649,40 +2695,21 @@ void VulkanHppGenerator::appendFunctionBodyEnhancedLocalReturnVariableVectorSize
std::string & str,
std::vector<ParamData> const & params,
std::pair<size_t, size_t> const & vectorParamIndex,
size_t returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocator ) const
{
// if the return parameter is a vector parameter, and not part of a two-step algorithm, initialize its size
std::string size;
if ( vectorParamIndex.second == INVALID_INDEX )
assert( vectorParamIndex.second != INVALID_INDEX );
// the size of the vector is given by an other parameter
// first check, if that size has become the size of some other vector parameter
// -> look for it and get it's actual size
for ( auto const & vpi : vectorParamIndices )
{
assert( !params[returnParamIndex].len.empty() );
// the size of the vector is not given by an other parameter, but by some member of a parameter, described as
// 'parameter->member'
// -> replace the '->' by '.' and filter out the leading 'p' to access that value
size = startLowerCase( stripPrefix( params[returnParamIndex].len, "p" ) );
size_t pos = size.find( "->" );
if ( pos == std::string::npos )
if ( ( vpi.first != vectorParamIndex.first ) && ( vpi.second == vectorParamIndex.second ) )
{
// other notation possibility: ::
pos = size.find( "::" );
}
assert( pos != std::string::npos );
size.replace( pos, 2, "." );
}
else
{
// the size of the vector is given by an other parameter
// first check, if that size has become the size of some other vector parameter
// -> look for it and get it's actual size
for ( auto const & vpi : vectorParamIndices )
{
if ( ( vpi.first != vectorParamIndex.first ) && ( vpi.second == vectorParamIndex.second ) )
{
size = startLowerCase( stripPrefix( params[vpi.first].name, "p" ) ) + ".size()";
break;
}
size = startLowerCase( stripPrefix( params[vpi.first].name, "p" ) ) + ".size()";
break;
}
}
assert( !size.empty() );
@ -4429,7 +4456,7 @@ std::string VulkanHppGenerator::constructCommandEnumerateVoid( std::string const
if ( definition )
{
const std::string functionTemplate =
R"( template <typename ${vectorElementType}Allocator, typename Dispatch${withAllocatorTypenameCheck}>
R"( template <typename ${vectorElementType}Allocator, typename Dispatch${typenameCheck}>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${className}::${commandName}( ${argumentList} ) const
{
std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${vectorName}${vectorAllocator};
@ -4441,10 +4468,9 @@ std::string VulkanHppGenerator::constructCommandEnumerateVoid( std::string const
return ${vectorName};
})";
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndex.first].name, "p" ) );
std::string withAllocatorsTypenameCheck =
", typename B, typename std::enable_if<std::is_same<typename B::value_type, " + vectorElementType +
">::value, int>::type ";
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndex.first].name, "p" ) );
std::string typenameCheck = ", typename B, typename std::enable_if<std::is_same<typename B::value_type, " +
vectorElementType + ">::value, int>::type ";
str = replaceWithMap(
functionTemplate,
@ -4458,11 +4484,11 @@ std::string VulkanHppGenerator::constructCommandEnumerateVoid( std::string const
constructCallArgumentsEnumerateVectors( commandData.params, { vectorParamIndex }, true ) },
{ "secondCallArguments",
constructCallArgumentsEnumerateVectors( commandData.params, { vectorParamIndex }, false ) },
{ "typenameCheck", withAllocators ? typenameCheck : "" },
{ "vectorAllocator", withAllocators ? ( "( " + vectorName + "Allocator )" ) : "" },
{ "vectorElementType", vectorElementType },
{ "vectorName", vectorName },
{ "vkCommand", name },
{ "withAllocatorTypenameCheck", withAllocators ? withAllocatorsTypenameCheck : "" } } ) );
{ "vkCommand", name } } ) );
}
else
{
@ -4470,17 +4496,16 @@ std::string VulkanHppGenerator::constructCommandEnumerateVoid( std::string const
R"( template <typename ${vectorElementType}Allocator = std::allocator<${vectorElementType}>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${withAllocatorTypenameCheck}>
VULKAN_HPP_NODISCARD std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${commandName}( ${argumentList} ) const;)";
std::string withAllocatorsTypenameCheck =
", typename B = " + vectorElementType +
"Allocator, typename std::enable_if<std::is_same<typename B::value_type, " + vectorElementType +
">::value, int>::type = 0";
std::string typenameCheck = ", typename B = " + vectorElementType +
"Allocator, 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>(
{ { "argumentList", argumentList },
{ "commandName", commandName },
{ "vectorElementType", vectorElementType },
{ "withAllocatorTypenameCheck", withAllocators ? withAllocatorsTypenameCheck : "" } } ) );
str = replaceWithMap(
functionTemplate,
std::map<std::string, std::string>( { { "argumentList", argumentList },
{ "commandName", commandName },
{ "vectorElementType", vectorElementType },
{ "withAllocatorTypenameCheck", withAllocators ? typenameCheck : "" } } ) );
}
return str;
}
@ -4656,18 +4681,15 @@ std::string VulkanHppGenerator::constructCommandGetValue( std::string const & na
return str;
}
std::string VulkanHppGenerator::constructCommandGetVector( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const
std::string VulkanHppGenerator::constructCommandGetVector( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const
{
assert( vectorParamIndices.size() == 1 );
std::string str;
size_t vectorParamIndex = vectorParamIndices.begin()->first;
std::string argumentList =
constructArgumentListEnhanced( commandData.params, { 0, vectorParamIndex }, definition, false );
constructArgumentListEnhanced( commandData.params, { 0, vectorParamIndices.first }, definition, false );
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
std::string nodiscard = constructNoDiscardEnhanced( commandData );
std::string returnType = constructReturnType( commandData, "std::vector<T,Allocator>" );
@ -4688,12 +4710,11 @@ std::string VulkanHppGenerator::constructCommandGetVector( std::string const &
functionTemplate,
std::map<std::string, std::string>(
{ { "argumentList", argumentList },
{ "callArguments",
constructCallArgumentsGetVector( commandData.params, *vectorParamIndices.begin(), false ) },
{ "callArguments", constructCallArgumentsGetVector( commandData.params, vectorParamIndices, false ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName },
{ "dataName", startLowerCase( stripPrefix( commandData.params[vectorParamIndex].name, "p" ) ) },
{ "dataSize", commandData.params[vectorParamIndex].len },
{ "dataName", startLowerCase( stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) ) },
{ "dataSize", commandData.params[vectorParamIndices.first].len },
{ "nodiscard", nodiscard },
{ "returnType", returnType },
{ "successCodeList", constructSuccessCodeList( commandData.successCodes ) },
@ -4716,16 +4737,15 @@ std::string VulkanHppGenerator::constructCommandGetVector( std::string const &
}
std::string
VulkanHppGenerator::constructCommandGetVectorDeprecated( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const
VulkanHppGenerator::constructCommandGetVectorDeprecated( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const
{
std::string str;
std::map<size_t, size_t>::const_iterator vectorParamIndexIt = vectorParamIndices.begin();
std::string argumentList = constructFunctionHeaderArgumentsEnhanced(
commandData, INVALID_INDEX, vectorParamIndexIt->first, vectorParamIndices, false, !definition, false );
std::string argumentList = constructFunctionHeaderArgumentsEnhanced(
commandData, INVALID_INDEX, vectorParamIndices.first, { vectorParamIndices }, false, !definition, false );
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
std::string nodiscard = constructNoDiscardEnhanced( commandData );
std::string returnType = constructReturnType( commandData, "void" );
@ -4750,8 +4770,8 @@ std::string
name,
commandData,
INVALID_INDEX,
vectorParamIndexIt->first,
vectorParamIndices,
vectorParamIndices.first,
{ vectorParamIndices },
false,
"void",
false,
@ -4777,19 +4797,249 @@ std::string
return str;
}
std::string VulkanHppGenerator::constructCommandGetVectorSingular( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const
std::string
VulkanHppGenerator::constructCommandGetVectorOfHandles( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition,
bool withAllocator ) const
{
assert( vectorParamIndices.size() == 1 );
assert( !commandData.handle.empty() );
assert( commandData.successCodes.size() == 1 );
std::string str;
size_t vectorParamIndex = vectorParamIndices.begin()->first;
size_t sizeParamIndex = vectorParamIndices.begin()->second;
std::string argumentList =
constructArgumentListEnhanced( commandData.params, { 0, sizeParamIndex, vectorParamIndex }, definition, false );
constructArgumentListEnhanced( commandData.params, { 0, vectorParamIndices.first }, definition, withAllocator );
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
std::string nodiscard = constructNoDiscardEnhanced( commandData );
std::string handleType = stripPrefix( commandData.params[vectorParamIndices.first].type.type, "Vk" );
if ( definition )
{
std::string const functionTemplate =
R"( template <typename ${handleType}Allocator, typename Dispatch${typenameCheck}>
${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<std::vector<${handleType}, ${handleType}Allocator>>::type ${className}::${commandName}( ${argumentList} ) const
{
std::vector<${handleType}, ${handleType}Allocator> ${vectorName}( ${vectorSize}${vectorAllocator} );
Result result = static_cast<Result>( d.${vkCommand}( ${callArguments} ) );
return createResultValue( result, ${vectorName}, VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}" );
})";
std::vector<std::string> lenParts = tokenize( commandData.params[vectorParamIndices.first].len, "->" );
assert( lenParts.size() == 2 );
std::string typenameCheck = ", typename B, typename std::enable_if<std::is_same<typename B::value_type, " +
handleType + ">::value, int>::type ";
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) );
str = replaceWithMap(
functionTemplate,
std::map<std::string, std::string>(
{ { "argumentList", argumentList },
{ "callArguments", constructCallArgumentsGetVector( commandData.params, vectorParamIndices, false ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName },
{ "nodiscard", nodiscard },
{ "handleType", handleType },
{ "typenameCheck", withAllocator ? typenameCheck : "" },
{ "vectorAllocator", withAllocator ? ( ", " + vectorName + "Allocator" ) : "" },
{ "vectorName", vectorName },
{ "vectorSize", startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1] },
{ "vkCommand", name } } ) );
}
else
{
std::string const functionTemplate =
R"( template <typename ${handleType}Allocator = std::allocator<${handleType}>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${typenameCheck}>
${nodiscard}typename ResultValueType<std::vector<${handleType}, ${handleType}Allocator>>::type ${commandName}( ${argumentList} ) const;)";
std::string typenameCheck = ", typename B = " + handleType + "Allocator, typename std::enable_if<std::is_same<typename B::value_type, " +
handleType + ">::value, int>::type = 0";
str = replaceWithMap(
functionTemplate,
std::map<std::string, std::string>( { { "argumentList", argumentList },
{ "commandName", commandName },
{ "handleType", handleType },
{ "nodiscard", nodiscard },
{ "typenameCheck", withAllocator ? typenameCheck : "" } } ) );
}
return str;
}
std::string
VulkanHppGenerator::constructCommandGetVectorOfUniqueHandles( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition,
bool withAllocator ) const
{
assert( !commandData.handle.empty() );
assert( commandData.successCodes.size() == 1 );
std::string str;
std::string argumentList =
constructArgumentListEnhanced( commandData.params, { 0, vectorParamIndices.first }, definition, withAllocator );
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
std::string nodiscard = constructNoDiscardEnhanced( commandData );
std::string handleType = stripPrefix( commandData.params[vectorParamIndices.first].type.type, "Vk" );
if ( definition )
{
std::string const functionTemplate =
R"( template <typename Dispatch, typename ${handleType}Allocator${typenameCheck}>
${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<${handleType}, Dispatch>, ${handleType}Allocator>>::type ${className}::${commandName}Unique( ${argumentList} ) const
{
std::vector<UniqueHandle<${handleType}, Dispatch>, ${handleType}Allocator> ${uniqueVectorName}${vectorAllocator};
std::vector<${handleType}> ${vectorName}( ${vectorSize} );
Result result = static_cast<Result>( d.${vkCommand}( ${callArguments} ) );
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
${uniqueVectorName}.reserve( ${vectorSize} );
PoolFree<${className}, ${poolType}, Dispatch> deleter( *this, ${poolName}, d );
for ( size_t i=0; i < ${vectorSize}; i++ )
{
${uniqueVectorName}.push_back( UniqueHandle<${handleType}, Dispatch>( ${vectorName}[i], deleter ) );
}
}
return createResultValue( result, std::move( ${uniqueVectorName} ), VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}Unique" );
})";
std::vector<std::string> lenParts = tokenize( commandData.params[vectorParamIndices.first].len, "->" );
assert( lenParts.size() == 2 );
std::string poolType, poolName;
std::tie( poolType, poolName ) = getPoolTypeAndName( commandData.params[vectorParamIndices.second].type.type );
assert( !poolType.empty() );
std::string typenameCheck = ", typename B, typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<" +
handleType + ", Dispatch>>::value, int>::type ";
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) );
str = replaceWithMap(
functionTemplate,
std::map<std::string, std::string>(
{ { "argumentList", argumentList },
{ "callArguments", constructCallArgumentsGetVector( commandData.params, vectorParamIndices, false ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName },
{ "handleType", handleType },
{ "nodiscard", nodiscard },
{ "poolName", startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + poolName },
{ "poolType", stripPrefix( poolType, "Vk" ) },
{ "typenameCheck", withAllocator ? typenameCheck : "" },
{ "uniqueVectorName", "unique" + stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) },
{ "vectorAllocator", withAllocator ? ( "( " + vectorName + "Allocator )" ) : "" },
{ "vectorName", vectorName },
{ "vectorSize", startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1] },
{ "vkCommand", name } } ) );
}
else
{
std::string const functionTemplate =
R"( template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename ${handleType}Allocator = std::allocator<UniqueHandle<${handleType}, Dispatch>>${typenameCheck}>
${nodiscard}typename ResultValueType<std::vector<UniqueHandle<${handleType}, Dispatch>, ${handleType}Allocator>>::type ${commandName}Unique( ${argumentList} ) const;)";
std::string typenameCheck = ", typename B = " + handleType + "Allocator, typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<" +
handleType + ", Dispatch>>::value, int>::type = 0";
str = replaceWithMap( functionTemplate,
std::map<std::string, std::string>( { { "argumentList", argumentList },
{ "commandName", commandName },
{ "handleType", handleType },
{ "nodiscard", nodiscard },
{ "typenameCheck", withAllocator ? typenameCheck : "" } } ) );
}
return str;
}
std::string VulkanHppGenerator::constructCommandGetVectorOfUniqueHandlesWithAllocator(
std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const
{
assert( !commandData.handle.empty() );
assert( commandData.successCodes.size() == 1 );
std::string str;
std::string argumentList =
constructArgumentListEnhanced( commandData.params, { 0, vectorParamIndices.first }, definition, true );
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
std::string nodiscard = constructNoDiscardEnhanced( commandData );
std::string handleType = stripPrefix( commandData.params[vectorParamIndices.first].type.type, "Vk" );
if ( definition )
{
std::string const functionTemplate =
R"( template <typename Dispatch, typename Allocator, typename B, typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<${handleType}, Dispatch>>::value, int>::type>
${nodiscard}VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<${handleType}, Dispatch>, Allocator>>::type ${className}::${commandName}Unique( ${argumentList} ) const
{
std::vector<UniqueHandle<${handleType}, Dispatch>, Allocator> ${uniqueVectorName}( ${vectorName}Allocator );
std::vector<${handleType}> ${vectorName}( ${vectorSize} );
Result result = static_cast<Result>( d.${vkCommand}( ${callArguments} ) );
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
${uniqueVectorName}.reserve( ${vectorSize} );
PoolFree<${className}, ${poolType}, Dispatch> deleter( *this, ${poolName}, d );
for ( size_t i=0; i < ${vectorSize}; i++ )
{
${uniqueVectorName}.push_back( UniqueHandle<${handleType}, Dispatch>( ${vectorName}[i], deleter ) );
}
}
return createResultValue( result, std::move( ${uniqueVectorName} ), VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}Unique" );
})";
std::vector<std::string> lenParts = tokenize( commandData.params[vectorParamIndices.first].len, "->" );
assert( lenParts.size() == 2 );
std::string poolType, poolName;
std::tie( poolType, poolName ) = getPoolTypeAndName( commandData.params[vectorParamIndices.second].type.type );
assert( !poolType.empty() );
str = replaceWithMap(
functionTemplate,
std::map<std::string, std::string>(
{ { "argumentList", argumentList },
{ "callArguments", constructCallArgumentsGetVector( commandData.params, vectorParamIndices, false ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName },
{ "handleType", handleType },
{ "nodiscard", nodiscard },
{ "poolName", startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + poolName },
{ "poolType", stripPrefix( poolType, "Vk" ) },
{ "uniqueVectorName", "unique" + stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) },
{ "vectorName", startLowerCase( stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) ) },
{ "vectorSize", startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1] },
{ "vkCommand", name } } ) );
}
else
{
std::string const functionTemplate =
R"( template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename Allocator = std::allocator<UniqueHandle<${handleType}, Dispatch>>, typename B = Allocator, typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<${handleType}, Dispatch>>::value, int>::type = 0>
${nodiscard}typename ResultValueType<std::vector<UniqueHandle<${handleType}, Dispatch>, Allocator>>::type ${commandName}Unique( ${argumentList} ) const;)";
str = replaceWithMap( functionTemplate,
std::map<std::string, std::string>( { { "argumentList", argumentList },
{ "commandName", commandName },
{ "handleType", handleType },
{ "nodiscard", nodiscard } } ) );
}
return str;
}
std::string VulkanHppGenerator::constructCommandGetVectorSingular( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const
{
std::string str;
std::string argumentList = constructArgumentListEnhanced(
commandData.params, { 0, vectorParamIndices.second, vectorParamIndices.first }, definition, false );
std::string commandName = stripPluralS( determineCommandName( name, commandData.params[0].type.type ) );
std::string nodiscard = constructNoDiscardEnhanced( commandData );
std::string returnType = constructReturnType( commandData, "T" );
@ -4809,10 +5059,10 @@ std::string VulkanHppGenerator::constructCommandGetVectorSingular( std::string c
functionTemplate,
std::map<std::string, std::string>(
{ { "argumentList", argumentList },
{ "callArguments", constructCallArgumentsGetVector( commandData.params, *vectorParamIndices.begin(), true ) },
{ "callArguments", constructCallArgumentsGetVector( commandData.params, vectorParamIndices, true ) },
{ "className", stripPrefix( commandData.handle, "Vk" ) },
{ "commandName", commandName },
{ "dataName", startLowerCase( stripPrefix( commandData.params[vectorParamIndex].name, "p" ) ) },
{ "dataName", startLowerCase( stripPrefix( commandData.params[vectorParamIndices.first].name, "p" ) ) },
{ "nodiscard", nodiscard },
{ "returnType", returnType },
{ "successCodeList", constructSuccessCodeList( commandData.successCodes ) },
@ -6872,7 +7122,7 @@ std::map<size_t, size_t>
if ( !it->len.empty() )
{
auto findIt = std::find_if( params.begin(), it, [this, &params, &it]( ParamData const & pd ) {
return ( pd.name == it->len ) || isParamIndirect( it->len, params );
return ( pd.name == it->len ) || isParamIndirect( it->len, pd );
} );
if ( findIt < it )
@ -7143,6 +7393,20 @@ std::set<std::string> VulkanHppGenerator::getPlatforms( std::set<std::string> co
return platforms;
}
std::pair<std::string, std::string> VulkanHppGenerator::getPoolTypeAndName( std::string const & type ) const
{
auto structIt = m_structures.find( type );
assert( structIt != m_structures.end() );
auto memberIt = std::find_if( structIt->second.members.begin(),
structIt->second.members.end(),
[]( MemberData const & md ) { return md.name.find( "Pool" ) != std::string::npos; } );
assert( memberIt != structIt->second.members.end() );
assert( std::find_if( std::next( memberIt ), structIt->second.members.end(), []( MemberData const & md ) {
return md.name.find( "Pool" ) != std::string::npos;
} ) == structIt->second.members.end() );
return std::make_pair( memberIt->type.type, memberIt->name );
}
bool VulkanHppGenerator::isChainableStructure( std::string const & type ) const
{
if ( beginsWith( type, "Vk" ) )
@ -7212,6 +7476,28 @@ bool VulkanHppGenerator::isParamIndirect( std::string const & name, std::vector<
return false;
}
bool VulkanHppGenerator::isParamIndirect( std::string const & name, ParamData const & param ) const
{
// check if name specifies a member of a struct
std::vector<std::string> nameParts = tokenize( name, "->" );
if ( nameParts.size() == 1 )
{
// older versions of vk.xml used the notation parameter::member
nameParts = tokenize( name, "::" );
}
if ( ( nameParts.size() == 2 ) && ( nameParts[0] == param.name ) )
{
auto structureIt = m_structures.find( param.type.type );
assert( structureIt != m_structures.end() );
assert( std::find_if( structureIt->second.members.begin(),
structureIt->second.members.end(),
[&n = nameParts[1]]( MemberData const & md ) { return md.name == n; } ) !=
structureIt->second.members.end() );
return true;
}
return false;
}
bool VulkanHppGenerator::isTwoStepAlgorithm( std::vector<ParamData> const & params ) const
{
// we generate a two-step algorithm for functions returning a vector of stuff, where the length is specified as a

View File

@ -336,11 +336,16 @@ private:
CommandData const & commandData,
size_t nonConstPointerIndex,
bool definition ) const;
void appendCommandGetVector( std::string & str,
std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
void appendCommandGetVector( std::string & str,
std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
void appendCommandGetVectorOfHandles( std::string & str,
std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
void appendCommandSimple( std::string & str,
std::string const & name,
CommandData const & commandData,
@ -405,7 +410,6 @@ private:
void appendFunctionBodyEnhancedLocalReturnVariableVectorSize( std::string & str,
std::vector<ParamData> const & params,
std::pair<size_t, size_t> const & vectorParamIndex,
size_t returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocator ) const;
void appendFunctionBodyEnhancedMultiVectorSizeCheck( std::string & str,
@ -582,18 +586,31 @@ private:
CommandData const & commandData,
size_t nonConstPointerIndex,
bool definition ) const;
std::string constructCommandGetVector( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandGetVectorDeprecated( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandGetVectorSingular( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandGetVector( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandGetVectorDeprecated( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandGetVectorOfHandles( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition, bool withAllocator ) const;
std::string constructCommandGetVectorOfUniqueHandles( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition, bool withAllocator ) const;
std::string
constructCommandGetVectorOfUniqueHandlesWithAllocator( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandGetVectorSingular( std::string const & name,
CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string constructCommandSimple( std::string const & name,
CommandData const & commandData,
bool definition,
@ -680,12 +697,14 @@ private:
std::string const & structName,
std::string const & prefix ) const;
std::set<std::string> getPlatforms( std::set<std::string> const & extensions ) const;
bool isChainableStructure( std::string const & type ) const;
bool isHandleType( std::string const & type ) const;
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;
bool isParamIndirect( std::string const & name, std::vector<ParamData> const & params ) const;
bool isTwoStepAlgorithm( std::vector<ParamData> const & params ) const;
bool needsComplexBody( CommandData const & commandData ) const;
std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const;
bool isChainableStructure( std::string const & type ) const;
bool isHandleType( std::string const & type ) const;
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;
bool isParamIndirect( std::string const & name, std::vector<ParamData> const & params ) const;
bool isParamIndirect( std::string const & name, ParamData const & param ) const;
bool isTwoStepAlgorithm( std::vector<ParamData> const & params ) const;
bool needsComplexBody( CommandData const & commandData ) const;
std::pair<bool, std::map<size_t, std::vector<size_t>>>
needsVectorSizeCheck( std::map<size_t, size_t> const & vectorParamIndices ) const;
void readBaseType( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );

View File

@ -52101,36 +52101,38 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NAMESPACE::CommandBuffer * pCommandBuffers,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator = std::allocator<CommandBuffer>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<std::vector<CommandBuffer, Allocator>>::type
template <typename CommandBufferAllocator = std::allocator<CommandBuffer>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<CommandBuffer, CommandBufferAllocator>>::type
allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Allocator = std::allocator<CommandBuffer>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = Allocator,
template <typename CommandBufferAllocator = std::allocator<CommandBuffer>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = CommandBufferAllocator,
typename std::enable_if<std::is_same<typename B::value_type, CommandBuffer>::value, int>::type = 0>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<std::vector<CommandBuffer, Allocator>>::type
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<CommandBuffer, CommandBufferAllocator>>::type
allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
CommandBufferAllocator & commandBuffersAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
# ifndef VULKAN_HPP_NO_SMART_HANDLE
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename Allocator = std::allocator<UniqueHandle<CommandBuffer, Dispatch>>>
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename CommandBufferAllocator = std::allocator<UniqueHandle<CommandBuffer, Dispatch>>>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, CommandBufferAllocator>>::type
allocateCommandBuffersUnique( const CommandBufferAllocateInfo & allocateInfo,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename Allocator = std::allocator<UniqueHandle<CommandBuffer, Dispatch>>,
typename B = Allocator,
typename CommandBufferAllocator = std::allocator<UniqueHandle<CommandBuffer, Dispatch>>,
typename B = CommandBufferAllocator,
typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<CommandBuffer, Dispatch>>::value,
int>::type = 0>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, CommandBufferAllocator>>::type
allocateCommandBuffersUnique( const CommandBufferAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
CommandBufferAllocator & commandBuffersAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
# endif /*VULKAN_HPP_NO_SMART_HANDLE*/
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -52141,36 +52143,38 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NAMESPACE::DescriptorSet * pDescriptorSets,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator = std::allocator<DescriptorSet>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<std::vector<DescriptorSet, Allocator>>::type
template <typename DescriptorSetAllocator = std::allocator<DescriptorSet>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<DescriptorSet, DescriptorSetAllocator>>::type
allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Allocator = std::allocator<DescriptorSet>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = Allocator,
template <typename DescriptorSetAllocator = std::allocator<DescriptorSet>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = DescriptorSetAllocator,
typename std::enable_if<std::is_same<typename B::value_type, DescriptorSet>::value, int>::type = 0>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<std::vector<DescriptorSet, Allocator>>::type
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<DescriptorSet, DescriptorSetAllocator>>::type
allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
DescriptorSetAllocator & descriptorSetsAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
# ifndef VULKAN_HPP_NO_SMART_HANDLE
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename Allocator = std::allocator<UniqueHandle<DescriptorSet, Dispatch>>>
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename DescriptorSetAllocator = std::allocator<UniqueHandle<DescriptorSet, Dispatch>>>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, DescriptorSetAllocator>>::type
allocateDescriptorSetsUnique( const DescriptorSetAllocateInfo & allocateInfo,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename Allocator = std::allocator<UniqueHandle<DescriptorSet, Dispatch>>,
typename B = Allocator,
typename DescriptorSetAllocator = std::allocator<UniqueHandle<DescriptorSet, Dispatch>>,
typename B = DescriptorSetAllocator,
typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<DescriptorSet, Dispatch>>::value,
int>::type = 0>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, DescriptorSetAllocator>>::type
allocateDescriptorSetsUnique( const DescriptorSetAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
DescriptorSetAllocator & descriptorSetsAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
# endif /*VULKAN_HPP_NO_SMART_HANDLE*/
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -92462,45 +92466,49 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<const VkCommandBufferAllocateInfo *>( pAllocateInfo ),
reinterpret_cast<VkCommandBuffer *>( pCommandBuffers ) ) );
}
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator, typename Dispatch>
template <typename CommandBufferAllocator, typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<CommandBuffer, Allocator>>::type
typename ResultValueType<std::vector<CommandBuffer, CommandBufferAllocator>>::type
Device::allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo, Dispatch const & d ) const
{
std::vector<CommandBuffer, Allocator> commandBuffers( allocateInfo.commandBufferCount );
Result result = static_cast<Result>(
std::vector<CommandBuffer, CommandBufferAllocator> commandBuffers( allocateInfo.commandBufferCount );
Result result = static_cast<Result>(
d.vkAllocateCommandBuffers( m_device,
reinterpret_cast<const VkCommandBufferAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkCommandBuffer *>( commandBuffers.data() ) ) );
return createResultValue( result, commandBuffers, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffers" );
}
template <typename Allocator,
template <typename CommandBufferAllocator,
typename Dispatch,
typename B,
typename std::enable_if<std::is_same<typename B::value_type, CommandBuffer>::value, int>::type>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<CommandBuffer, Allocator>>::type
typename ResultValueType<std::vector<CommandBuffer, CommandBufferAllocator>>::type
Device::allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
CommandBufferAllocator & commandBuffersAllocator,
Dispatch const & d ) const
{
std::vector<CommandBuffer, Allocator> commandBuffers( allocateInfo.commandBufferCount, vectorAllocator );
Result result = static_cast<Result>(
std::vector<CommandBuffer, CommandBufferAllocator> commandBuffers( allocateInfo.commandBufferCount,
commandBuffersAllocator );
Result result = static_cast<Result>(
d.vkAllocateCommandBuffers( m_device,
reinterpret_cast<const VkCommandBufferAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkCommandBuffer *>( commandBuffers.data() ) ) );
return createResultValue( result, commandBuffers, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffers" );
}
# ifndef VULKAN_HPP_NO_SMART_HANDLE
template <typename Dispatch, typename Allocator>
template <typename Dispatch, typename CommandBufferAllocator>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, CommandBufferAllocator>>::type
Device::allocateCommandBuffersUnique( const CommandBufferAllocateInfo & allocateInfo, Dispatch const & d ) const
{
std::vector<UniqueHandle<CommandBuffer, Dispatch>, Allocator> uniqueCommandBuffers;
std::vector<CommandBuffer> commandBuffers( allocateInfo.commandBufferCount );
Result result = static_cast<Result>(
std::vector<UniqueHandle<CommandBuffer, Dispatch>, CommandBufferAllocator> uniqueCommandBuffers;
std::vector<CommandBuffer> commandBuffers( allocateInfo.commandBufferCount );
Result result = static_cast<Result>(
d.vkAllocateCommandBuffers( m_device,
reinterpret_cast<const VkCommandBufferAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkCommandBuffer *>( commandBuffers.data() ) ) );
@ -92513,24 +92521,25 @@ namespace VULKAN_HPP_NAMESPACE
uniqueCommandBuffers.push_back( UniqueHandle<CommandBuffer, Dispatch>( commandBuffers[i], deleter ) );
}
}
return createResultValue(
result, std::move( uniqueCommandBuffers ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffersUnique" );
}
template <typename Dispatch,
typename Allocator,
typename CommandBufferAllocator,
typename B,
typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<CommandBuffer, Dispatch>>::value,
int>::type>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<CommandBuffer, Dispatch>, CommandBufferAllocator>>::type
Device::allocateCommandBuffersUnique( const CommandBufferAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
CommandBufferAllocator & commandBuffersAllocator,
Dispatch const & d ) const
{
std::vector<UniqueHandle<CommandBuffer, Dispatch>, Allocator> uniqueCommandBuffers( vectorAllocator );
std::vector<CommandBuffer> commandBuffers( allocateInfo.commandBufferCount );
Result result = static_cast<Result>(
std::vector<UniqueHandle<CommandBuffer, Dispatch>, CommandBufferAllocator> uniqueCommandBuffers(
commandBuffersAllocator );
std::vector<CommandBuffer> commandBuffers( allocateInfo.commandBufferCount );
Result result = static_cast<Result>(
d.vkAllocateCommandBuffers( m_device,
reinterpret_cast<const VkCommandBufferAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkCommandBuffer *>( commandBuffers.data() ) ) );
@ -92543,7 +92552,6 @@ namespace VULKAN_HPP_NAMESPACE
uniqueCommandBuffers.push_back( UniqueHandle<CommandBuffer, Dispatch>( commandBuffers[i], deleter ) );
}
}
return createResultValue(
result, std::move( uniqueCommandBuffers ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffersUnique" );
}
@ -92561,45 +92569,49 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<const VkDescriptorSetAllocateInfo *>( pAllocateInfo ),
reinterpret_cast<VkDescriptorSet *>( pDescriptorSets ) ) );
}
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator, typename Dispatch>
template <typename DescriptorSetAllocator, typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<DescriptorSet, Allocator>>::type
typename ResultValueType<std::vector<DescriptorSet, DescriptorSetAllocator>>::type
Device::allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo, Dispatch const & d ) const
{
std::vector<DescriptorSet, Allocator> descriptorSets( allocateInfo.descriptorSetCount );
Result result = static_cast<Result>(
std::vector<DescriptorSet, DescriptorSetAllocator> descriptorSets( allocateInfo.descriptorSetCount );
Result result = static_cast<Result>(
d.vkAllocateDescriptorSets( m_device,
reinterpret_cast<const VkDescriptorSetAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkDescriptorSet *>( descriptorSets.data() ) ) );
return createResultValue( result, descriptorSets, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSets" );
}
template <typename Allocator,
template <typename DescriptorSetAllocator,
typename Dispatch,
typename B,
typename std::enable_if<std::is_same<typename B::value_type, DescriptorSet>::value, int>::type>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<DescriptorSet, Allocator>>::type
typename ResultValueType<std::vector<DescriptorSet, DescriptorSetAllocator>>::type
Device::allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
DescriptorSetAllocator & descriptorSetsAllocator,
Dispatch const & d ) const
{
std::vector<DescriptorSet, Allocator> descriptorSets( allocateInfo.descriptorSetCount, vectorAllocator );
Result result = static_cast<Result>(
std::vector<DescriptorSet, DescriptorSetAllocator> descriptorSets( allocateInfo.descriptorSetCount,
descriptorSetsAllocator );
Result result = static_cast<Result>(
d.vkAllocateDescriptorSets( m_device,
reinterpret_cast<const VkDescriptorSetAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkDescriptorSet *>( descriptorSets.data() ) ) );
return createResultValue( result, descriptorSets, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSets" );
}
# ifndef VULKAN_HPP_NO_SMART_HANDLE
template <typename Dispatch, typename Allocator>
template <typename Dispatch, typename DescriptorSetAllocator>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, DescriptorSetAllocator>>::type
Device::allocateDescriptorSetsUnique( const DescriptorSetAllocateInfo & allocateInfo, Dispatch const & d ) const
{
std::vector<UniqueHandle<DescriptorSet, Dispatch>, Allocator> uniqueDescriptorSets;
std::vector<DescriptorSet> descriptorSets( allocateInfo.descriptorSetCount );
Result result = static_cast<Result>(
std::vector<UniqueHandle<DescriptorSet, Dispatch>, DescriptorSetAllocator> uniqueDescriptorSets;
std::vector<DescriptorSet> descriptorSets( allocateInfo.descriptorSetCount );
Result result = static_cast<Result>(
d.vkAllocateDescriptorSets( m_device,
reinterpret_cast<const VkDescriptorSetAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkDescriptorSet *>( descriptorSets.data() ) ) );
@ -92612,24 +92624,25 @@ namespace VULKAN_HPP_NAMESPACE
uniqueDescriptorSets.push_back( UniqueHandle<DescriptorSet, Dispatch>( descriptorSets[i], deleter ) );
}
}
return createResultValue(
result, std::move( uniqueDescriptorSets ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSetsUnique" );
}
template <typename Dispatch,
typename Allocator,
typename DescriptorSetAllocator,
typename B,
typename std::enable_if<std::is_same<typename B::value_type, UniqueHandle<DescriptorSet, Dispatch>>::value,
int>::type>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, Allocator>>::type
typename ResultValueType<std::vector<UniqueHandle<DescriptorSet, Dispatch>, DescriptorSetAllocator>>::type
Device::allocateDescriptorSetsUnique( const DescriptorSetAllocateInfo & allocateInfo,
Allocator const & vectorAllocator,
DescriptorSetAllocator & descriptorSetsAllocator,
Dispatch const & d ) const
{
std::vector<UniqueHandle<DescriptorSet, Dispatch>, Allocator> uniqueDescriptorSets( vectorAllocator );
std::vector<DescriptorSet> descriptorSets( allocateInfo.descriptorSetCount );
Result result = static_cast<Result>(
std::vector<UniqueHandle<DescriptorSet, Dispatch>, DescriptorSetAllocator> uniqueDescriptorSets(
descriptorSetsAllocator );
std::vector<DescriptorSet> descriptorSets( allocateInfo.descriptorSetCount );
Result result = static_cast<Result>(
d.vkAllocateDescriptorSets( m_device,
reinterpret_cast<const VkDescriptorSetAllocateInfo *>( &allocateInfo ),
reinterpret_cast<VkDescriptorSet *>( descriptorSets.data() ) ) );
@ -92642,7 +92655,6 @@ namespace VULKAN_HPP_NAMESPACE
uniqueDescriptorSets.push_back( UniqueHandle<DescriptorSet, Dispatch>( descriptorSets[i], deleter ) );
}
}
return createResultValue(
result, std::move( uniqueDescriptorSets ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSetsUnique" );
}