Add check on structures never listed as required in any feature or extension.

This commit is contained in:
asuessenbach 2021-04-27 09:06:55 +02:00
parent 310561d60b
commit 89df7a1a7b
3 changed files with 191 additions and 204 deletions

View File

@ -71,7 +71,6 @@ std::string stripPostfix( std::string const & value, std::string const & postfix
std::string stripPluralS( std::string const & name ); std::string stripPluralS( std::string const & name );
std::string stripPrefix( std::string const & value, std::string const & prefix ); std::string stripPrefix( std::string const & value, std::string const & prefix );
std::string toCamelCase( std::string const & value ); std::string toCamelCase( std::string const & value );
std::string toString( std::vector<std::string> const & strings );
std::string toUpperCase( std::string const & name ); std::string toUpperCase( std::string const & name );
std::vector<std::string> tokenize( std::string const & tokenString, std::string const & separator ); std::vector<std::string> tokenize( std::string const & tokenString, std::string const & separator );
std::string trim( std::string const & input ); std::string trim( std::string const & input );
@ -253,33 +252,6 @@ std::string constructCArraySizes( std::vector<std::string> const & sizes )
return arraySizes; return arraySizes;
} }
std::string constructFunctionPointerCheck( std::string const & function,
std::set<std::string> const & extensions,
std::string const & feature )
{
std::string functionPointerCheck;
if ( !extensions.empty() )
{
assert( feature.empty() );
std::string message = "Function <" + function + "> needs ";
if ( extensions.size() == 1 )
{
message += "extension <" + *extensions.begin() + "> enabled!";
}
else
{
message += "at least one of the following extensions enabled: ";
for ( auto const & ext : extensions )
{
message += "<" + ext + ">, ";
}
message = stripPostfix( message, ", " );
}
functionPointerCheck = "\n VULKAN_HPP_ASSERT( getDispatcher()->" + function + " && \"" + message + "\" );\n";
}
return functionPointerCheck;
}
std::string constructStandardArray( std::string const & type, std::vector<std::string> const & sizes ) std::string constructStandardArray( std::string const & type, std::vector<std::string> const & sizes )
{ {
std::string arrayString = "std::array<" + type + "," + sizes.back() + ">"; std::string arrayString = "std::array<" + type + "," + sizes.back() + ">";
@ -688,16 +660,19 @@ std::string toCamelCase( std::string const & value )
return result; return result;
} }
std::string toString( std::vector<std::string> const & strings ) template <typename StringContainer>
std::string toString( StringContainer const & strings )
{ {
std::string str; std::string str;
if ( !strings.empty() ) bool encounteredMember = false;
for ( auto s : strings )
{ {
str = strings[0]; if ( encounteredMember )
for ( size_t i = 1; i < strings.size(); i++ )
{ {
str += ", " + strings[i]; str += ", ";
} }
str += s;
encounteredMember = true;
} }
return str; return str;
} }
@ -990,7 +965,7 @@ void VulkanHppGenerator::appendBitmask( std::string & str,
std::string enter, leave; std::string enter, leave;
if ( !value.extension.empty() ) if ( !value.extension.empty() )
{ {
std::tie( enter, leave ) = generateProtection( "", { value.extension } ); std::tie( enter, leave ) = generateProtection( value.extension );
if ( !leave.empty() ) if ( !leave.empty() )
{ {
assert( leave.back() ); assert( leave.back() );
@ -1082,7 +1057,7 @@ void VulkanHppGenerator::appendBitmaskToStringFunction( std::string &
std::string enter, leave; std::string enter, leave;
if ( !evd.extension.empty() ) if ( !evd.extension.empty() )
{ {
std::tie( enter, leave ) = generateProtection( "", { evd.extension } ); std::tie( enter, leave ) = generateProtection( evd.extension );
if ( !leave.empty() ) if ( !leave.empty() )
{ {
leave = "\n" + leave; leave = "\n" + leave;
@ -1171,9 +1146,7 @@ void VulkanHppGenerator::appendCommand( std::string & str,
aliasCommandData.aliasData.clear(); aliasCommandData.aliasData.clear();
for ( auto const & ad : commandData.aliasData ) for ( auto const & ad : commandData.aliasData )
{ {
aliasCommandData.extensions = ad.second.extensions; aliasCommandData.referencedIn = ad.second.referencedIn;
aliasCommandData.feature = ad.second.feature;
aliasCommandData.xmlLine = ad.second.xmlLine;
appendCommand( str, ad.first, aliasCommandData, initialSkipCount, definition ); appendCommand( str, ad.first, aliasCommandData, initialSkipCount, definition );
} }
} }
@ -1202,7 +1175,7 @@ ${commandEnhancedChained}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1466,7 +1439,7 @@ ${commandEnhancedSingular}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1497,7 +1470,7 @@ ${enter}${commandStandard}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1524,7 +1497,7 @@ ${commandEnhanced}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
std::string commandEnhanced; std::string commandEnhanced;
switch ( nonConstPointerParamIndices.size() ) switch ( nonConstPointerParamIndices.size() )
@ -1624,7 +1597,7 @@ ${commandEnhancedWithAllocator}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1662,7 +1635,7 @@ ${leave}
)"; )";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1691,7 +1664,7 @@ ${commandEnhancedUnique}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1763,7 +1736,7 @@ void VulkanHppGenerator::appendCommandVector( std::string &
assert( ( commandData.returnType == "VkResult" ) || ( commandData.returnType == "void" ) ); assert( ( commandData.returnType == "VkResult" ) || ( commandData.returnType == "void" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
const std::string functionTemplate = R"( const std::string functionTemplate = R"(
${enter}${commandStandard}${newlineOnDefinition} ${enter}${commandStandard}${newlineOnDefinition}
@ -1815,7 +1788,7 @@ ${commandEnhancedChainedWithAllocator}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1887,7 +1860,7 @@ void VulkanHppGenerator::appendCommandVectorDeprecated( std::string &
assert( vectorParamIndices.size() == 2 ); assert( vectorParamIndices.size() == 2 );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
assert( enter.empty() ); assert( enter.empty() );
const std::string functionTemplate = R"( const std::string functionTemplate = R"(
@ -1939,7 +1912,7 @@ ${commandEnhancedSingular}${newlineOnDefinition}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -1984,7 +1957,7 @@ ${commandEnhancedUniqueSingular}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -2036,7 +2009,7 @@ ${commandEnhancedUniqueWithAllocators}
${leave})"; ${leave})";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
str += replaceWithMap( str += replaceWithMap(
functionTemplate, functionTemplate,
@ -2294,7 +2267,7 @@ void VulkanHppGenerator::appendDispatchLoaderStatic( std::string & str )
str += "\n"; str += "\n";
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( command.second.feature, command.second.extensions ); std::tie( enter, leave ) = generateProtection( command.second.referencedIn );
str += enter + " " + command.second.returnType + " vk" + commandName + "( " + parameterList + str += enter + " " + command.second.returnType + " vk" + commandName + "( " + parameterList +
" ) const VULKAN_HPP_NOEXCEPT\n" " ) const VULKAN_HPP_NOEXCEPT\n"
" {\n" " {\n"
@ -2308,7 +2281,7 @@ void VulkanHppGenerator::appendDispatchLoaderStatic( std::string & str )
{ {
commandName = stripPrefix( aliasData.first, "vk" ); commandName = stripPrefix( aliasData.first, "vk" );
str += "\n"; str += "\n";
std::tie( enter, leave ) = generateProtection( aliasData.second.feature, aliasData.second.extensions ); std::tie( enter, leave ) = generateProtection( aliasData.second.referencedIn );
str += enter + " " + command.second.returnType + " vk" + commandName + "( " + parameterList + str += enter + " " + command.second.returnType + " vk" + commandName + "( " + parameterList +
" ) const VULKAN_HPP_NOEXCEPT\n" " ) const VULKAN_HPP_NOEXCEPT\n"
" {\n" " {\n"
@ -2543,8 +2516,7 @@ void VulkanHppGenerator::appendDispatchLoaderDynamicCommand( std::string &
aliasCommandData.aliasData.clear(); aliasCommandData.aliasData.clear();
for ( auto const & aliasData : commandData.aliasData ) for ( auto const & aliasData : commandData.aliasData )
{ {
aliasCommandData.extensions = aliasData.second.extensions; aliasCommandData.referencedIn = aliasData.second.referencedIn;
aliasCommandData.feature = aliasData.second.feature;
appendDispatchLoaderDynamicCommand( str, appendDispatchLoaderDynamicCommand( str,
emptyFunctions, emptyFunctions,
deviceFunctions, deviceFunctions,
@ -2556,7 +2528,7 @@ void VulkanHppGenerator::appendDispatchLoaderDynamicCommand( std::string &
} }
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); std::tie( enter, leave ) = generateProtection( commandData.referencedIn );
std::string command = " PFN_" + commandName + " " + commandName + " = 0;\n"; std::string command = " PFN_" + commandName + " " + commandName + " = 0;\n";
if ( !enter.empty() ) if ( !enter.empty() )
{ {
@ -2598,7 +2570,7 @@ void VulkanHppGenerator::appendDispatchLoaderDynamicCommand( std::string &
[]( std::pair<std::string, CommandAliasData> const & ad ) { return endsWith( ad.first, "KHR" ); } ); []( std::pair<std::string, CommandAliasData> const & ad ) { return endsWith( ad.first, "KHR" ); } );
if ( aliasKHRIt != commandData.aliasData.end() ) if ( aliasKHRIt != commandData.aliasData.end() )
{ {
assert( generateProtection( aliasKHRIt->second.feature, aliasKHRIt->second.extensions ).first.empty() ); assert( generateProtection( aliasKHRIt->second.referencedIn ).first.empty() );
if ( isDeviceFunction ) if ( isDeviceFunction )
{ {
checkedAssignment( deviceFunctions, leave, commandName, aliasKHRIt->first ); checkedAssignment( deviceFunctions, leave, commandName, aliasKHRIt->first );
@ -2614,7 +2586,7 @@ void VulkanHppGenerator::appendDispatchLoaderDynamicCommand( std::string &
// then all the others, with no specific order // then all the others, with no specific order
if ( aliasIt != aliasKHRIt ) if ( aliasIt != aliasKHRIt )
{ {
assert( generateProtection( aliasIt->second.feature, aliasIt->second.extensions ).first.empty() ); assert( generateProtection( aliasIt->second.referencedIn ).first.empty() );
if ( isDeviceFunction ) if ( isDeviceFunction )
{ {
checkedAssignment( deviceFunctions, leave, commandName, aliasIt->first ); checkedAssignment( deviceFunctions, leave, commandName, aliasIt->first );
@ -2649,7 +2621,7 @@ void VulkanHppGenerator::appendEnum( std::string & str, std::pair<std::string, E
std::string enter, leave; std::string enter, leave;
if ( !value.extension.empty() ) if ( !value.extension.empty() )
{ {
std::tie( enter, leave ) = generateProtection( "", { value.extension } ); std::tie( enter, leave ) = generateProtection( value.extension );
} }
if ( !leave.empty() ) if ( !leave.empty() )
{ {
@ -2690,7 +2662,7 @@ void VulkanHppGenerator::appendEnum( std::string & str, std::pair<std::string, E
[&aliasIt]( EnumValueData const & evd ) { return aliasIt->second.first == evd.vulkanValue; } ); [&aliasIt]( EnumValueData const & evd ) { return aliasIt->second.first == evd.vulkanValue; } );
} }
assert( enumIt != enumData.second.values.end() ); assert( enumIt != enumData.second.values.end() );
assert( enumIt->extension.empty() || generateProtection( "", { enumIt->extension } ).first.empty() ); assert( enumIt->extension.empty() || generateProtection( enumIt->extension ).first.empty() );
#endif #endif
enumList += "\n , " + alias.second.second + " = " + alias.first; enumList += "\n , " + alias.second.second + " = " + alias.first;
} }
@ -2796,7 +2768,7 @@ void VulkanHppGenerator::appendEnumToString( std::string &
std::string enter, leave; std::string enter, leave;
if ( !value.extension.empty() ) if ( !value.extension.empty() )
{ {
std::tie( enter, leave ) = generateProtection( "", { value.extension } ); std::tie( enter, leave ) = generateProtection( value.extension );
} }
str += ( ( previousEnter != enter ) ? ( previousLeave + enter ) : "" ) + " case " + enumName + str += ( ( previousEnter != enter ) ? ( previousLeave + enter ) : "" ) + " case " + enumName +
"::" + value.vkValue + " : return \"" + value.vkValue.substr( 1 ) + "\";\n"; "::" + value.vkValue + " : return \"" + value.vkValue.substr( 1 ) + "\";\n";
@ -3129,8 +3101,7 @@ void VulkanHppGenerator::appendHandle( std::string & str, std::pair<std::string,
commandData.aliasData.clear(); commandData.aliasData.clear();
if ( needsComplexBody( commandIt->second ) ) if ( needsComplexBody( commandIt->second ) )
{ {
commandData.extensions.clear(); commandData.referencedIn.clear();
commandData.feature.clear();
} }
assert( ( 1 < commandData.params.size() ) && ( commandData.params[0].type.type == handleData.first ) ); assert( ( 1 < commandData.params.size() ) && ( commandData.params[0].type.type == handleData.first ) );
commandData.params[1].optional = commandData.params[1].optional =
@ -3359,8 +3330,7 @@ void VulkanHppGenerator::appendHandlesCommandDefinitions( std::string & str ) co
bool complex = needsComplexBody( commandIt->second ); bool complex = needsComplexBody( commandIt->second );
if ( complex ) if ( complex )
{ {
commandData.extensions.clear(); commandData.referencedIn.clear();
commandData.feature.clear();
} }
assert( ( 1 < commandData.params.size() ) && ( commandData.params[0].type.type == handle.first ) ); assert( ( 1 < commandData.params.size() ) && ( commandData.params[0].type.type == handle.first ) );
commandData.params[1].optional = commandData.params[1].optional =
@ -3404,14 +3374,13 @@ void VulkanHppGenerator::appendHandlesCommandDefinitions( std::string & str ) co
if ( complex ) if ( complex )
{ {
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
assert( commandIt->second.aliasData.size() == 1 ); assert( commandIt->second.aliasData.size() == 1 );
auto aliasDataIt = commandIt->second.aliasData.begin(); auto aliasDataIt = commandIt->second.aliasData.begin();
#if !defined( NDEBUG ) #if !defined( NDEBUG )
std::string aliasEnter, aliasLeave; std::string aliasEnter, aliasLeave;
std::tie( aliasEnter, aliasLeave ) = std::tie( aliasEnter, aliasLeave ) = generateProtection( aliasDataIt->second.referencedIn );
generateProtection( aliasDataIt->second.feature, aliasDataIt->second.extensions );
assert( aliasEnter.empty() ); assert( aliasEnter.empty() );
#endif #endif
@ -3470,7 +3439,7 @@ void VulkanHppGenerator::appendRAIIDispatchers( std::string & str ) const
for ( auto const & command : m_commands ) for ( auto const & command : m_commands )
{ {
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( command.second.feature, command.second.extensions ); std::tie( enter, leave ) = generateProtection( command.second.referencedIn );
if ( command.second.handle.empty() ) if ( command.second.handle.empty() )
{ {
@ -3620,7 +3589,7 @@ ${leave})";
std::string enter, leave; std::string enter, leave;
if ( !value.extension.empty() ) if ( !value.extension.empty() )
{ {
std::tie( enter, leave ) = generateProtection( "", { value.extension } ); std::tie( enter, leave ) = generateProtection( value.extension );
} }
str += replaceWithMap( templateString, str += replaceWithMap( templateString,
{ { "className", stripPrefix( value.vkValue, "eError" ) + "Error" }, { { "className", stripPrefix( value.vkValue, "eError" ) + "Error" },
@ -6782,6 +6751,18 @@ std::string
return str; return str;
} }
std::string VulkanHppGenerator::constructFunctionPointerCheck( std::string const & function,
std::string const & referencedIn ) const
{
std::string functionPointerCheck;
if ( m_extensions.find( referencedIn ) != m_extensions.end() )
{
std::string message = "Function <" + function + "> needs extension <" + referencedIn + "> enabled!";
functionPointerCheck = "\n VULKAN_HPP_ASSERT( getDispatcher()->" + function + " && \"" + message + "\" );\n";
}
return functionPointerCheck;
}
std::string VulkanHppGenerator::constructNoDiscardStandard( CommandData const & commandData ) const std::string VulkanHppGenerator::constructNoDiscardStandard( CommandData const & commandData ) const
{ {
return ( 1 < commandData.successCodes.size() + commandData.errorCodes.size() ) ? "VULKAN_HPP_NODISCARD " : ""; return ( 1 < commandData.successCodes.size() + commandData.errorCodes.size() ) ? "VULKAN_HPP_NODISCARD " : "";
@ -7195,7 +7176,8 @@ std::string VulkanHppGenerator::constructRAIIHandleConstructorResult(
handle.first, constructorIt->second.params, false, handle.first == "VkInstance" ); handle.first, constructorIt->second.params, false, handle.first == "VkInstance" );
if ( ( handle.first == "VkDevice" ) || ( handle.first == "VkInstance" ) ) if ( ( handle.first == "VkDevice" ) || ( handle.first == "VkInstance" ) )
{ {
dispatcherInit = "\n m_dispatcher.init( static_cast<" + handle.first + ">( m_" + startLowerCase( stripPrefix( handle.first, "Vk" ) ) + " ) );"; dispatcherInit = "\n m_dispatcher.init( static_cast<" + handle.first + ">( m_" +
startLowerCase( stripPrefix( handle.first, "Vk" ) ) + " ) );";
} }
std::string initializationList = constructRAIIHandleConstructorInitializationList( std::string initializationList = constructRAIIHandleConstructorInitializationList(
handle.first, constructorIt, handle.second.destructorIt, !handle.second.secondLevelCommands.empty() ); handle.first, constructorIt, handle.second.destructorIt, !handle.second.secondLevelCommands.empty() );
@ -7279,8 +7261,8 @@ std::string VulkanHppGenerator::constructRAIIHandleConstructorTakeOwnership(
std::string dispatcherInit; std::string dispatcherInit;
if ( ( handle.first == "VkDevice" ) || ( handle.first == "VkInstance" ) ) if ( ( handle.first == "VkDevice" ) || ( handle.first == "VkInstance" ) )
{ {
dispatcherInit = dispatcherInit = "\n m_dispatcher.init( static_cast<" + handle.first + ">( m_" +
"\n m_dispatcher.init( static_cast<" + handle.first + ">( m_" + startLowerCase( stripPrefix( handle.first, "Vk" ) ) + " ) );\n "; startLowerCase( stripPrefix( handle.first, "Vk" ) ) + " ) );\n ";
} }
const std::string constructorTemplate = const std::string constructorTemplate =
@ -7311,8 +7293,7 @@ std::pair<std::string, std::string>
// check for additional enter/leave guards for the constructors // check for additional enter/leave guards for the constructors
std::string constructorEnter, constructorLeave; std::string constructorEnter, constructorLeave;
std::tie( constructorEnter, constructorLeave ) = std::tie( constructorEnter, constructorLeave ) = generateProtection( constructorIt->second.referencedIn );
generateProtection( constructorIt->second.feature, constructorIt->second.extensions );
if ( constructorEnter == enter ) if ( constructorEnter == enter )
{ {
constructorEnter.clear(); constructorEnter.clear();
@ -7498,9 +7479,8 @@ std::pair<std::string, std::string>
std::string const & enter ) const std::string const & enter ) const
{ {
std::string destructorEnter, destructorLeave; std::string destructorEnter, destructorLeave;
std::tie( destructorEnter, destructorLeave ) = std::tie( destructorEnter, destructorLeave ) = generateProtection( destructorIt->second.referencedIn );
generateProtection( destructorIt->second.feature, destructorIt->second.extensions ); bool doProtect = !destructorEnter.empty() && ( destructorEnter != enter );
bool doProtect = !destructorEnter.empty() && ( destructorEnter != enter );
if ( !doProtect ) if ( !doProtect )
{ {
destructorEnter.clear(); destructorEnter.clear();
@ -7685,7 +7665,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string counterName = std::string counterName =
startLowerCase( stripPrefix( commandIt->second.params[vectorParamIndices.begin()->second].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[vectorParamIndices.begin()->second].name, "p" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string firstCallArguments = constructCallArgumentsEnhanced( std::string firstCallArguments = constructCallArgumentsEnhanced(
commandIt->second.params, initialSkipCount, true, {}, nonConstPointerParamIndices, true ); commandIt->second.params, initialSkipCount, true, {}, nonConstPointerParamIndices, true );
std::string secondCallArguments = constructCallArgumentsEnhanced( std::string secondCallArguments = constructCallArgumentsEnhanced(
@ -7755,8 +7735,7 @@ ${leave})";
{ "counterType", commandIt->second.params[vectorParamIndices.begin()->second].type.type }, { "counterType", commandIt->second.params[vectorParamIndices.begin()->second].type.type },
{ "enter", enter }, { "enter", enter },
{ "firstCallArguments", firstCallArguments }, { "firstCallArguments", firstCallArguments },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
@ -7785,7 +7764,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string counterName = std::string counterName =
startLowerCase( stripPrefix( stripPluralS( commandIt->second.params[firstVectorParamIt->second].name ), "p" ) ); startLowerCase( stripPrefix( stripPluralS( commandIt->second.params[firstVectorParamIt->second].name ), "p" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string firstCallArguments = constructCallArgumentsEnhanced( std::string firstCallArguments = constructCallArgumentsEnhanced(
commandIt->second.params, initialSkipCount, true, {}, nonConstPointerParamIndices, true ); commandIt->second.params, initialSkipCount, true, {}, nonConstPointerParamIndices, true );
std::string firstType = stripPrefix( commandIt->second.params[firstVectorParamIt->first].type.type, "Vk" ); std::string firstType = stripPrefix( commandIt->second.params[firstVectorParamIt->first].type.type, "Vk" );
@ -7854,8 +7833,7 @@ ${leave})";
{ "firstCallArguments", firstCallArguments }, { "firstCallArguments", firstCallArguments },
{ "firstType", firstType }, { "firstType", firstType },
{ "firstVectorName", firstVectorName }, { "firstVectorName", firstVectorName },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "secondType", secondType }, { "secondType", secondType },
@ -7881,7 +7859,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = determineCommandName( std::string commandName = determineCommandName(
commandIt->first, initialSkipCount ? commandIt->second.params[initialSkipCount - 1].type.type : "", m_tags ); commandIt->first, initialSkipCount ? commandIt->second.params[initialSkipCount - 1].type.type : "", m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string callArguments = constructCallArgumentsEnhanced( std::string callArguments = constructCallArgumentsEnhanced(
commandIt->second.params, initialSkipCount, false, {}, nonConstPointerParamIndices, true ); commandIt->second.params, initialSkipCount, false, {}, nonConstPointerParamIndices, true );
std::string firstReturnName = std::string firstReturnName =
@ -7934,8 +7912,7 @@ ${leave})";
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "firstReturnName", firstReturnName }, { "firstReturnName", firstReturnName },
{ "firstReturnType", firstReturnType }, { "firstReturnType", firstReturnType },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondReturnName", secondReturnName }, { "secondReturnName", secondReturnName },
{ "secondReturnType", secondReturnType }, { "secondReturnType", secondReturnType },
@ -7960,7 +7937,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string vectorSizeCheckString = std::string vectorSizeCheckString =
@ -8001,8 +7978,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString }, { "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
@ -8027,7 +8003,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" ); std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
std::string valueName = std::string valueName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
@ -8068,8 +8044,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "valueName", valueName }, { "valueName", valueName },
{ "returnType", returnType }, { "returnType", returnType },
@ -8097,7 +8072,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string dataName = std::string dataName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string const declarationTemplate = std::string const declarationTemplate =
R"( R"(
@ -8137,8 +8112,7 @@ ${leave})";
{ "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len }, { "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
@ -8167,7 +8141,7 @@ std::pair<std::string, std::string>
std::string dataName = std::string dataName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string const singularDeclarationTemplate = std::string const singularDeclarationTemplate =
R"( R"(
@ -8227,7 +8201,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string vectorSizeCheckString = std::string vectorSizeCheckString =
@ -8262,8 +8236,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString }, { "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
@ -8287,7 +8260,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string vectorSizeCheckString = std::string vectorSizeCheckString =
@ -8327,8 +8300,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString }, { "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
@ -8353,7 +8325,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" ); std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
std::string returnVariable = std::string returnVariable =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
@ -8419,7 +8391,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string vectorElementType = commandIt->second.params[returnParamIndex].type.type; std::string vectorElementType = commandIt->second.params[returnParamIndex].type.type;
std::string vectorName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndex].name, "p" ) ); std::string vectorName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndex].name, "p" ) );
std::string vectorSize = std::string vectorSize =
@ -8461,8 +8433,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
{ "vectorName", vectorName }, { "vectorName", vectorName },
@ -8489,7 +8460,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string valueName = std::string valueName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[1]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[1]].name, "p" ) );
std::string valueType = commandIt->second.params[nonConstPointerParamIndices[1]].type.type; std::string valueType = commandIt->second.params[nonConstPointerParamIndices[1]].type.type;
@ -8538,8 +8509,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "valueName", valueName }, { "valueName", valueName },
{ "valueType", valueType }, { "valueType", valueType },
@ -8571,7 +8541,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string dataName = std::string dataName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string const declarationTemplate = std::string const declarationTemplate =
R"( R"(
@ -8611,8 +8581,7 @@ ${leave})";
{ "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len }, { "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
@ -8642,7 +8611,7 @@ std::pair<std::string, std::string>
std::string dataName = std::string dataName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string const singularDeclarationTemplate = std::string const singularDeclarationTemplate =
R"( R"(
@ -8704,7 +8673,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = stripPluralS( std::string commandName = stripPluralS(
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ) ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ) );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string vectorElementName = std::string vectorElementName =
stripPluralS( startLowerCase( stripPrefix( commandIt->second.params[returnParamIndex].name, "p" ) ) ); stripPluralS( startLowerCase( stripPrefix( commandIt->second.params[returnParamIndex].name, "p" ) ) );
std::string vectorElementType = commandIt->second.params[returnParamIndex].type.type; std::string vectorElementType = commandIt->second.params[returnParamIndex].type.type;
@ -8745,8 +8714,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vectorElementName", vectorElementName }, { "vectorElementName", vectorElementName },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
@ -8771,7 +8739,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string vectorSizeCheckString = std::string vectorSizeCheckString =
@ -8806,8 +8774,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString }, { "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
@ -8834,7 +8801,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = determineCommandName( std::string commandName = determineCommandName(
commandIt->first, initialSkipCount ? commandIt->second.params[initialSkipCount - 1].type.type : "", m_tags ); commandIt->first, initialSkipCount ? commandIt->second.params[initialSkipCount - 1].type.type : "", m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" ); std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
std::string valueName = std::string valueName =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
@ -8876,8 +8843,7 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "valueName", valueName }, { "valueName", valueName },
{ "returnType", returnType }, { "returnType", returnType },
@ -8942,7 +8908,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" ); std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT"; std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT";
@ -8982,8 +8948,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "noexcept", noexceptString }, { "noexcept", noexceptString },
{ "vectorSizeCheck", { "vectorSizeCheck",
@ -9332,7 +9297,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = namespacedType( commandIt->second.returnType ); std::string returnType = namespacedType( commandIt->second.returnType );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string vectorSizeCheckString = std::string vectorSizeCheckString =
@ -9370,8 +9335,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "returnType", returnType }, { "returnType", returnType },
{ "vectorSizeCheck", vectorSizeCheckString }, { "vectorSizeCheck", vectorSizeCheckString },
@ -9396,7 +9360,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = namespacedType( commandIt->second.returnType ); std::string returnType = namespacedType( commandIt->second.returnType );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
@ -9435,8 +9399,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "returnType", returnType }, { "returnType", returnType },
{ "vectorSizeCheck", vectorSizeCheckString }, { "vectorSizeCheck", vectorSizeCheckString },
@ -9535,7 +9498,7 @@ std::tuple<bool, std::string, std::string> VulkanHppGenerator::constructRAIIHand
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT"; std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT";
std::string vectorSizeCheckString = std::string vectorSizeCheckString =
@ -9577,8 +9540,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "noexcept", noexceptString }, { "noexcept", noexceptString },
{ "template", templateString }, { "template", templateString },
@ -9704,7 +9666,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string vectorElementType = std::string vectorElementType =
stripPostfix( commandIt->second.params[vectorParamIndices.begin()->first].type.compose(), "*" ); stripPostfix( commandIt->second.params[vectorParamIndices.begin()->first].type.compose(), "*" );
std::string counterName = std::string counterName =
@ -9750,8 +9712,7 @@ ${leave})";
{ "counterType", commandIt->second.params[vectorParamIndices.begin()->second].type.type }, { "counterType", commandIt->second.params[vectorParamIndices.begin()->second].type.type },
{ "enter", enter }, { "enter", enter },
{ "firstCallArguments", firstCallArguments }, { "firstCallArguments", firstCallArguments },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
@ -9777,7 +9738,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string firstCallArguments = constructCallArgumentsEnhanced( std::string firstCallArguments = constructCallArgumentsEnhanced(
commandIt->second.params, initialSkipCount, true, {}, nonConstPointerParamIndices, true ); commandIt->second.params, initialSkipCount, true, {}, nonConstPointerParamIndices, true );
std::string secondCallArguments = constructCallArgumentsEnhanced( std::string secondCallArguments = constructCallArgumentsEnhanced(
@ -9831,8 +9792,7 @@ ${leave})";
{ "counterType", commandIt->second.params[vectorParamIndices.begin()->second].type.type }, { "counterType", commandIt->second.params[vectorParamIndices.begin()->second].type.type },
{ "enter", enter }, { "enter", enter },
{ "firstCallArguments", firstCallArguments }, { "firstCallArguments", firstCallArguments },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
@ -9859,7 +9819,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" ); std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
std::string returnVariable = std::string returnVariable =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
@ -9895,8 +9855,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "returnVariable", returnVariable }, { "returnVariable", returnVariable },
{ "returnType", returnType }, { "returnType", returnType },
@ -9922,7 +9881,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::constructRAIIHandleMembe
std::string commandName = std::string commandName =
determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags ); determineCommandName( commandIt->first, commandIt->second.params[initialSkipCount - 1].type.type, m_tags );
std::string enter, leave; std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandIt->second.feature, commandIt->second.extensions ); std::tie( enter, leave ) = generateProtection( commandIt->second.referencedIn );
std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" ); std::string returnType = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices ); std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT"; std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT";
@ -9961,8 +9920,7 @@ ${leave})";
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "functionPointerCheck", { "functionPointerCheck", constructFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "noexcept", noexceptString }, { "noexcept", noexceptString },
{ "vectorSizeCheck", { "vectorSizeCheck",
@ -10861,7 +10819,7 @@ void VulkanHppGenerator::appendThrowExceptions( std::string & str ) const
std::string enter, leave; std::string enter, leave;
if ( !value.extension.empty() ) if ( !value.extension.empty() )
{ {
std::tie( enter, leave ) = generateProtection( "", { value.extension } ); std::tie( enter, leave ) = generateProtection( value.extension );
} }
str += enter + " case Result::" + value.vkValue + ": throw " + stripPrefix( value.vkValue, "eError" ) + str += enter + " case Result::" + value.vkValue + ": throw " + stripPrefix( value.vkValue, "eError" ) +
@ -11181,6 +11139,9 @@ void VulkanHppGenerator::checkCorrectness()
// command checks // command checks
for ( auto const & command : m_commands ) for ( auto const & command : m_commands )
{ {
check( !command.second.referencedIn.empty(),
command.second.xmlLine,
"command <" + command.first + "> not listed in any feature or extension" );
for ( auto const & ec : command.second.errorCodes ) for ( auto const & ec : command.second.errorCodes )
{ {
check( resultCodes.find( ec ) != resultCodes.end(), check( resultCodes.find( ec ) != resultCodes.end(),
@ -11209,6 +11170,16 @@ void VulkanHppGenerator::checkCorrectness()
"command uses unknown return type <" + command.second.returnType + ">" ); "command uses unknown return type <" + command.second.returnType + ">" );
} }
// enum checks
for ( auto const & e : m_enums )
{
auto typeIt = m_types.find( e.first );
assert( typeIt != m_types.end() );
warn( !typeIt->second.referencedIn.empty(),
e.second.xmlLine,
"enum <" + e.first + "> not listed in any feature or extension" );
}
// extension checks // extension checks
for ( auto const & extension : m_extensions ) for ( auto const & extension : m_extensions )
{ {
@ -11291,6 +11262,12 @@ void VulkanHppGenerator::checkCorrectness()
std::set<std::string> sTypeValues; std::set<std::string> sTypeValues;
for ( auto const & structure : m_structures ) for ( auto const & structure : m_structures )
{ {
auto typeIt = m_types.find( structure.first );
assert( typeIt != m_types.end() );
check( !typeIt->second.referencedIn.empty(),
structure.second.xmlLine,
"structure <" + structure.first + "> not listed in any feature or extension" );
for ( auto const & extend : structure.second.structExtends ) for ( auto const & extend : structure.second.structExtends )
{ {
check( check(
@ -11896,16 +11873,15 @@ std::string VulkanHppGenerator::generateLenInitializer(
return initializer; return initializer;
} }
std::pair<std::string, std::string> std::pair<std::string, std::string> VulkanHppGenerator::generateProtection( std::string const & referencedIn ) const
VulkanHppGenerator::generateProtection( std::string const & feature, std::set<std::string> const & extensions ) const
{ {
if ( feature.empty() && !extensions.empty() ) if ( !referencedIn.empty() && m_features.find( referencedIn ) == m_features.end() )
{ {
assert( getPlatforms( extensions ).size() == 1 ); auto extensionIt = m_extensions.find( referencedIn );
std::string platform = *getPlatforms( extensions ).begin(); assert( extensionIt != m_extensions.end() );
if ( !platform.empty() ) if ( !extensionIt->second.platform.empty() )
{ {
auto platformIt = m_platforms.find( platform ); auto platformIt = m_platforms.find( extensionIt->second.platform );
assert( platformIt != m_platforms.end() ); assert( platformIt != m_platforms.end() );
std::string const & protect = platformIt->second.protect; std::string const & protect = platformIt->second.protect;
if ( !protect.empty() ) if ( !protect.empty() )
@ -11928,7 +11904,7 @@ std::pair<std::string, std::string> VulkanHppGenerator::generateProtection( std:
{ {
auto typeIt = m_types.find( type ); auto typeIt = m_types.find( type );
assert( typeIt != m_types.end() ); assert( typeIt != m_types.end() );
return generateProtection( typeIt->second.feature, typeIt->second.extensions ); return generateProtection( typeIt->second.referencedIn );
} }
} }
@ -12027,16 +12003,11 @@ std::string VulkanHppGenerator::getEnumPrefix( int line, std::string const & nam
return prefix; return prefix;
} }
std::set<std::string> VulkanHppGenerator::getPlatforms( std::set<std::string> const & extensions ) const std::string VulkanHppGenerator::getPlatform( std::string const & extension ) const
{ {
std::set<std::string> platforms; auto extensionIt = m_extensions.find( extension );
for ( auto const & e : extensions ) assert( extensionIt != m_extensions.end() );
{ return extensionIt->second.platform;
auto extensionIt = m_extensions.find( e );
assert( extensionIt != m_extensions.end() );
platforms.insert( extensionIt->second.platform );
}
return platforms;
} }
std::pair<std::string, std::string> VulkanHppGenerator::getPoolTypeAndName( std::string const & type ) const std::pair<std::string, std::string> VulkanHppGenerator::getPoolTypeAndName( std::string const & type ) const
@ -12220,8 +12191,7 @@ bool VulkanHppGenerator::isStructureChainAnchor( std::string const & type ) cons
bool VulkanHppGenerator::needsComplexBody( CommandData const & commandData ) const bool VulkanHppGenerator::needsComplexBody( CommandData const & commandData ) const
{ {
return !commandData.aliasData.empty() && return !commandData.aliasData.empty() && !generateProtection( commandData.referencedIn ).first.empty();
!generateProtection( commandData.feature, commandData.extensions ).first.empty();
} }
std::pair<bool, std::map<size_t, std::vector<size_t>>> std::pair<bool, std::map<size_t, std::vector<size_t>>>
@ -13151,15 +13121,24 @@ void VulkanHppGenerator::readExtensionRequireCommand( tinyxml2::XMLElement const
auto aliasDataIt = commandIt->second.aliasData.find( name ); auto aliasDataIt = commandIt->second.aliasData.find( name );
if ( aliasDataIt != commandIt->second.aliasData.end() ) if ( aliasDataIt != commandIt->second.aliasData.end() )
{ {
aliasDataIt->second.extensions.insert( extension ); assert( aliasDataIt->second.referencedIn.empty() );
foundAlias = true; aliasDataIt->second.referencedIn = extension;
foundAlias = true;
} }
} }
check( foundAlias, line, "extension <" + extension + "> requires unknown command <" + name + ">" ); check( foundAlias, line, "extension <" + extension + "> requires unknown command <" + name + ">" );
} }
else if ( commandIt->second.referencedIn.empty() )
{
commandIt->second.referencedIn = extension;
}
else else
{ {
commandIt->second.extensions.insert( extension ); check( getPlatform( commandIt->second.referencedIn ) == getPlatform( extension ),
line,
"command <" + name + "> is referenced in extensions <" + commandIt->second.referencedIn + "> and <" +
extension + "> and thus protected by different platforms <" +
getPlatform( commandIt->second.referencedIn ) + "> and <" + getPlatform( extension ) + ">!" );
} }
} }
@ -13182,10 +13161,18 @@ void VulkanHppGenerator::readExtensionRequireType( tinyxml2::XMLElement const *
auto typeIt = m_types.find( name ); auto typeIt = m_types.find( name );
check( typeIt != m_types.end(), line, "failed to find required type <" + name + ">" ); check( typeIt != m_types.end(), line, "failed to find required type <" + name + ">" );
typeIt->second.extensions.insert( extension ); if ( typeIt->second.referencedIn.empty() )
check( getPlatforms( typeIt->second.extensions ).size() == 1, {
line, typeIt->second.referencedIn = extension;
"type <" + name + "> is protected by more than one platform" ); }
else
{
check( getPlatform( typeIt->second.referencedIn ) == getPlatform( extension ),
line,
"type <" + name + "> is referenced in extensions <" + typeIt->second.referencedIn + "> and <" + extension +
"> and thus protected by different platforms <" + getPlatform( typeIt->second.referencedIn ) + "> and <" +
getPlatform( extension ) + ">!" );
}
} }
void VulkanHppGenerator::readExtensions( tinyxml2::XMLElement const * element ) void VulkanHppGenerator::readExtensions( tinyxml2::XMLElement const * element )
@ -13271,10 +13258,10 @@ void VulkanHppGenerator::readFeatureRequireCommand( tinyxml2::XMLElement const *
std::string command = attributes.find( "name" )->second; std::string command = attributes.find( "name" )->second;
auto commandIt = m_commands.find( command ); auto commandIt = m_commands.find( command );
check( commandIt != m_commands.end(), line, "feature requires unknown command <" + command + ">" ); check( commandIt != m_commands.end(), line, "feature requires unknown command <" + command + ">" );
check( commandIt->second.feature.empty(), check( commandIt->second.referencedIn.empty(),
line, line,
"command <" + commandIt->first + "> already listed with feature <" + commandIt->second.feature + ">" ); "command <" + commandIt->first + "> already listed with feature <" + commandIt->second.referencedIn + ">" );
commandIt->second.feature = feature; commandIt->second.referencedIn = feature;
} }
void VulkanHppGenerator::readFeatureRequireType( tinyxml2::XMLElement const * element, std::string const & feature ) void VulkanHppGenerator::readFeatureRequireType( tinyxml2::XMLElement const * element, std::string const & feature )
@ -13290,10 +13277,10 @@ void VulkanHppGenerator::readFeatureRequireType( tinyxml2::XMLElement const * el
{ {
auto typeIt = m_types.find( type ); auto typeIt = m_types.find( type );
check( typeIt != m_types.end(), line, "feature requires unknown type <" + type + ">" ); check( typeIt != m_types.end(), line, "feature requires unknown type <" + type + ">" );
check( typeIt->second.feature.empty() || ( typeIt->second.feature == feature ), check( typeIt->second.referencedIn.empty() || ( typeIt->second.referencedIn == feature ),
line, line,
"type <" + type + "> already listed on feature <" + typeIt->second.feature + ">" ); "type <" + type + "> already listed on feature <" + typeIt->second.referencedIn + ">" );
typeIt->second.feature = feature; typeIt->second.referencedIn = feature;
} }
} }
@ -14426,7 +14413,9 @@ void VulkanHppGenerator::readTypeEnum( tinyxml2::XMLElement const *
if ( alias.empty() ) if ( alias.empty() )
{ {
check( m_enums.insert( std::make_pair( name, EnumData() ) ).second, line, "enum <" + name + "> already specified" ); check( m_enums.insert( std::make_pair( name, EnumData( line ) ) ).second,
line,
"enum <" + name + "> already specified" );
} }
else else
{ {

View File

@ -118,9 +118,8 @@ private:
{ {
CommandAliasData( int line ) : xmlLine( line ) {} CommandAliasData( int line ) : xmlLine( line ) {}
std::set<std::string> extensions; std::string referencedIn;
std::string feature; int xmlLine;
int xmlLine;
}; };
struct CommandData struct CommandData
@ -129,10 +128,9 @@ private:
std::map<std::string, CommandAliasData> aliasData; std::map<std::string, CommandAliasData> aliasData;
std::vector<std::string> errorCodes; std::vector<std::string> errorCodes;
std::set<std::string> extensions;
std::string feature;
std::string handle; std::string handle;
std::vector<ParamData> params; std::vector<ParamData> params;
std::string referencedIn;
std::string returnType; std::string returnType;
std::vector<std::string> successCodes; std::vector<std::string> successCodes;
int xmlLine; int xmlLine;
@ -154,6 +152,7 @@ private:
struct EnumData struct EnumData
{ {
EnumData( int line ) : xmlLine( line ) {}
void addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & vkName ); void addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & vkName );
void addEnumValue( int line, void addEnumValue( int line,
std::string const & valueName, std::string const & valueName,
@ -168,6 +167,7 @@ private:
std::map<std::string, std::pair<std::string, std::string>> aliases; // map from name to alias and vk-name std::map<std::string, std::pair<std::string, std::string>> aliases; // map from name to alias and vk-name
bool isBitmask = false; bool isBitmask = false;
std::vector<EnumValueData> values; std::vector<EnumValueData> values;
int xmlLine;
}; };
struct ExtensionData struct ExtensionData
@ -279,9 +279,8 @@ private:
{ {
TypeData( TypeCategory category_ ) : category( category_ ) {} TypeData( TypeCategory category_ ) : category( category_ ) {}
TypeCategory category; TypeCategory category;
std::set<std::string> extensions; std::string referencedIn;
std::string feature;
}; };
private: private:
@ -788,6 +787,7 @@ private:
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool withDefaults, bool withDefaults,
bool withAllocator ) const; bool withAllocator ) const;
std::string constructFunctionPointerCheck( std::string const & function, std::string const & referencedIn ) const;
std::string constructNoDiscardStandard( CommandData const & commandData ) const; std::string constructNoDiscardStandard( CommandData const & commandData ) const;
std::pair<std::string, std::string> constructRAIIHandleConstructor( std::pair<std::string, std::string> constructRAIIHandleConstructor(
std::pair<std::string, HandleData> const & handle, std::pair<std::string, HandleData> const & handle,
@ -1061,15 +1061,14 @@ private:
std::map<std::vector<MemberData>::const_iterator, std::map<std::vector<MemberData>::const_iterator,
std::vector<std::vector<MemberData>::const_iterator>>::const_iterator litit, std::vector<std::vector<MemberData>::const_iterator>>::const_iterator litit,
bool mutualExclusiveLens ) const; bool mutualExclusiveLens ) const;
std::pair<std::string, std::string> generateProtection( std::string const & feature, std::pair<std::string, std::string> generateProtection( std::string const & referencedIn ) const;
std::set<std::string> const & extension ) const;
std::pair<std::string, std::string> generateProtection( std::string const & type, bool isAliased ) const; std::pair<std::string, std::string> generateProtection( std::string const & type, bool isAliased ) const;
std::string generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts, std::string generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts,
std::string const & structName, std::string const & structName,
std::string const & prefix, std::string const & prefix,
bool mutualExclusiveLens ) const; bool mutualExclusiveLens ) const;
std::string getEnumPrefix( int line, std::string const & name, bool bitmask ) const; std::string getEnumPrefix( int line, std::string const & name, bool bitmask ) const;
std::set<std::string> getPlatforms( std::set<std::string> const & extensions ) const; std::string getPlatform( std::string const & extension ) const;
std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const; std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const;
std::string getVectorSize( std::vector<ParamData> const & params, std::string getVectorSize( std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,

View File

@ -8082,7 +8082,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
VULKAN_HPP_ASSERT( VULKAN_HPP_ASSERT(
getDispatcher()->vkGetPhysicalDevicePresentRectanglesKHR && getDispatcher()->vkGetPhysicalDevicePresentRectanglesKHR &&
"Function <vkGetPhysicalDevicePresentRectanglesKHR> needs at least one of the following extensions enabled: <VK_KHR_device_group>, <VK_KHR_swapchain>" ); "Function <vkGetPhysicalDevicePresentRectanglesKHR> needs extension <VK_KHR_swapchain> enabled!" );
std::vector<VULKAN_HPP_NAMESPACE::Rect2D> rects; std::vector<VULKAN_HPP_NAMESPACE::Rect2D> rects;
uint32_t rectCount; uint32_t rectCount;
@ -8757,9 +8757,8 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, uint32_t> VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, uint32_t>
Device::acquireNextImage2KHR( const AcquireNextImageInfoKHR & acquireInfo ) const Device::acquireNextImage2KHR( const AcquireNextImageInfoKHR & acquireInfo ) const
{ {
VULKAN_HPP_ASSERT( VULKAN_HPP_ASSERT( getDispatcher()->vkAcquireNextImage2KHR &&
getDispatcher()->vkAcquireNextImage2KHR && "Function <vkAcquireNextImage2KHR> needs extension <VK_KHR_swapchain> enabled!" );
"Function <vkAcquireNextImage2KHR> needs at least one of the following extensions enabled: <VK_KHR_device_group>, <VK_KHR_swapchain>" );
uint32_t imageIndex; uint32_t imageIndex;
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>(
@ -9241,7 +9240,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
VULKAN_HPP_ASSERT( VULKAN_HPP_ASSERT(
getDispatcher()->vkGetDeviceGroupPresentCapabilitiesKHR && getDispatcher()->vkGetDeviceGroupPresentCapabilitiesKHR &&
"Function <vkGetDeviceGroupPresentCapabilitiesKHR> needs at least one of the following extensions enabled: <VK_KHR_device_group>, <VK_KHR_swapchain>" ); "Function <vkGetDeviceGroupPresentCapabilitiesKHR> needs extension <VK_KHR_swapchain> enabled!" );
VULKAN_HPP_NAMESPACE::DeviceGroupPresentCapabilitiesKHR deviceGroupPresentCapabilities; VULKAN_HPP_NAMESPACE::DeviceGroupPresentCapabilitiesKHR deviceGroupPresentCapabilities;
VULKAN_HPP_NAMESPACE::Result result = VULKAN_HPP_NAMESPACE::Result result =
@ -9282,7 +9281,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
VULKAN_HPP_ASSERT( VULKAN_HPP_ASSERT(
getDispatcher()->vkGetDeviceGroupSurfacePresentModesKHR && getDispatcher()->vkGetDeviceGroupSurfacePresentModesKHR &&
"Function <vkGetDeviceGroupSurfacePresentModesKHR> needs at least one of the following extensions enabled: <VK_KHR_device_group>, <VK_KHR_swapchain>" ); "Function <vkGetDeviceGroupSurfacePresentModesKHR> needs extension <VK_KHR_swapchain> enabled!" );
VULKAN_HPP_NAMESPACE::DeviceGroupPresentModeFlagsKHR modes; VULKAN_HPP_NAMESPACE::DeviceGroupPresentModeFlagsKHR modes;
VULKAN_HPP_NAMESPACE::Result result = VULKAN_HPP_NAMESPACE::Result result =
@ -11313,7 +11312,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
VULKAN_HPP_ASSERT( VULKAN_HPP_ASSERT(
getDispatcher()->vkCmdPushDescriptorSetWithTemplateKHR && getDispatcher()->vkCmdPushDescriptorSetWithTemplateKHR &&
"Function <vkCmdPushDescriptorSetWithTemplateKHR> needs at least one of the following extensions enabled: <VK_KHR_descriptor_update_template>, <VK_KHR_push_descriptor>" ); "Function <vkCmdPushDescriptorSetWithTemplateKHR> needs extension <VK_KHR_push_descriptor> enabled!" );
getDispatcher()->vkCmdPushDescriptorSetWithTemplateKHR( getDispatcher()->vkCmdPushDescriptorSetWithTemplateKHR(
static_cast<VkCommandBuffer>( m_commandBuffer ), static_cast<VkCommandBuffer>( m_commandBuffer ),