Merge pull request #1432 from asuessenbach/funcs

Add support for functions getting a structure chain and having more than one success codes.
This commit is contained in:
Andreas Süßenbach 2022-10-24 15:03:07 +02:00 committed by GitHub
commit ec9ee4ff04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3245,7 +3245,19 @@ std::string VulkanHppGenerator::generateCommandResultMultiSuccessWithErrors1Retu
} }
} }
} }
else if ( !isStructureChainAnchor( commandData.params[returnParam].type.type ) ) else if ( isStructureChainAnchor( commandData.params[returnParam].type.type ) )
{
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
if ( vectorParams.empty() )
{
return generateCommandSetStandardEnhancedChained(
definition,
generateCommandStandard( name, commandData, initialSkipCount, definition ),
generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam }, false, false, false, false ),
generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam }, false, false, true, false ) );
}
}
else
{ {
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params ); std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
if ( vectorParams.empty() ) if ( vectorParams.empty() )
@ -6817,12 +6829,16 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
} }
} }
} }
else if ( !isStructureChainAnchor( commandIt->second.params[returnParam].type.type ) ) else
{ {
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params ); std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
if ( vectorParams.empty() ) if ( vectorParams.empty() )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, false ); str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, false );
if ( isStructureChainAnchor( commandIt->second.params[returnParam].type.type ) )
{
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, true, false );
}
} }
} }
return str; return str;
@ -8703,8 +8719,7 @@ std::string VulkanHppGenerator::generateReturnType( CommandData const &
} }
} }
else if ( ( commandData.returnType == "void" ) || else if ( ( commandData.returnType == "void" ) ||
( ( commandData.returnType == "VkResult" ) && ( commandData.successCodes.size() == 1 ) && ( commandData.errorCodes.empty() || raii ) ) || ( ( commandData.returnType == "VkResult" ) && ( commandData.successCodes.size() == 1 ) && ( commandData.errorCodes.empty() || raii ) ) )
( chained && raii ) )
{ {
assert( !unique ); assert( !unique );
assert( ( commandData.returnType != "void" ) || ( returnParams.size() <= 2 ) ); assert( ( commandData.returnType != "void" ) || ( returnParams.size() <= 2 ) );
@ -8716,7 +8731,7 @@ std::string VulkanHppGenerator::generateReturnType( CommandData const &
assert( !commandData.successCodes.empty() && ( commandData.successCodes[0] == "VK_SUCCESS" ) ); assert( !commandData.successCodes.empty() && ( commandData.successCodes[0] == "VK_SUCCESS" ) );
if ( ( 1 < commandData.successCodes.size() ) && ( ( returnParams.size() == 1 ) || ( ( returnParams.size() == 2 ) && vectorParams.empty() ) ) ) if ( ( 1 < commandData.successCodes.size() ) && ( ( returnParams.size() == 1 ) || ( ( returnParams.size() == 2 ) && vectorParams.empty() ) ) )
{ {
assert( !commandData.errorCodes.empty() && !chained ); assert( !commandData.errorCodes.empty() );
returnType = ( raii ? "std::pair<VULKAN_HPP_NAMESPACE::Result, " : "ResultValue<" ) + modifiedDataType + ">"; returnType = ( raii ? "std::pair<VULKAN_HPP_NAMESPACE::Result, " : "ResultValue<" ) + modifiedDataType + ">";
} }
else else