mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
commit
82d40057e0
@ -3934,17 +3934,13 @@ std::string VulkanHppGenerator::generateCommandResultGetVectorOfHandlesUnique(
|
|||||||
|
|
||||||
std::set<size_t> skippedParams =
|
std::set<size_t> skippedParams =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, false );
|
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, false );
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, withAllocator, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, withAllocator, false, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
||||||
std::string handleType = stripPrefix( commandData.params[returnParamIndex].type.type, "Vk" );
|
std::string handleType = stripPrefix( commandData.params[returnParamIndex].type.type, "Vk" );
|
||||||
std::string returnType =
|
std::string returnType = generateReturnType(
|
||||||
( commandData.successCodes.size() == 1 )
|
commandData.successCodes, "std::vector<UniqueHandle<" + handleType + ", Dispatch>, " + handleType + "Allocator>" );
|
||||||
? ( "typename ResultValueType<std::vector<UniqueHandle<" + handleType + ", Dispatch>, " + handleType +
|
|
||||||
"Allocator>>::type" )
|
|
||||||
: ( "ResultValue<std::vector<UniqueHandle<" + handleType + ", Dispatch>, " + handleType + "Allocator>>" );
|
|
||||||
|
|
||||||
if ( definition )
|
if ( definition )
|
||||||
{
|
{
|
||||||
@ -3985,7 +3981,6 @@ std::string VulkanHppGenerator::generateCommandResultGetVectorOfHandlesUnique(
|
|||||||
assert( !poolType.empty() );
|
assert( !poolType.empty() );
|
||||||
poolType = stripPrefix( poolType, "Vk" );
|
poolType = stripPrefix( poolType, "Vk" );
|
||||||
poolName = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + poolName;
|
poolName = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + poolName;
|
||||||
|
|
||||||
deleterDefinition =
|
deleterDefinition =
|
||||||
"PoolFree<" + className + ", " + poolType + ", Dispatch> deleter( *this, " + poolName + ", d )";
|
"PoolFree<" + className + ", " + poolType + ", Dispatch> deleter( *this, " + poolName + ", d )";
|
||||||
}
|
}
|
||||||
@ -4055,15 +4050,12 @@ std::string VulkanHppGenerator::generateCommandResultGetVectorOfHandlesUniqueSin
|
|||||||
std::set<size_t> skippedParams =
|
std::set<size_t> skippedParams =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, true );
|
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, true );
|
||||||
std::set<size_t> singularParams = determineSingularParams( returnParamIndex, vectorParamIndices );
|
std::set<size_t> singularParams = determineSingularParams( returnParamIndex, vectorParamIndices );
|
||||||
|
std::string argumentList =
|
||||||
std::string argumentList =
|
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParams, singularParams, definition, false, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParams, singularParams, definition, false, false, true );
|
||||||
std::string commandName = stripPluralS( generateCommandName( name, commandData.params, initialSkipCount, m_tags ) );
|
std::string commandName = stripPluralS( generateCommandName( name, commandData.params, initialSkipCount, m_tags ) );
|
||||||
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
||||||
std::string handleType = stripPrefix( commandData.params[returnParamIndex].type.type, "Vk" );
|
std::string handleType = stripPrefix( commandData.params[returnParamIndex].type.type, "Vk" );
|
||||||
std::string returnType = ( commandData.successCodes.size() == 1 )
|
std::string returnType = generateReturnType( commandData.successCodes, "UniqueHandle<" + handleType + ", Dispatch>" );
|
||||||
? ( "typename ResultValueType<UniqueHandle<" + handleType + ", Dispatch>>::type" )
|
|
||||||
: ( "ResultValue<UniqueHandle<" + handleType + ", Dispatch>>" );
|
|
||||||
|
|
||||||
if ( definition )
|
if ( definition )
|
||||||
{
|
{
|
||||||
@ -4125,8 +4117,7 @@ std::string
|
|||||||
std::set<size_t> skippedParams =
|
std::set<size_t> skippedParams =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, true );
|
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, true );
|
||||||
std::set<size_t> singularParams = determineSingularParams( returnParamIndex, vectorParamIndices );
|
std::set<size_t> singularParams = determineSingularParams( returnParamIndex, vectorParamIndices );
|
||||||
|
std::string argumentList =
|
||||||
std::string argumentList =
|
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, false, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, false, false, true );
|
||||||
std::string commandName = stripPluralS( generateCommandName( name, commandData.params, initialSkipCount, m_tags ) );
|
std::string commandName = stripPluralS( generateCommandName( name, commandData.params, initialSkipCount, m_tags ) );
|
||||||
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
||||||
@ -4565,7 +4556,12 @@ std::string VulkanHppGenerator::generateCommandResultSingleSuccessWithErrors1Ret
|
|||||||
bool definition,
|
bool definition,
|
||||||
size_t returnParamIndex ) const
|
size_t returnParamIndex ) const
|
||||||
{
|
{
|
||||||
if ( isHandleType( commandData.params[returnParamIndex].type.type ) )
|
if ( commandData.params[returnParamIndex].type.type == "void" )
|
||||||
|
{
|
||||||
|
return generateCommandResultSingleSuccessWithErrors1ReturnVoid(
|
||||||
|
name, commandData, initialSkipCount, definition, returnParamIndex );
|
||||||
|
}
|
||||||
|
else if ( isHandleType( commandData.params[returnParamIndex].type.type ) )
|
||||||
{
|
{
|
||||||
return generateCommandResultSingleSuccessWithErrors1ReturnHandle(
|
return generateCommandResultSingleSuccessWithErrors1ReturnHandle(
|
||||||
name, commandData, initialSkipCount, definition, returnParamIndex );
|
name, commandData, initialSkipCount, definition, returnParamIndex );
|
||||||
@ -4575,11 +4571,6 @@ std::string VulkanHppGenerator::generateCommandResultSingleSuccessWithErrors1Ret
|
|||||||
return generateCommandResultSingleSuccessWithErrors1ReturnChain(
|
return generateCommandResultSingleSuccessWithErrors1ReturnChain(
|
||||||
name, commandData, initialSkipCount, definition, returnParamIndex );
|
name, commandData, initialSkipCount, definition, returnParamIndex );
|
||||||
}
|
}
|
||||||
else if ( commandData.params[returnParamIndex].type.type == "void" )
|
|
||||||
{
|
|
||||||
return generateCommandResultSingleSuccessWithErrors1ReturnVoid(
|
|
||||||
name, commandData, initialSkipCount, definition, returnParamIndex );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return generateCommandResultSingleSuccessWithErrors1ReturnValue(
|
return generateCommandResultSingleSuccessWithErrors1ReturnValue(
|
||||||
@ -4617,8 +4608,11 @@ std::string
|
|||||||
switch ( vectorParamIndices.size() )
|
switch ( vectorParamIndices.size() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return generateCommandResultSingleSuccessWithErrors1ReturnHandle0Vector(
|
return generateCommandSetStandardEnhancedUnique(
|
||||||
name, commandData, initialSkipCount, definition, returnParamIndex );
|
definition,
|
||||||
|
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
||||||
|
generateCommandResultGetValue( name, commandData, initialSkipCount, definition, returnParamIndex ),
|
||||||
|
generateCommandResultGetHandleUnique( name, commandData, initialSkipCount, definition, returnParamIndex ) );
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector(
|
return generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector(
|
||||||
@ -4632,20 +4626,6 @@ std::string
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
VulkanHppGenerator::generateCommandResultSingleSuccessWithErrors1ReturnHandle0Vector( std::string const & name,
|
|
||||||
CommandData const & commandData,
|
|
||||||
size_t initialSkipCount,
|
|
||||||
bool definition,
|
|
||||||
size_t returnParamIndex ) const
|
|
||||||
{
|
|
||||||
return generateCommandSetStandardEnhancedUnique(
|
|
||||||
definition,
|
|
||||||
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
|
||||||
generateCommandResultGetValue( name, commandData, initialSkipCount, definition, returnParamIndex ),
|
|
||||||
generateCommandResultGetHandleUnique( name, commandData, initialSkipCount, definition, returnParamIndex ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector(
|
std::string VulkanHppGenerator::generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector(
|
||||||
std::string const & name,
|
std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
@ -5262,8 +5242,7 @@ std::string VulkanHppGenerator::generateCommandType( std::string const & name,
|
|||||||
commandData.successCodes.empty() && commandData.errorCodes.empty() );
|
commandData.successCodes.empty() && commandData.errorCodes.empty() );
|
||||||
|
|
||||||
std::set<size_t> skippedParameters = determineSkippedParams( commandData.params, initialSkipCount, {}, {}, false );
|
std::set<size_t> skippedParameters = determineSkippedParams( commandData.params, initialSkipCount, {}, {}, false );
|
||||||
|
std::string argumentList =
|
||||||
std::string argumentList =
|
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParameters, {}, definition, false, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParameters, {}, definition, false, false, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
||||||
@ -5348,7 +5327,6 @@ std::string VulkanHppGenerator::generateCommandVoid( std::string const &
|
|||||||
|
|
||||||
std::set<size_t> skippedParameters =
|
std::set<size_t> skippedParameters =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, {}, false );
|
determineSkippedParams( commandData.params, initialSkipCount, vectorParamIndices, {}, false );
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParameters, {}, definition, false, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParameters, {}, definition, false, false, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
@ -5627,7 +5605,6 @@ std::string VulkanHppGenerator::generateCommandVoidEnumerate( std::string const
|
|||||||
|
|
||||||
std::set<size_t> skippedParams =
|
std::set<size_t> skippedParams =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParamIndices, false );
|
determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParamIndices, false );
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, withAllocators, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, withAllocators, false, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
@ -5709,13 +5686,11 @@ std::string VulkanHppGenerator::generateCommandVoidEnumerateChained( std::string
|
|||||||
|
|
||||||
std::set<size_t> skippedParams =
|
std::set<size_t> skippedParams =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParamIndices, false );
|
determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParamIndices, false );
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, withAllocators, true, true );
|
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, withAllocators, true, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
assert( beginsWith( commandData.params[vectorParamIndex.first].type.type, "Vk" ) );
|
|
||||||
std::string vectorElementType =
|
std::string vectorElementType =
|
||||||
"VULKAN_HPP_NAMESPACE::" + stripPrefix( commandData.params[vectorParamIndex.first].type.type, "Vk" );
|
stripPostfix( commandData.params[vectorParamIndex.first].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
|
||||||
|
|
||||||
if ( definition )
|
if ( definition )
|
||||||
{
|
{
|
||||||
@ -5786,20 +5761,18 @@ std::string VulkanHppGenerator::generateCommandVoidGetChain( std::string const &
|
|||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
bool definition,
|
bool definition,
|
||||||
size_t nonConstPointerIndex ) const
|
size_t returnParamIndex ) const
|
||||||
{
|
{
|
||||||
assert( ( commandData.returnType == "void" ) && commandData.successCodes.empty() && commandData.errorCodes.empty() );
|
assert( ( commandData.returnType == "void" ) && commandData.successCodes.empty() && commandData.errorCodes.empty() );
|
||||||
|
|
||||||
std::set<size_t> skippedParams =
|
std::set<size_t> skippedParams =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, {}, { nonConstPointerIndex }, false );
|
determineSkippedParams( commandData.params, initialSkipCount, {}, { returnParamIndex }, false );
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, false, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParams, {}, definition, false, false, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
||||||
assert( beginsWith( commandData.params[nonConstPointerIndex].type.type, "Vk" ) );
|
|
||||||
std::string returnType =
|
std::string returnType =
|
||||||
"VULKAN_HPP_NAMESPACE::" + stripPrefix( commandData.params[nonConstPointerIndex].type.type, "Vk" );
|
stripPostfix( commandData.params[returnParamIndex].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
|
||||||
|
|
||||||
if ( definition )
|
if ( definition )
|
||||||
{
|
{
|
||||||
@ -5822,7 +5795,7 @@ std::string VulkanHppGenerator::generateCommandVoidGetChain( std::string const &
|
|||||||
initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "" },
|
initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "" },
|
||||||
{ "classSeparator", commandData.handle.empty() ? "" : "::" },
|
{ "classSeparator", commandData.handle.empty() ? "" : "::" },
|
||||||
{ "commandName", commandName },
|
{ "commandName", commandName },
|
||||||
{ "returnVariable", startLowerCase( stripPrefix( commandData.params[nonConstPointerIndex].name, "p" ) ) },
|
{ "returnVariable", startLowerCase( stripPrefix( commandData.params[returnParamIndex].name, "p" ) ) },
|
||||||
{ "returnType", returnType },
|
{ "returnType", returnType },
|
||||||
{ "vkCommand", name } } );
|
{ "vkCommand", name } } );
|
||||||
}
|
}
|
||||||
@ -5850,14 +5823,12 @@ std::string VulkanHppGenerator::generateCommandVoidGetValue( std::string const &
|
|||||||
|
|
||||||
std::set<size_t> skippedParameters =
|
std::set<size_t> skippedParameters =
|
||||||
determineSkippedParams( commandData.params, initialSkipCount, {}, { returnParamIndex }, false );
|
determineSkippedParams( commandData.params, initialSkipCount, {}, { returnParamIndex }, false );
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandData.params, skippedParameters, {}, definition, false, false, true );
|
generateArgumentListEnhanced( commandData.params, skippedParameters, {}, definition, false, false, true );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
|
||||||
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
std::string nodiscard = generateNoDiscard( 1 < commandData.successCodes.size(), 1 < commandData.errorCodes.size() );
|
||||||
std::string returnType =
|
std::string returnType =
|
||||||
stripPostfix( commandData.params[returnParamIndex].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
|
stripPostfix( commandData.params[returnParamIndex].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
|
||||||
|
|
||||||
bool needsVectorSizeCheck =
|
bool needsVectorSizeCheck =
|
||||||
!vectorParamIndices.empty() && isLenByStructMember( commandData.params[vectorParamIndices.begin()->first].len,
|
!vectorParamIndices.empty() && isLenByStructMember( commandData.params[vectorParamIndices.begin()->first].len,
|
||||||
commandData.params[vectorParamIndices.begin()->second] );
|
commandData.params[vectorParamIndices.begin()->second] );
|
||||||
@ -5882,6 +5853,7 @@ std::string VulkanHppGenerator::generateCommandVoidGetValue( std::string const &
|
|||||||
throw LogicError( VULKAN_HPP_NAMESPACE_STRING "::${className}${classSeparator}${commandName}: ${vectorName}.size() != ${sizeValue}" );
|
throw LogicError( VULKAN_HPP_NAMESPACE_STRING "::${className}${classSeparator}${commandName}: ${vectorName}.size() != ${sizeValue}" );
|
||||||
}
|
}
|
||||||
#endif /*VULKAN_HPP_NO_EXCEPTIONS*/)";
|
#endif /*VULKAN_HPP_NO_EXCEPTIONS*/)";
|
||||||
|
|
||||||
std::vector<std::string> lenParts = tokenize( commandData.params[vectorParamIndices.begin()->first].len, "->" );
|
std::vector<std::string> lenParts = tokenize( commandData.params[vectorParamIndices.begin()->first].len, "->" );
|
||||||
assert( lenParts.size() == 2 );
|
assert( lenParts.size() == 2 );
|
||||||
|
|
||||||
@ -6035,8 +6007,7 @@ std::string VulkanHppGenerator::generateDispatchLoaderStaticCommands( std::vecto
|
|||||||
assert( !commandIt->second.params.empty() );
|
assert( !commandIt->second.params.empty() );
|
||||||
for ( auto param : commandIt->second.params )
|
for ( auto param : commandIt->second.params )
|
||||||
{
|
{
|
||||||
parameterList += param.type.prefix + ( param.type.prefix.empty() ? "" : " " ) + param.type.type +
|
parameterList += param.type.compose( "" ) + " " + param.name + generateCArraySizes( param.arraySizes ) + ", ";
|
||||||
param.type.postfix + " " + param.name + generateCArraySizes( param.arraySizes ) + ", ";
|
|
||||||
parameters += param.name + ", ";
|
parameters += param.name + ", ";
|
||||||
}
|
}
|
||||||
assert( endsWith( parameterList, ", " ) && endsWith( parameters, ", " ) );
|
assert( endsWith( parameterList, ", " ) && endsWith( parameters, ", " ) );
|
||||||
@ -7189,7 +7160,7 @@ std::string VulkanHppGenerator::generateRAIICommandDefinitions( std::vector<Requ
|
|||||||
{
|
{
|
||||||
if ( listedCommands.insert( command ).second )
|
if ( listedCommands.insert( command ).second )
|
||||||
{
|
{
|
||||||
str += generateRAIIHandleCommand( command, determineInitialSkipCount( command ), m_RAIISpecialFunctions, true );
|
str += generateRAIIHandleCommand( command, determineInitialSkipCount( command ), true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7210,16 +7181,13 @@ std::string VulkanHppGenerator::generateRAIIHandle( std::pair<std::string, Handl
|
|||||||
std::string handleName = startLowerCase( handleType );
|
std::string handleName = startLowerCase( handleType );
|
||||||
auto [parentType, parentName] = getParentTypeAndName( handle );
|
auto [parentType, parentName] = getParentTypeAndName( handle );
|
||||||
|
|
||||||
std::string singularConstructors, arrayConstructors;
|
auto [singularConstructors, arrayConstructors] = generateRAIIHandleConstructors( handle );
|
||||||
std::tie( singularConstructors, arrayConstructors ) = generateRAIIHandleConstructors( handle );
|
auto [destructor, destructorCall] =
|
||||||
std::string destructor, destructorCall;
|
|
||||||
std::tie( destructor, destructorCall ) =
|
|
||||||
( handle.second.destructorIt == m_commands.end() )
|
( handle.second.destructorIt == m_commands.end() )
|
||||||
? std::make_pair( "", "" )
|
? std::make_pair( "", "" )
|
||||||
: generateRAIIHandleDestructor( "Vk" + parentType, handle.first, handle.second.destructorIt, enter );
|
: generateRAIIHandleDestructor( "Vk" + parentType, handle.first, handle.second.destructorIt, enter );
|
||||||
|
|
||||||
std::string getConstructorSuccessCode, memberVariables, moveConstructorInitializerList, moveAssignmentInstructions;
|
auto [getConstructorSuccessCode, memberVariables, moveConstructorInitializerList, moveAssignmentInstructions] =
|
||||||
std::tie( getConstructorSuccessCode, memberVariables, moveConstructorInitializerList, moveAssignmentInstructions ) =
|
|
||||||
generateRAIIHandleDetails( handle, destructorCall );
|
generateRAIIHandleDetails( handle, destructorCall );
|
||||||
|
|
||||||
std::string declarations = generateRAIIHandleCommandDeclarations( handle, specialFunctions );
|
std::string declarations = generateRAIIHandleCommandDeclarations( handle, specialFunctions );
|
||||||
@ -7352,13 +7320,12 @@ ${leave}
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateRAIIHandleCommand( std::string const & command,
|
std::string VulkanHppGenerator::generateRAIIHandleCommand( std::string const & command,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::set<std::string> const & specialFunctions,
|
bool definition ) const
|
||||||
bool definition ) const
|
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
if ( specialFunctions.find( command ) == specialFunctions.end() )
|
if ( m_RAIISpecialFunctions.find( command ) == m_RAIISpecialFunctions.end() )
|
||||||
{
|
{
|
||||||
auto commandIt = m_commands.find( command );
|
auto commandIt = m_commands.find( command );
|
||||||
assert( commandIt != m_commands.end() );
|
assert( commandIt != m_commands.end() );
|
||||||
@ -7378,7 +7345,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommand( std::string const &
|
|||||||
|
|
||||||
if ( str.empty() )
|
if ( str.empty() )
|
||||||
{
|
{
|
||||||
throw std::runtime_error( "Never encountered a str like <" + commandIt->first + "> !" );
|
throw std::runtime_error( "Never encountered a command like <" + commandIt->first + "> !" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
@ -7477,10 +7444,10 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
bool definition,
|
bool definition,
|
||||||
size_t returnParamIndex ) const
|
size_t returnParamIndex ) const
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
std::map<size_t, size_t> vectorParamIndices = determineVectorParamIndices( commandIt->second.params );
|
|
||||||
if ( commandIt->second.params[returnParamIndex].type.type == "void" )
|
if ( commandIt->second.params[returnParamIndex].type.type == "void" )
|
||||||
{
|
{
|
||||||
|
std::map<size_t, size_t> vectorParamIndices = determineVectorParamIndices( commandIt->second.params );
|
||||||
if ( vectorParamIndices.size() == 1 )
|
if ( vectorParamIndices.size() == 1 )
|
||||||
{
|
{
|
||||||
if ( returnParamIndex == vectorParamIndices.begin()->first )
|
if ( returnParamIndex == vectorParamIndices.begin()->first )
|
||||||
@ -7497,6 +7464,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
}
|
}
|
||||||
else if ( isHandleType( commandIt->second.params[returnParamIndex].type.type ) )
|
else if ( isHandleType( commandIt->second.params[returnParamIndex].type.type ) )
|
||||||
{
|
{
|
||||||
|
std::map<size_t, size_t> vectorParamIndices = determineVectorParamIndices( commandIt->second.params );
|
||||||
if ( vectorParamIndices.size() == 2 )
|
if ( vectorParamIndices.size() == 2 )
|
||||||
{
|
{
|
||||||
if ( returnParamIndex == std::next( vectorParamIndices.begin() )->first )
|
if ( returnParamIndex == std::next( vectorParamIndices.begin() )->first )
|
||||||
@ -7516,6 +7484,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
}
|
}
|
||||||
else if ( !isStructureChainAnchor( commandIt->second.params[returnParamIndex].type.type ) )
|
else if ( !isStructureChainAnchor( commandIt->second.params[returnParamIndex].type.type ) )
|
||||||
{
|
{
|
||||||
|
std::map<size_t, size_t> vectorParamIndices = determineVectorParamIndices( commandIt->second.params );
|
||||||
if ( vectorParamIndices.empty() )
|
if ( vectorParamIndices.empty() )
|
||||||
{
|
{
|
||||||
str = generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnValue(
|
str = generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnValue(
|
||||||
@ -7529,16 +7498,16 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
std::vector<size_t> const & nonConstPointerParamIndices,
|
std::vector<size_t> const & returnParamIndices,
|
||||||
bool definition ) const
|
bool definition ) const
|
||||||
{
|
{
|
||||||
std::set<size_t> skippedParameters = determineSkippedParams(
|
std::set<size_t> skippedParameters =
|
||||||
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, false );
|
determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParamIndices, returnParamIndices, false );
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
||||||
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
|
||||||
std::string returnType = stripPostfix(
|
std::string returnType =
|
||||||
commandIt->second.params[nonConstPointerParamIndices[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
|
stripPostfix( commandIt->second.params[returnParamIndices[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
|
||||||
|
|
||||||
if ( definition )
|
if ( definition )
|
||||||
{
|
{
|
||||||
@ -7557,8 +7526,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true );
|
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true );
|
||||||
std::string valueName =
|
std::string valueName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndices[0]].name, "p" ) );
|
||||||
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
|
|
||||||
|
|
||||||
return replaceWithMap(
|
return replaceWithMap(
|
||||||
definitionTemplate,
|
definitionTemplate,
|
||||||
@ -7592,13 +7560,13 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
std::vector<size_t> const & nonConstPointerParamIndices,
|
std::vector<size_t> const & returnParamIndices,
|
||||||
bool definition ) const
|
bool definition ) const
|
||||||
{
|
{
|
||||||
assert( nonConstPointerParamIndices.size() == 1 );
|
assert( returnParamIndices.size() == 1 );
|
||||||
std::set<size_t> skippedParameters = determineSkippedParams(
|
std::set<size_t> skippedParameters =
|
||||||
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, true );
|
determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParamIndices, returnParamIndices, true );
|
||||||
std::set<size_t> singularParams = determineSingularParams( nonConstPointerParamIndices[0], vectorParamIndices );
|
std::set<size_t> singularParams = determineSingularParams( returnParamIndices[0], vectorParamIndices );
|
||||||
std::string argumentList = generateArgumentListEnhanced(
|
std::string argumentList = generateArgumentListEnhanced(
|
||||||
commandIt->second.params, skippedParameters, singularParams, definition, false, false, false );
|
commandIt->second.params, skippedParameters, singularParams, definition, false, false, false );
|
||||||
std::string commandName =
|
std::string commandName =
|
||||||
@ -7623,8 +7591,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
|
|
||||||
std::string callArguments =
|
std::string callArguments =
|
||||||
generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, singularParams, true );
|
generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, singularParams, true );
|
||||||
std::string dataName =
|
std::string dataName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndices[0]].name, "p" ) );
|
||||||
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
|
|
||||||
|
|
||||||
return replaceWithMap(
|
return replaceWithMap(
|
||||||
singularDefinitionTemplate,
|
singularDefinitionTemplate,
|
||||||
@ -7656,11 +7623,11 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
std::vector<size_t> const & nonConstPointerParamIndices,
|
std::vector<size_t> const & returnParamIndices,
|
||||||
bool definition ) const
|
bool definition ) const
|
||||||
{
|
{
|
||||||
std::set<size_t> skippedParameters = determineSkippedParams(
|
std::set<size_t> skippedParameters =
|
||||||
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, false );
|
determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParamIndices, returnParamIndices, false );
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
||||||
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
|
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
|
||||||
@ -7684,8 +7651,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true );
|
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true );
|
||||||
std::string dataName =
|
std::string dataName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndices[0]].name, "p" ) );
|
||||||
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
|
|
||||||
|
|
||||||
return replaceWithMap(
|
return replaceWithMap(
|
||||||
definitionTemplate,
|
definitionTemplate,
|
||||||
@ -7694,7 +7660,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
|||||||
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
|
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
|
||||||
{ "commandName", commandName },
|
{ "commandName", commandName },
|
||||||
{ "dataName", dataName },
|
{ "dataName", dataName },
|
||||||
{ "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len },
|
{ "dataSize", commandIt->second.params[returnParamIndices[0]].len },
|
||||||
{ "failureCheck", generateFailureCheck( commandIt->second.successCodes ) },
|
{ "failureCheck", generateFailureCheck( commandIt->second.successCodes ) },
|
||||||
{ "functionPointerCheck", generateFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
|
{ "functionPointerCheck", generateFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
|
||||||
{ "vkCommand", commandIt->first } } );
|
{ "vkCommand", commandIt->first } } );
|
||||||
@ -14996,13 +14962,12 @@ std::string
|
|||||||
functionDeclarations += "\n //=== " + feature.first + " ===\n";
|
functionDeclarations += "\n //=== " + feature.first + " ===\n";
|
||||||
for ( auto const & command : firstLevelCommands )
|
for ( auto const & command : firstLevelCommands )
|
||||||
{
|
{
|
||||||
functionDeclarations +=
|
functionDeclarations += generateRAIIHandleCommand( command, handle.first.empty() ? 0 : 1, false );
|
||||||
generateRAIIHandleCommand( command, handle.first.empty() ? 0 : 1, specialFunctions, false );
|
|
||||||
}
|
}
|
||||||
for ( auto const & command : secondLevelCommands )
|
for ( auto const & command : secondLevelCommands )
|
||||||
{
|
{
|
||||||
assert( !handle.first.empty() );
|
assert( !handle.first.empty() );
|
||||||
functionDeclarations += generateRAIIHandleCommand( command, 2, specialFunctions, false );
|
functionDeclarations += generateRAIIHandleCommand( command, 2, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15040,13 +15005,12 @@ std::string
|
|||||||
functionDeclarations += "\n" + enter + " //=== " + extIt.second->first + " ===\n";
|
functionDeclarations += "\n" + enter + " //=== " + extIt.second->first + " ===\n";
|
||||||
for ( auto const & command : firstLevelCommands )
|
for ( auto const & command : firstLevelCommands )
|
||||||
{
|
{
|
||||||
functionDeclarations +=
|
functionDeclarations += generateRAIIHandleCommand( command, handle.first.empty() ? 0 : 1, false );
|
||||||
generateRAIIHandleCommand( command, handle.first.empty() ? 0 : 1, specialFunctions, false );
|
|
||||||
}
|
}
|
||||||
for ( auto const & command : secondLevelCommands )
|
for ( auto const & command : secondLevelCommands )
|
||||||
{
|
{
|
||||||
assert( !handle.first.empty() );
|
assert( !handle.first.empty() );
|
||||||
functionDeclarations += generateRAIIHandleCommand( command, 2, specialFunctions, false );
|
functionDeclarations += generateRAIIHandleCommand( command, 2, false );
|
||||||
}
|
}
|
||||||
functionDeclarations += leave;
|
functionDeclarations += leave;
|
||||||
}
|
}
|
||||||
|
@ -612,11 +612,6 @@ private:
|
|||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
bool definition,
|
bool definition,
|
||||||
size_t returnParamIndex ) const;
|
size_t returnParamIndex ) const;
|
||||||
std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle0Vector( std::string const & name,
|
|
||||||
CommandData const & commandData,
|
|
||||||
size_t initialSkipCount,
|
|
||||||
bool definition,
|
|
||||||
size_t returnParamIndex ) const;
|
|
||||||
std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector(
|
std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector(
|
||||||
std::string const & name,
|
std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
@ -877,10 +872,7 @@ private:
|
|||||||
std::string generateRAIIHandle( std::pair<std::string, HandleData> const & handle,
|
std::string generateRAIIHandle( std::pair<std::string, HandleData> const & handle,
|
||||||
std::set<std::string> & listedHandles,
|
std::set<std::string> & listedHandles,
|
||||||
std::set<std::string> const & specialFunctions ) const;
|
std::set<std::string> const & specialFunctions ) const;
|
||||||
std::string generateRAIIHandleCommand( std::string const & command,
|
std::string generateRAIIHandleCommand( std::string const & command, size_t initialSkipCount, bool definition ) const;
|
||||||
size_t initialSkipCount,
|
|
||||||
std::set<std::string> const & specialFunctions,
|
|
||||||
bool definition ) const;
|
|
||||||
std::string generateRAIIHandleCommandDeclarations( std::pair<std::string, HandleData> const & handle,
|
std::string generateRAIIHandleCommandDeclarations( std::pair<std::string, HandleData> const & handle,
|
||||||
std::set<std::string> const & specialFunctions ) const;
|
std::set<std::string> const & specialFunctions ) const;
|
||||||
std::string generateRAIIHandleCommandFactory( std::map<std::string, CommandData>::const_iterator commandIt,
|
std::string generateRAIIHandleCommandFactory( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
@ -927,19 +919,19 @@ private:
|
|||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
std::vector<size_t> const & nonConstPointerParamIndices,
|
std::vector<size_t> const & returnParamIndices,
|
||||||
bool definition ) const;
|
bool definition ) const;
|
||||||
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidSingular(
|
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidSingular(
|
||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
std::vector<size_t> const & nonConstPointerParamIndices,
|
std::vector<size_t> const & returnParamIndices,
|
||||||
bool definition ) const;
|
bool definition ) const;
|
||||||
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidVector(
|
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidVector(
|
||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
std::vector<size_t> const & nonConstPointerParamIndices,
|
std::vector<size_t> const & returnParamIndices,
|
||||||
bool definition ) const;
|
bool definition ) const;
|
||||||
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors2Return(
|
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors2Return(
|
||||||
std::map<std::string, CommandData>::const_iterator commandIt,
|
std::map<std::string, CommandData>::const_iterator commandIt,
|
||||||
|
Loading…
Reference in New Issue
Block a user