Add support for a new class of commands. (#1481)

This commit is contained in:
Andreas Süßenbach 2023-01-20 20:41:26 +01:00 committed by GitHub
parent 442c46318e
commit 8179bd05bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 204 additions and 115 deletions

View File

@ -2773,7 +2773,6 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
std::string VulkanHppGenerator::generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const std::string VulkanHppGenerator::generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const
{ {
std::string str;
if ( commandData.returnType == "VkResult" ) if ( commandData.returnType == "VkResult" )
{ {
assert( !commandData.successCodes.empty() ); assert( !commandData.successCodes.empty() );
@ -2781,22 +2780,22 @@ std::string VulkanHppGenerator::generateCommand( std::string const & name, Comma
{ {
if ( commandData.errorCodes.empty() ) if ( commandData.errorCodes.empty() )
{ {
str = generateCommandResultSingleSuccessNoErrors( name, commandData, initialSkipCount, definition ); return generateCommandResultSingleSuccessNoErrors( name, commandData, initialSkipCount, definition );
} }
else else
{ {
str = generateCommandResultSingleSuccessWithErrors( name, commandData, initialSkipCount, definition ); return generateCommandResultSingleSuccessWithErrors( name, commandData, initialSkipCount, definition );
} }
} }
else else
{ {
if ( commandData.errorCodes.empty() ) if ( commandData.errorCodes.empty() )
{ {
str = generateCommandResultMultiSuccessNoErrors( name, commandData, initialSkipCount, definition ); return generateCommandResultMultiSuccessNoErrors( name, commandData, initialSkipCount, definition );
} }
else else
{ {
str = generateCommandResultMultiSuccessWithErrors( name, commandData, initialSkipCount, definition ); return generateCommandResultMultiSuccessWithErrors( name, commandData, initialSkipCount, definition );
} }
} }
} }
@ -2805,21 +2804,17 @@ std::string VulkanHppGenerator::generateCommand( std::string const & name, Comma
std::vector<size_t> returnParams = determineReturnParams( commandData.params ); std::vector<size_t> returnParams = determineReturnParams( commandData.params );
switch ( returnParams.size() ) switch ( returnParams.size() )
{ {
case 0: str = generateCommandVoid0Return( name, commandData, initialSkipCount, definition ); break; case 0: return generateCommandVoid0Return( name, commandData, initialSkipCount, definition );
case 1: str = generateCommandVoid1Return( name, commandData, initialSkipCount, definition, returnParams[0] ); break; case 1: return generateCommandVoid1Return( name, commandData, initialSkipCount, definition, returnParams[0] );
case 2: str = generateCommandVoid2Return( name, commandData, initialSkipCount, definition, returnParams ); break; case 2: return generateCommandVoid2Return( name, commandData, initialSkipCount, definition, returnParams );
} }
} }
else else
{ {
str = generateCommandValue( name, commandData, initialSkipCount, definition ); return generateCommandValue( name, commandData, initialSkipCount, definition );
} }
if ( str.empty() )
{
throw std::runtime_error( "Never encountered a function like <" + name + "> !" ); throw std::runtime_error( "Never encountered a function like <" + name + "> !" );
}
return str;
} }
std::string VulkanHppGenerator::generateCommandDefinitions() const std::string VulkanHppGenerator::generateCommandDefinitions() const
@ -3632,13 +3627,7 @@ std::string VulkanHppGenerator::generateCommandResultSingleSuccessWithErrors1Ret
generateCommandStandard( name, commandData, initialSkipCount, definition ), generateCommandStandard( name, commandData, initialSkipCount, definition ),
{ generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam } ), { generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam } ),
generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam }, CommandFlavourFlagBits::withAllocator ), generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam }, CommandFlavourFlagBits::withAllocator ),
generateCommandEnhanced( name, generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam }, CommandFlavourFlagBits::singular ) } );
commandData,
initialSkipCount,
definition,
vectorParams,
{ returnParam },
CommandFlavourFlagBits::singular | CommandFlavourFlagBits::unique ) } );
} }
} }
} }
@ -6690,7 +6679,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
bool definition, bool definition,
size_t returnParam ) const size_t returnParam ) const
{ {
std::string str;
if ( commandIt->second.params[returnParam].type.type == "void" ) if ( commandIt->second.params[returnParam].type.type == "void" )
{ {
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params ); std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
@ -6700,8 +6688,8 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
{ {
if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "size_t" ) if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "size_t" )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular ); generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
} }
} }
} }
@ -6717,8 +6705,8 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
{ {
if ( isStructureChainAnchor( commandIt->second.params[vectorParams.begin()->first].type.type ) ) if ( isStructureChainAnchor( commandIt->second.params[vectorParams.begin()->first].type.type ) )
{ {
str = generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); return generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
str += generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular ); generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
} }
} }
} }
@ -6729,14 +6717,15 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
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 ); std::string str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
if ( isStructureChainAnchor( commandIt->second.params[returnParam].type.type ) ) if ( isStructureChainAnchor( commandIt->second.params[returnParam].type.type ) )
{ {
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::chained ); str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::chained );
} }
}
}
return str; return str;
}
}
return "";
} }
std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt, std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
@ -6866,54 +6855,49 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
bool definition, bool definition,
size_t returnParam ) const size_t returnParam ) const
{ {
std::string str;
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
if ( commandIt->second.params[returnParam].type.type == "void" ) if ( commandIt->second.params[returnParam].type.type == "void" )
{ {
switch ( vectorParams.size() ) return generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoid( commandIt, initialSkipCount, definition, returnParam );
{
case 0: str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); break;
case 1:
if ( returnParam == vectorParams.begin()->first )
{
if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "size_t" )
{
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
str +=
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
}
}
break;
case 2:
if ( returnParam == std::next( vectorParams.begin() )->first )
{
if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "uint32_t" )
{
if ( isHandleType( commandIt->second.params[vectorParams.begin()->first].type.type ) )
{
if ( commandIt->second.params[std::next( vectorParams.begin() )->second.lenParam].type.type == "size_t" )
{
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
str +=
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
}
}
}
}
break;
}
} }
else if ( isHandleType( commandIt->second.params[returnParam].type.type ) ) else if ( isHandleType( commandIt->second.params[returnParam].type.type ) )
{ {
return generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnHandle( commandIt, initialSkipCount, definition, returnParam );
}
else if ( isStructureChainAnchor( commandIt->second.params[returnParam].type.type ) )
{
return generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( commandIt, initialSkipCount, definition, returnParam );
}
else
{
return generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue( commandIt, initialSkipCount, definition, returnParam );
}
}
std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain(
std::map<std::string, CommandData>::const_iterator commandIt, size_t initialSkipCount, bool definition, size_t returnParam ) const
{
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
if ( vectorParams.empty() )
{
return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::chained );
}
return "";
}
std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnHandle(
std::map<std::string, CommandData>::const_iterator commandIt, size_t initialSkipCount, bool definition, size_t returnParam ) const
{
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
switch ( vectorParams.size() ) switch ( vectorParams.size() )
{ {
case 0: str = generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); break; case 0: return generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
case 1: case 1:
if ( returnParam == vectorParams.begin()->first ) if ( returnParam == vectorParams.begin()->first )
{ {
if ( m_structures.find( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type ) != m_structures.end() ) if ( m_structures.find( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type ) != m_structures.end() )
{ {
str = generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); return generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
} }
} }
break; break;
@ -6927,29 +6911,95 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
if ( ( commandIt->second.params[vectorParams.begin()->first].type.type != "void" ) && if ( ( commandIt->second.params[vectorParams.begin()->first].type.type != "void" ) &&
!isHandleType( commandIt->second.params[vectorParams.begin()->first].type.type ) ) !isHandleType( commandIt->second.params[vectorParams.begin()->first].type.type ) )
{ {
str = generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); return generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
str += generateRAIIHandleCommandFactory(
generateRAIIHandleCommandFactory( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular ); commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
} }
} }
} }
} }
break; break;
} }
} return "";
else if ( isStructureChainAnchor( commandIt->second.params[returnParam].type.type ) ) }
std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue(
std::map<std::string, CommandData>::const_iterator commandIt, size_t initialSkipCount, bool definition, size_t returnParam ) const
{
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
switch ( vectorParams.size() )
{ {
if ( vectorParams.empty() ) case 0: return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
case 2:
return generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue2Vectors( commandIt, initialSkipCount, definition, returnParam, vectorParams );
}
return "";
}
std::string
VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue2Vectors( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam,
std::map<size_t, VectorParamData> const & vectorParams ) const
{
if ( returnParam == std::next( vectorParams.begin() )->first )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); if ( vectorParams.begin()->second.lenParam == std::next( vectorParams.begin() )->second.lenParam )
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::chained );
}
}
else if ( vectorParams.empty() )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ); if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "uint32_t" )
{
if ( ( commandIt->second.params[vectorParams.begin()->first].type.type != "void" ) &&
!isHandleType( commandIt->second.params[vectorParams.begin()->first].type.type ) &&
!isStructureChainAnchor( commandIt->second.params[vectorParams.begin()->first].type.type ) )
{
return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
} }
return str; }
}
}
return "";
}
std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoid( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam ) const
{
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
switch ( vectorParams.size() )
{
case 0: return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition );
case 1:
if ( returnParam == vectorParams.begin()->first )
{
if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "size_t" )
{
return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
}
}
break;
case 2:
if ( returnParam == std::next( vectorParams.begin() )->first )
{
if ( commandIt->second.params[vectorParams.begin()->second.lenParam].type.type == "uint32_t" )
{
if ( isHandleType( commandIt->second.params[vectorParams.begin()->first].type.type ) )
{
if ( commandIt->second.params[std::next( vectorParams.begin() )->second.lenParam].type.type == "size_t" )
{
return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition ) +
generateRAIIHandleCommandEnhanced(
commandIt, initialSkipCount, { returnParam }, vectorParams, definition, CommandFlavourFlagBits::singular );
}
}
}
}
break;
}
return "";
} }
std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt, std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
@ -6957,7 +7007,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
bool definition, bool definition,
std::vector<size_t> const & returnParams ) const std::vector<size_t> const & returnParams ) const
{ {
std::string str;
if ( commandIt->second.params[returnParams[0]].type.type == "uint64_t" ) if ( commandIt->second.params[returnParams[0]].type.type == "uint64_t" )
{ {
if ( commandIt->second.params[returnParams[1]].type.type == "uint64_t" ) if ( commandIt->second.params[returnParams[1]].type.type == "uint64_t" )
@ -6981,9 +7030,9 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
{ {
// two returns and two vectors! But one input vector, one output vector of the same size, // two returns and two vectors! But one input vector, one output vector of the same size,
// and one output value // and one output value
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition ); return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition ) +
str += generateRAIIHandleCommandEnhanced(
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::singular ); commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::singular );
} }
} }
} }
@ -6992,7 +7041,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
} }
} }
} }
return str; return "";
} }
std::string VulkanHppGenerator::generateRAIIHandleCommandValue( std::map<std::string, CommandData>::const_iterator commandIt, std::string VulkanHppGenerator::generateRAIIHandleCommandValue( std::map<std::string, CommandData>::const_iterator commandIt,
@ -7015,12 +7064,11 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid( std::map<std::str
size_t initialSkipCount, size_t initialSkipCount,
bool definition ) const bool definition ) const
{ {
std::string str;
std::vector<size_t> returnParams = determineReturnParams( commandIt->second.params ); std::vector<size_t> returnParams = determineReturnParams( commandIt->second.params );
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params ); std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandIt->second.params );
switch ( returnParams.size() ) switch ( returnParams.size() )
{ {
case 0: str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition ); break; case 0: return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition );
case 1: case 1:
if ( commandIt->second.params[returnParams[0]].type.postfix == "**" ) if ( commandIt->second.params[returnParams[0]].type.postfix == "**" )
{ {
@ -7029,7 +7077,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid( std::map<std::str
{ {
if ( vectorParams.empty() ) if ( vectorParams.empty() )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition ); return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition );
} }
} }
} }
@ -7037,23 +7085,24 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid( std::map<std::str
{ {
if ( vectorParams.empty() ) if ( vectorParams.empty() )
{ {
str = generateRAIIHandleCommandFactory( commandIt, initialSkipCount, returnParams, vectorParams, definition ); return generateRAIIHandleCommandFactory( commandIt, initialSkipCount, returnParams, vectorParams, definition );
} }
} }
else if ( commandIt->second.params[returnParams[0]].type.type == "void" ) else if ( commandIt->second.params[returnParams[0]].type.type == "void" )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::singular ); return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::singular );
} }
else else
{ {
auto returnVectorParamIt = vectorParams.find( returnParams[0] ); auto returnVectorParamIt = vectorParams.find( returnParams[0] );
if ( returnVectorParamIt == vectorParams.end() ) if ( returnVectorParamIt == vectorParams.end() )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition ); std::string str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition );
if ( isStructureChainAnchor( commandIt->second.params[returnParams[0]].type.type ) ) if ( isStructureChainAnchor( commandIt->second.params[returnParams[0]].type.type ) )
{ {
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::chained ); str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::chained );
} }
return str;
} }
} }
break; break;
@ -7066,19 +7115,20 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid( std::map<std::str
{ {
if ( returnParams[1] == vectorParams.begin()->first ) if ( returnParams[1] == vectorParams.begin()->first )
{ {
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition ); std::string str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition );
if ( isStructureChainAnchor( commandIt->second.params[returnParams[1]].type.type ) ) if ( isStructureChainAnchor( commandIt->second.params[returnParams[1]].type.type ) )
{ {
str += str +=
generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::chained ); generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, vectorParams, definition, CommandFlavourFlagBits::chained );
} }
return str;
} }
} }
} }
} }
break; break;
} }
return str; return "";
} }
std::pair<std::string, std::string> std::pair<std::string, std::string>
@ -7213,7 +7263,15 @@ std::string VulkanHppGenerator::generateRAIIHandleConstructorArgument( ParamData
else else
{ {
assert( !param.optional ); assert( !param.optional );
argument = param.type.compose( "VULKAN_HPP_NAMESPACE" ) + " " + param.name; if ( param.arraySizes.empty() )
{
argument = param.type.compose( "VULKAN_HPP_NAMESPACE" ) + " ";
}
else
{
argument = generateStandardArray( param.type.compose( "VULKAN_HPP_NAMESPACE" ), param.arraySizes ) + " const & ";
}
argument += param.name;
} }
return argument; return argument;
} }
@ -11630,7 +11688,7 @@ std::pair<VulkanHppGenerator::NameData, VulkanHppGenerator::TypeInfo> VulkanHppG
{ {
int line = element->GetLineNum(); int line = element->GetLineNum();
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element ); std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkElements( line, children, { { "name", true } }, { { "type" } } ); checkElements( line, children, { { "name", true } }, { { "enum" }, { "type" } } );
NameData nameData; NameData nameData;
TypeInfo typeInfo; TypeInfo typeInfo;
@ -11641,7 +11699,16 @@ std::pair<VulkanHppGenerator::NameData, VulkanHppGenerator::TypeInfo> VulkanHppG
checkElements( line, getChildElements( child ), {} ); checkElements( line, getChildElements( child ), {} );
std::string value = child->Value(); std::string value = child->Value();
if ( value == "name" ) if ( value == "enum" )
{
nameData.arraySizes.push_back( child->GetText() );
checkForError( child->PreviousSibling() && ( strcmp( child->PreviousSibling()->Value(), "[" ) == 0 ) && child->NextSibling() &&
( strcmp( child->NextSibling()->Value(), "]" ) == 0 ),
line,
std::string( "array specifiation is ill-formatted: <" ) + nameData.arraySizes.back() + ">" );
checkForError( m_constants.find( nameData.arraySizes.back() ) != m_constants.end(), line, "using unknown enum value <" + nameData.arraySizes.back() + ">" );
}
else if ( value == "name" )
{ {
nameData.name = child->GetText(); nameData.name = child->GetText();
std::string bitCount; std::string bitCount;

View File

@ -206,6 +206,7 @@ private:
struct EnumData struct EnumData
{ {
EnumData( int line, bool isBitmask_ = false ) : isBitmask( isBitmask_ ), xmlLine( line ) {} EnumData( int line, bool isBitmask_ = false ) : isBitmask( isBitmask_ ), xmlLine( line ) {}
void addEnumAlias( int line, std::string const & name, std::string const & alias ); void addEnumAlias( int line, std::string const & name, std::string const & alias );
void addEnumValue( int line, std::string const & valueName, std::string const & protect, bool bitpos, std::string const & extension ); void addEnumValue( int line, std::string const & valueName, std::string const & protect, bool bitpos, std::string const & extension );
@ -768,6 +769,27 @@ private:
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,
size_t returnParam ) const; size_t returnParam ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnHandle( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue2Vectors( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam,
std::map<size_t, VectorParamData> const & vectorParams ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoid( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
size_t returnParam ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt, std::string generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,