Add assertion on valid function pointer for functions depending on extensions.

This commit is contained in:
asuessenbach 2021-03-16 10:09:05 +01:00
parent b074147b7f
commit d973957ab5
2 changed files with 952 additions and 202 deletions

View File

@ -251,6 +251,33 @@ 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() + ">";
@ -7170,7 +7197,7 @@ ${leave})";
const std::string definitionTemplate = const std::string definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}> ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
std::vector<${vectorElementType}> ${vectorName}; std::vector<${vectorElementType}> ${vectorName};
${counterType} ${counterName}; ${counterType} ${counterName};
VULKAN_HPP_NAMESPACE::Result result; VULKAN_HPP_NAMESPACE::Result result;
@ -7206,6 +7233,8 @@ ${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",
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
@ -7262,7 +7291,7 @@ ${leave})";
const std::string definitionTemplate = const std::string definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<std::vector<${firstType}>, std::vector<${secondType}>> ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<std::vector<${firstType}>, std::vector<${secondType}>> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
std::pair<std::vector<${firstType}>, std::vector<${secondType}>> data; std::pair<std::vector<${firstType}>, std::vector<${secondType}>> data;
std::vector<${firstType}> & ${firstVectorName} = data.first; std::vector<${firstType}> & ${firstVectorName} = data.first;
std::vector<${secondType}> & ${secondVectorName} = data.second; std::vector<${secondType}> & ${secondVectorName} = data.second;
@ -7292,22 +7321,24 @@ ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<std::vector<${firstTy
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "counterName", counterName }, { "counterName", counterName },
{ "counterType", commandIt->second.params[firstVectorParamIt->second].type.type }, { "counterType", commandIt->second.params[firstVectorParamIt->second].type.type },
{ "enter", enter }, { "enter", enter },
{ "firstCallArguments", firstCallArguments }, { "firstCallArguments", firstCallArguments },
{ "firstType", firstType }, { "firstType", firstType },
{ "firstVectorName", firstVectorName }, { "firstVectorName", firstVectorName },
{ "leave", leave }, { "functionPointerCheck",
{ "secondCallArguments", secondCallArguments }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "secondType", secondType }, { "leave", leave },
{ "secondVectorName", secondVectorName }, { "secondCallArguments", secondCallArguments },
{ "vkCommand", commandIt->first } } ); { "secondType", secondType },
{ "secondVectorName", secondVectorName },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7356,7 +7387,7 @@ ${leave})";
const std::string definitionTemplate = const std::string definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::tuple<VULKAN_HPP_NAMESPACE::Result,${firstReturnType},${secondReturnType}> ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::tuple<VULKAN_HPP_NAMESPACE::Result,${firstReturnType},${secondReturnType}> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
std::tuple<VULKAN_HPP_NAMESPACE::Result,${firstReturnType},${secondReturnType}> data; std::tuple<VULKAN_HPP_NAMESPACE::Result,${firstReturnType},${secondReturnType}> data;
VULKAN_HPP_NAMESPACE::Result & result = std::get<0>( data ); VULKAN_HPP_NAMESPACE::Result & result = std::get<0>( data );
${firstReturnType} & ${firstReturnName} = std::get<1>( data ); ${firstReturnType} & ${firstReturnName} = std::get<1>( data );
@ -7381,6 +7412,8 @@ ${leave})";
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "firstReturnName", firstReturnName }, { "firstReturnName", firstReturnName },
{ "firstReturnType", firstReturnType }, { "firstReturnType", firstReturnType },
{ "functionPointerCheck",
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "secondReturnName", secondReturnName }, { "secondReturnName", secondReturnName },
{ "secondReturnType", secondReturnType }, { "secondReturnType", secondReturnType },
@ -7428,7 +7461,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result ${className}::${commandName}( ${argumentList} ) const
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
if ( ${failureCheck} ) if ( ${failureCheck} )
{ {
@ -7438,17 +7471,19 @@ ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result ${
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "leave", leave }, { "functionPointerCheck",
{ "vectorSizeCheck", vectorSizeCheckString }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vkCommand", commandIt->first } } ); { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7492,7 +7527,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, ${returnType}> ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, ${returnType}> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
${returnType} ${valueName}; ${returnType} ${valueName};
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
if ( ${failureCheck} ) if ( ${failureCheck} )
@ -7503,18 +7538,20 @@ ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE:
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "leave", leave }, { "functionPointerCheck",
{ "valueName", valueName }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "returnType", returnType }, { "leave", leave },
{ "vkCommand", commandIt->first } } ); { "valueName", valueName },
{ "returnType", returnType },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7556,7 +7593,7 @@ ${leave})";
R"( R"(
${enter} template <typename T> ${enter} template <typename T>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, std::vector<T>> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, std::vector<T>> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
VULKAN_HPP_ASSERT( ${dataSize} % sizeof( T ) == 0 ); VULKAN_HPP_ASSERT( ${dataSize} % sizeof( T ) == 0 );
std::vector<T> ${dataName}( ${dataSize} / sizeof( T ) ); std::vector<T> ${dataName}( ${dataSize} / sizeof( T ) );
Result result = static_cast<Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); Result result = static_cast<Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
@ -7568,18 +7605,20 @@ ${enter} template <typename T>
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "dataName", dataName }, { "dataName", dataName },
{ "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len }, { "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "leave", leave }, { "functionPointerCheck",
{ "vkCommand", commandIt->first } } ); constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7687,21 +7726,23 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
return static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); return static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "vectorSizeCheck", vectorSizeCheckString }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vkCommand", commandIt->first } } ); { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7745,7 +7786,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
if ( ${failureCheck} ) if ( ${failureCheck} )
{ {
@ -7754,17 +7795,19 @@ ${enter} VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} )
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "leave", leave }, { "functionPointerCheck",
{ "vectorSizeCheck", vectorSizeCheckString }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vkCommand", commandIt->first } } ); { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7880,7 +7923,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<std::vector<${vectorElementType}>, ${valueType}> ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<std::vector<${vectorElementType}>, ${valueType}> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
std::pair<std::vector<${vectorElementType}>, ${valueType}> data( std::piecewise_construct, std::forward_as_tuple( ${vectorSize} ), std::forward_as_tuple( 0 ) ); std::pair<std::vector<${vectorElementType}>, ${valueType}> data( std::piecewise_construct, std::forward_as_tuple( ${vectorSize} ), std::forward_as_tuple( 0 ) );
std::vector<${vectorElementType}> & ${vectorName} = data.first; std::vector<${vectorElementType}> & ${vectorName} = data.first;
${valueType} & ${valueName} = data.second; ${valueType} & ${valueName} = data.second;
@ -7893,21 +7936,23 @@ ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<std::vector<${vectorE
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "leave", leave }, { "functionPointerCheck",
{ "valueName", valueName }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "valueType", valueType }, { "leave", leave },
{ "vectorElementType", vectorElementType }, { "valueName", valueName },
{ "vectorName", vectorName }, { "valueType", valueType },
{ "vectorSize", vectorSize }, { "vectorElementType", vectorElementType },
{ "vkCommand", commandIt->first } } ); { "vectorName", vectorName },
{ "vectorSize", vectorSize },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -7949,7 +7994,7 @@ ${leave})";
R"( R"(
${enter} template <typename T> ${enter} template <typename T>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<T> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<T> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
VULKAN_HPP_ASSERT( ${dataSize} % sizeof( T ) == 0 ); VULKAN_HPP_ASSERT( ${dataSize} % sizeof( T ) == 0 );
std::vector<T> ${dataName}( ${dataSize} / sizeof( T ) ); std::vector<T> ${dataName}( ${dataSize} / sizeof( T ) );
Result result = static_cast<Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); Result result = static_cast<Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
@ -7961,18 +8006,20 @@ ${enter} template <typename T>
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "dataName", dataName }, { "dataName", dataName },
{ "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len }, { "dataSize", commandIt->second.params[nonConstPointerParamIndices[0]].len },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "leave", leave }, { "functionPointerCheck",
{ "vkCommand", commandIt->first } } ); constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -8080,21 +8127,23 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT ${enter} VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
getDispatcher()->${vkCommand}( ${callArguments} ); getDispatcher()->${vkCommand}( ${callArguments} );
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "vectorSizeCheck", vectorSizeCheckString }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vkCommand", commandIt->first } } ); { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -8140,7 +8189,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
${returnType} ${valueName}; ${returnType} ${valueName};
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) ); VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
if ( ${failureCheck} ) if ( ${failureCheck} )
@ -8160,6 +8209,8 @@ ${leave})";
{ "commandName", commandName }, { "commandName", commandName },
{ "enter", enter }, { "enter", enter },
{ "failureCheck", constructFailureCheck( commandIt->second.successCodes ) }, { "failureCheck", constructFailureCheck( commandIt->second.successCodes ) },
{ "functionPointerCheck",
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "valueName", valueName }, { "valueName", valueName },
{ "returnType", returnType }, { "returnType", returnType },
@ -8576,7 +8627,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<Bool32,${returnType}> ${className}::${commandName}( ${argumentList} ) const ${noexcept} ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<Bool32,${returnType}> ${className}::${commandName}( ${argumentList} ) const ${noexcept}
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
std::pair<Bool32,${returnType}> result; std::pair<Bool32,${returnType}> result;
${returnType} & ${returnVariable} = result.second; ${returnType} & ${returnVariable} = result.second;
result.first = static_cast<Bool32>( getDispatcher()->${vkCommand}( ${callArguments} ) ); result.first = static_cast<Bool32>( getDispatcher()->${vkCommand}( ${callArguments} ) );
@ -8592,6 +8643,8 @@ ${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",
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "noexcept", noexceptString }, { "noexcept", noexceptString },
{ "vectorSizeCheck", { "vectorSizeCheck",
@ -8667,22 +8720,24 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
return getDispatcher()->${vkCommand}( ${callArguments} ); return getDispatcher()->${vkCommand}( ${callArguments} );
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "returnType", returnType }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vectorSizeCheck", vectorSizeCheckString }, { "leave", leave },
{ "vkCommand", commandIt->first } } ); { "returnType", returnType },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -8730,22 +8785,24 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
return static_cast<${returnType}>( getDispatcher()->${vkCommand}( ${callArguments} ) ); return static_cast<${returnType}>( getDispatcher()->${vkCommand}( ${callArguments} ) );
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "returnType", returnType }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vectorSizeCheck", vectorSizeCheckString }, { "leave", leave },
{ "vkCommand", commandIt->first } } ); { "returnType", returnType },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -8797,23 +8854,25 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} ${template}VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const ${noexcept} ${enter} ${template}VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const ${noexcept}
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
getDispatcher()->${vkCommand}( ${callArguments} ); getDispatcher()->${vkCommand}( ${callArguments} );
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "noexcept", noexceptString }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "template", templateString }, { "leave", leave },
{ "vectorSizeCheck", vectorSizeCheckString }, { "noexcept", noexceptString },
{ "vkCommand", commandIt->first } } ); { "template", templateString },
{ "vectorSizeCheck", vectorSizeCheckString },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -8863,7 +8922,7 @@ ${leave})";
const std::string definitionTemplate = const std::string definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{ {${functionPointerCheck}
${counterType} ${counterName}; ${counterType} ${counterName};
getDispatcher()->${vkCommand}( ${firstCallArguments} ); getDispatcher()->${vkCommand}( ${firstCallArguments} );
std::vector<${vectorElementType}> ${vectorName}( ${counterName} ); std::vector<${vectorElementType}> ${vectorName}( ${counterName} );
@ -8873,20 +8932,22 @@ ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "counterName", counterName }, { "counterName", counterName },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "secondCallArguments", secondCallArguments }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vectorElementType", vectorElementType }, { "leave", leave },
{ "vectorName", vectorName }, { "secondCallArguments", secondCallArguments },
{ "vkCommand", commandIt->first } } ); { "vectorElementType", vectorElementType },
{ "vectorName", vectorName },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -8933,7 +8994,7 @@ ${leave})";
R"( R"(
${enter} template <typename StructureChain> ${enter} template <typename StructureChain>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<StructureChain> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<StructureChain> ${className}::${commandName}( ${argumentList} ) const
{ {${functionPointerCheck}
${counterType} ${counterName}; ${counterType} ${counterName};
getDispatcher()->${vkCommand}( ${firstCallArguments} ); getDispatcher()->${vkCommand}( ${firstCallArguments} );
std::vector<StructureChain> returnVector( ${counterName} ); std::vector<StructureChain> returnVector( ${counterName} );
@ -8952,20 +9013,22 @@ ${enter} template <typename StructureChain>
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "counterName", counterName }, { "counterName", counterName },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "secondCallArguments", secondCallArguments }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "vectorElementType", vectorElementType }, { "leave", leave },
{ "vectorName", vectorName }, { "secondCallArguments", secondCallArguments },
{ "vkCommand", commandIt->first } } ); { "vectorElementType", vectorElementType },
{ "vectorName", vectorName },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -9008,7 +9071,7 @@ ${leave})";
R"( R"(
${enter} template <typename X, typename Y, typename... Z> ${enter} template <typename X, typename Y, typename... Z>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain<X, Y, Z...> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain<X, Y, Z...> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{ {${functionPointerCheck}
StructureChain<X, Y, Z...> structureChain; StructureChain<X, Y, Z...> structureChain;
${returnType} & ${returnVariable} = structureChain.template get<${returnType}>(); ${returnType} & ${returnVariable} = structureChain.template get<${returnType}>();
getDispatcher()->${vkCommand}( ${callArguments} ); getDispatcher()->${vkCommand}( ${callArguments} );
@ -9016,17 +9079,19 @@ ${enter} template <typename X, typename Y, typename... Z>
} }
${leave})"; ${leave})";
std::string definition = std::string definition = replaceWithMap(
replaceWithMap( definitionTemplate, definitionTemplate,
{ { "argumentList", argumentListDefinition }, { { "argumentList", argumentListDefinition },
{ "callArguments", callArguments }, { "callArguments", callArguments },
{ "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 },
{ "leave", leave }, { "functionPointerCheck",
{ "returnVariable", returnVariable }, constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "returnType", returnType }, { "leave", leave },
{ "vkCommand", commandIt->first } } ); { "returnVariable", returnVariable },
{ "returnType", returnType },
{ "vkCommand", commandIt->first } } );
return std::make_pair( declaration, definition ); return std::make_pair( declaration, definition );
} }
@ -9071,7 +9136,7 @@ ${leave})";
std::string const definitionTemplate = std::string const definitionTemplate =
R"( R"(
${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const ${noexcept} ${enter} VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const ${noexcept}
{${vectorSizeCheck} {${functionPointerCheck}${vectorSizeCheck}
${returnType} ${returnVariable}; ${returnType} ${returnVariable};
getDispatcher()->${vkCommand}( ${callArguments} ); getDispatcher()->${vkCommand}( ${callArguments} );
return ${returnVariable}; return ${returnVariable};
@ -9086,6 +9151,8 @@ ${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",
constructFunctionPointerCheck( commandIt->first, commandIt->second.extensions, commandIt->second.feature ) },
{ "leave", leave }, { "leave", leave },
{ "noexcept", noexceptString }, { "noexcept", noexceptString },
{ "vectorSizeCheck", { "vectorSizeCheck",

File diff suppressed because it is too large Load Diff