mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #744 from asuessenbach/refactor
refactor command generation of two-vector getting functions returning…
This commit is contained in:
commit
f7272855c9
@ -1293,18 +1293,28 @@ void VulkanHppGenerator::appendCommand( std::string & str,
|
||||
{
|
||||
// two vector parameters
|
||||
auto firstVectorParam = vectorParamIndices.begin();
|
||||
auto secondVectorParam = firstVectorParam++;
|
||||
auto secondVectorParam = std::next( firstVectorParam );
|
||||
std::vector<ParamData> const & params = commandData.params;
|
||||
if ( ( firstVectorParam->second == secondVectorParam->second ) &&
|
||||
params[firstVectorParam->first].type.isNonConstPointer() &&
|
||||
if ( ( firstVectorParam->second != INVALID_INDEX ) && ( firstVectorParam->second == secondVectorParam->second ) )
|
||||
{
|
||||
// the two vectors use the very same size parameter
|
||||
if ( params[firstVectorParam->first].type.isNonConstPointer() &&
|
||||
params[secondVectorParam->first].type.isNonConstPointer() &&
|
||||
params[firstVectorParam->second].type.isNonConstPointer() )
|
||||
{
|
||||
// both vectors are non-const pointer (that is, return parameters), and share the same size parameter, which in
|
||||
// turn is a non-const pointer
|
||||
// both vectors, as well as the size parameter are non-const pointer that is output parameters
|
||||
appendCommandEnumerateTwoVectors( str, name, commandData, vectorParamIndices, definition );
|
||||
appendedFunction = true;
|
||||
}
|
||||
else if ( params[firstVectorParam->first].type.isConstPointer() &&
|
||||
params[secondVectorParam->first].type.isConstPointer() &&
|
||||
params[firstVectorParam->second].type.isValue() && ( commandData.returnType == "void" ) )
|
||||
{
|
||||
// size is given by value and the vectors are const pointers, that is input parameters; function returns void
|
||||
appendCommandTwoVectorsVoid( str, name, commandData, vectorParamIndices, definition );
|
||||
appendedFunction = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
@ -1628,8 +1638,7 @@ ${enter}${commandStandard}${newlineOnDefinition}
|
||||
${commandEnhanced}${newlineOnDefinition}
|
||||
${commandEnhancedSingular}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
${leave}
|
||||
)";
|
||||
${leave})";
|
||||
|
||||
std::string enter, leave;
|
||||
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions );
|
||||
@ -1658,8 +1667,7 @@ ${enter}${commandStandard}${newlineOnDefinition}
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
${commandEnhanced}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
${leave}
|
||||
)";
|
||||
${leave})";
|
||||
|
||||
std::string enter, leave;
|
||||
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions );
|
||||
@ -1683,8 +1691,7 @@ ${enter}${commandStandard}${newlineOnDefinition}
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
${commandEnhanced}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
${leave}
|
||||
)";
|
||||
${leave})";
|
||||
|
||||
std::string enter, leave;
|
||||
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions );
|
||||
@ -1717,6 +1724,36 @@ ${commandStandard}
|
||||
} ) );
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::appendCommandTwoVectorsVoid( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool definition ) const
|
||||
{
|
||||
assert( commandData.returnType == "void" );
|
||||
assert( vectorParamIndices.size() == 2 );
|
||||
|
||||
std::string enter, leave;
|
||||
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions );
|
||||
|
||||
const std::string functionTemplate = R"(
|
||||
${enter}${commandStandard}${newlineOnDefinition}
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
${commandEnhanced}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
${leave})";
|
||||
|
||||
str +=
|
||||
replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "commandEnhanced",
|
||||
constructCommandTwoVectorsVoid( name, commandData, vectorParamIndices, definition, false ) },
|
||||
{ "commandStandard", constructCommandStandard( name, commandData, definition ) },
|
||||
{ "enter", enter },
|
||||
{ "leave", leave },
|
||||
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
||||
{
|
||||
str += R"(
|
||||
@ -3693,7 +3730,15 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector<Param
|
||||
{
|
||||
if ( params[i].type.isConstPointer() )
|
||||
{
|
||||
if ( params[i].optional )
|
||||
if ( !params[i].len.empty() )
|
||||
{
|
||||
std::string type = params[i].type.compose();
|
||||
assert( endsWith( type, "*" ) );
|
||||
type.pop_back();
|
||||
|
||||
argumentList += "ArrayProxy<" + type + "> const & " + startLowerCase( stripPrefix( params[i].name, "p" ) );
|
||||
}
|
||||
else if ( params[i].optional )
|
||||
{
|
||||
assert( params[i].type.isConstPointer() );
|
||||
argumentList += "Optional<const " + stripPrefix( params[i].type.type, "Vk" ) + "> " +
|
||||
@ -3748,13 +3793,47 @@ std::string VulkanHppGenerator::constructArgumentListStandard( std::vector<Param
|
||||
return argumentList;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::constructCallArguments( std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool vectorAsNullptr,
|
||||
bool enhanced,
|
||||
bool singular ) const
|
||||
std::string VulkanHppGenerator::constructCallArgument( ParamData const & param, bool enhanced ) const
|
||||
{
|
||||
size_t countIndex = vectorParamIndices.empty() ? ~0 : vectorParamIndices.begin()->second;
|
||||
std::string argument = param.name;
|
||||
if ( beginsWith( param.type.type, "Vk" ) )
|
||||
{
|
||||
if ( param.type.isValue() )
|
||||
{
|
||||
argument = "static_cast<" + param.type.type + ">( " + argument + " )";
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( !param.type.postfix.empty() );
|
||||
if ( enhanced )
|
||||
{
|
||||
argument = "&" + startLowerCase( stripPrefix( argument, "p" ) );
|
||||
}
|
||||
argument = "reinterpret_cast<" + ( param.type.prefix.empty() ? "" : param.type.prefix ) + " " + param.type.type +
|
||||
" " + param.type.postfix + ">( " + argument + " )";
|
||||
}
|
||||
}
|
||||
return argument;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::constructCallArguments( std::vector<ParamData> const & params, bool enhanced ) const
|
||||
{
|
||||
std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) );
|
||||
for ( size_t i = 1; i < params.size(); i++ )
|
||||
{
|
||||
arguments += ", " + constructCallArgument( params[i], enhanced );
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
std::string
|
||||
VulkanHppGenerator::constructCallArgumentsEnumerateVectors( std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool vectorAsNullptr ) const
|
||||
{
|
||||
assert( vectorParamIndices.size() == 2 );
|
||||
|
||||
size_t countIndex = vectorParamIndices.begin()->second;
|
||||
assert( ( vectorParamIndices.size() != 2 ) || ( std::next( vectorParamIndices.begin() )->second == countIndex ) );
|
||||
|
||||
std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) );
|
||||
@ -3763,67 +3842,87 @@ std::string VulkanHppGenerator::constructCallArguments( std::vector<ParamData> c
|
||||
arguments += ", ";
|
||||
if ( i == countIndex )
|
||||
{
|
||||
if ( singular )
|
||||
{
|
||||
arguments += "sizeof( T )";
|
||||
assert( !params[i].type.isValue() );
|
||||
arguments += "&" + startLowerCase( stripPrefix( params[i].name, "p" ) );
|
||||
}
|
||||
else if ( params[i].type.isValue() )
|
||||
else if ( vectorParamIndices.find( i ) != vectorParamIndices.end() )
|
||||
{
|
||||
arguments += params[i].name;
|
||||
if ( vectorAsNullptr )
|
||||
{
|
||||
arguments += "nullptr";
|
||||
}
|
||||
else
|
||||
{
|
||||
arguments += "&" + startLowerCase( stripPrefix( params[i].name, "p" ) );
|
||||
arguments += "reinterpret_cast<" + params[i].type.type + " *>( enumeratedData." +
|
||||
( ( vectorParamIndices.find( i ) == vectorParamIndices.begin() ) ? "first" : "second" ) +
|
||||
".data() )";
|
||||
}
|
||||
}
|
||||
else if ( vectorParamIndices.find( i ) != vectorParamIndices.end() )
|
||||
else
|
||||
{
|
||||
arguments += constructCallArgument( params[i], true );
|
||||
}
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::vector<ParamData> const & params,
|
||||
std::pair<size_t, size_t> const & vectorParamIndices,
|
||||
bool singular ) const
|
||||
{
|
||||
std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) );
|
||||
for ( size_t i = 1; i < params.size(); i++ )
|
||||
{
|
||||
arguments += ", ";
|
||||
if ( i == vectorParamIndices.first )
|
||||
{
|
||||
if ( singular )
|
||||
{
|
||||
arguments += "reinterpret_cast<" + params[i].type.type + " *>( &" +
|
||||
startLowerCase( stripPrefix( params[i].name, "p" ) ) + " )";
|
||||
}
|
||||
else if ( vectorAsNullptr )
|
||||
{
|
||||
arguments += "nullptr";
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( vectorParamIndices.size() )
|
||||
{
|
||||
case 1:
|
||||
arguments += "reinterpret_cast<" + params[i].type.type + " *>( " +
|
||||
startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )";
|
||||
break;
|
||||
case 2:
|
||||
arguments += "reinterpret_cast<" + params[i].type.type + " *>( enumeratedData." +
|
||||
( ( vectorParamIndices.find( i ) == vectorParamIndices.begin() ) ? "first" : "second" ) +
|
||||
".data() )";
|
||||
break;
|
||||
default: assert( false );
|
||||
}
|
||||
}
|
||||
else if ( ( i == vectorParamIndices.second ) && singular )
|
||||
{
|
||||
arguments += "sizeof( T )";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string arg = params[i].name;
|
||||
if ( beginsWith( params[i].type.type, "Vk" ) )
|
||||
arguments += constructCallArgument( params[i], true );
|
||||
}
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
std::string
|
||||
VulkanHppGenerator::constructCallArgumentsVectors( std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices ) const
|
||||
{
|
||||
assert( !vectorParamIndices.empty() );
|
||||
size_t countIndex = vectorParamIndices.begin()->second;
|
||||
|
||||
std::string arguments = "m_" + startLowerCase( stripPrefix( params[0].type.type, "Vk" ) );
|
||||
for ( size_t i = 1; i < params.size(); i++ )
|
||||
{
|
||||
if ( params[i].type.isValue() )
|
||||
arguments += ", ";
|
||||
if ( i == countIndex )
|
||||
{
|
||||
arg = "static_cast<" + params[i].type.type + ">( " + arg + " )";
|
||||
arguments += startLowerCase( stripPrefix( params[vectorParamIndices.begin()->first].name, "p" ) ) + ".size()";
|
||||
}
|
||||
else if ( vectorParamIndices.find( i ) != vectorParamIndices.end() )
|
||||
{
|
||||
assert( !params[i].type.prefix.empty() && !params[i].type.postfix.empty() );
|
||||
arguments += "reinterpret_cast<" + params[i].type.prefix + " " + params[i].type.type + " " +
|
||||
params[i].type.postfix + ">( " + startLowerCase( stripPrefix( params[i].name, "p" ) ) + ".data() )";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( enhanced )
|
||||
{
|
||||
arg = "&" + startLowerCase( stripPrefix( arg, "p" ) );
|
||||
}
|
||||
arg = "reinterpret_cast<" + params[i].type.prefix + " " + params[i].type.type + " " + params[i].type.postfix +
|
||||
">( " + arg + " )";
|
||||
}
|
||||
}
|
||||
arguments += "" + arg;
|
||||
arguments += constructCallArgument( params[i], true );
|
||||
}
|
||||
}
|
||||
return arguments;
|
||||
@ -3904,14 +4003,15 @@ std::string
|
||||
{ "counterName",
|
||||
startLowerCase( stripPrefix( stripPluralS( commandData.params[firstVectorParamIt->second].name ), "p" ) ) },
|
||||
{ "counterType", commandData.params[firstVectorParamIt->second].type.type },
|
||||
{ "firstCallArguments", constructCallArguments( commandData.params, vectorParamIndices, true, true, false ) },
|
||||
{ "firstCallArguments",
|
||||
constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, true ) },
|
||||
{ "nodiscard", nodiscard },
|
||||
{ "pairConstructor",
|
||||
withAllocators ? ( "( std::piecewise_construct, std::forward_as_tuple( " + firstVectorName +
|
||||
"Allocator ), std::forward_as_tuple( " + secondVectorName + "Allocator ) )" )
|
||||
: "" },
|
||||
{ "secondCallArguments",
|
||||
constructCallArguments( commandData.params, vectorParamIndices, false, true, false ) },
|
||||
constructCallArgumentsEnumerateVectors( commandData.params, vectorParamIndices, false ) },
|
||||
{ "templateTypeFirst", templateTypeFirst },
|
||||
{ "templateTypeSecond", templateTypeSecond },
|
||||
{ "vkCommand", name },
|
||||
@ -4050,7 +4150,8 @@ std::string VulkanHppGenerator::constructCommandGetVector( std::string const &
|
||||
functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, vectorParamIndices, false, true, false ) },
|
||||
{ "callArguments",
|
||||
constructCallArgumentsGetVector( commandData.params, *vectorParamIndices.begin(), false ) },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "dataName", startLowerCase( stripPrefix( commandData.params[vectorParamIndex].name, "p" ) ) },
|
||||
@ -4170,7 +4271,7 @@ std::string VulkanHppGenerator::constructCommandGetVectorSingular( std::string c
|
||||
functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, vectorParamIndices, false, true, true ) },
|
||||
{ "callArguments", constructCallArgumentsGetVector( commandData.params, *vectorParamIndices.begin(), true ) },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "dataName", startLowerCase( stripPrefix( commandData.params[vectorParamIndex].name, "p" ) ) },
|
||||
@ -4216,10 +4317,10 @@ std::string VulkanHppGenerator::constructCommandSimple( std::string const & name
|
||||
return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}" );
|
||||
})";
|
||||
|
||||
str = replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, {}, false, true, false ) },
|
||||
str = replaceWithMap(
|
||||
functionTemplate,
|
||||
std::map<std::string, std::string>( { { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, true ) },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "nodiscard", nodiscard },
|
||||
@ -4260,10 +4361,10 @@ std::string VulkanHppGenerator::constructCommandSimpleVoid( std::string const &
|
||||
d.${vkCommand}( ${callArguments} );
|
||||
})";
|
||||
|
||||
str = replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, {}, false, true, false ) },
|
||||
str = replaceWithMap(
|
||||
functionTemplate,
|
||||
std::map<std::string, std::string>( { { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, true ) },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "vkCommand", name } } ) );
|
||||
@ -4291,36 +4392,45 @@ std::string VulkanHppGenerator::constructCommandStandard( std::string const & na
|
||||
std::string argumentList = constructArgumentListStandard( commandData.params, { 0 } );
|
||||
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
|
||||
std::string nodiscard = constructNoDiscardStandard( commandData );
|
||||
assert( ( commandData.returnType == "void" ) || ( commandData.returnType == "VkResult" ) );
|
||||
std::string returnType = ( commandData.returnType == "void" ) ? "void" : "Result";
|
||||
|
||||
if ( definition )
|
||||
{
|
||||
std::string functionBody = "d." + name + "( " + constructCallArguments( commandData.params, false ) + " )";
|
||||
if ( returnType != "void" )
|
||||
{
|
||||
assert( returnType == "Result" );
|
||||
functionBody = "return static_cast<Result>( " + functionBody + " )";
|
||||
}
|
||||
|
||||
std::string const functionTemplate =
|
||||
R"( template <typename Dispatch>
|
||||
${nodiscard}VULKAN_HPP_INLINE Result ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
|
||||
${nodiscard}VULKAN_HPP_INLINE ${returnType} ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return static_cast<Result>( d.${vkCommand}( ${callArguments} ) );
|
||||
${functionBody};
|
||||
})";
|
||||
|
||||
str = replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>( {
|
||||
{ "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, {}, true, false, false ) },
|
||||
str =
|
||||
replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>( { { "argumentList", argumentList },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "functionBody", functionBody },
|
||||
{ "nodiscard", nodiscard },
|
||||
{ "vkCommand", name },
|
||||
} ) );
|
||||
{ "returnType", returnType } } ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string const functionTemplate =
|
||||
R"( template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||
${nodiscard}Result ${commandName}( ${argumentList} VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;)";
|
||||
${nodiscard}${returnType} ${commandName}( ${argumentList} VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;)";
|
||||
|
||||
str = replaceWithMap(
|
||||
functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "argumentList", argumentList }, { "commandName", commandName }, { "nodiscard", nodiscard } } ) );
|
||||
str = replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>( { { "argumentList", argumentList },
|
||||
{ "commandName", commandName },
|
||||
{ "nodiscard", nodiscard },
|
||||
{ "returnType", returnType } } ) );
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ -4346,7 +4456,7 @@ std::string VulkanHppGenerator::constructCommandStandardVoid( std::string const
|
||||
str = replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>( {
|
||||
{ "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArguments( commandData.params, {}, false, false, false ) },
|
||||
{ "callArguments", constructCallArguments( commandData.params, false ) },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "vkCommand", name },
|
||||
@ -4365,6 +4475,72 @@ std::string VulkanHppGenerator::constructCommandStandardVoid( std::string const
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::constructCommandTwoVectorsVoid( std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool definition,
|
||||
bool withAllocators ) const
|
||||
{
|
||||
std::string str;
|
||||
|
||||
auto firstVectorParamIt = vectorParamIndices.begin();
|
||||
auto secondVectorParamIt = std::next( firstVectorParamIt );
|
||||
|
||||
assert( commandData.params[0].type.type == commandData.handle );
|
||||
assert( firstVectorParamIt->second == secondVectorParamIt->second );
|
||||
|
||||
std::string argumentList =
|
||||
constructArgumentListEnhanced( commandData.params, { 0, firstVectorParamIt->second }, definition, withAllocators );
|
||||
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
|
||||
|
||||
if ( definition )
|
||||
{
|
||||
const std::string functionTemplate =
|
||||
R"x( template <typename Dispatch>
|
||||
VULKAN_HPP_INLINE void ${className}::${commandName}( ${argumentList} ) const
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
VULKAN_HPP_ASSERT( ${firstVectorName}.size() == ${secondVectorName}.size() );
|
||||
# else
|
||||
if ( ${firstVectorName}.size() != ${secondVectorName}.size() )
|
||||
{
|
||||
throw LogicError( VULKAN_HPP_NAMESPACE_STRING "::${className}::${commandName}: ${firstVectorName}.size() != ${secondVectorName}.size()" );
|
||||
}
|
||||
#endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||
d.${vkCommand}( ${callArguments} );
|
||||
})x";
|
||||
|
||||
assert( beginsWith( commandData.params[firstVectorParamIt->first].name, "p" ) );
|
||||
std::string firstVectorName =
|
||||
startLowerCase( stripPrefix( commandData.params[firstVectorParamIt->first].name, "p" ) );
|
||||
assert( beginsWith( commandData.params[secondVectorParamIt->first].name, "p" ) );
|
||||
std::string secondVectorName =
|
||||
startLowerCase( stripPrefix( commandData.params[secondVectorParamIt->first].name, "p" ) );
|
||||
|
||||
str =
|
||||
replaceWithMap( functionTemplate,
|
||||
std::map<std::string, std::string>(
|
||||
{ { "argumentList", argumentList },
|
||||
{ "callArguments", constructCallArgumentsVectors( commandData.params, vectorParamIndices ) },
|
||||
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "firstVectorName", firstVectorName },
|
||||
{ "secondVectorName", secondVectorName },
|
||||
{ "vkCommand", name } } ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string functionTemplate =
|
||||
R"( template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||
void ${commandName}( ${argumentList} ) const;)";
|
||||
|
||||
str = replaceWithMap(
|
||||
functionTemplate,
|
||||
std::map<std::string, std::string>( { { "argumentList", argumentList }, { "commandName", commandName } } ) );
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string
|
||||
VulkanHppGenerator::constructConstexprString( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
|
@ -338,6 +338,11 @@ private:
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
bool definition ) const;
|
||||
void appendCommandTwoVectorsVoid( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool definition ) const;
|
||||
void appendDispatchLoaderDynamicCommand( std::string & str,
|
||||
std::string & emptyFunctions,
|
||||
std::string & deviceFunctions,
|
||||
@ -523,11 +528,16 @@ private:
|
||||
bool withAllocators ) const;
|
||||
std::string constructArgumentListStandard( std::vector<ParamData> const & params,
|
||||
std::set<size_t> const & skippedParams ) const;
|
||||
std::string constructCallArguments( std::vector<ParamData> const & params,
|
||||
std::string constructCallArgument( ParamData const & param, bool enhanced ) const;
|
||||
std::string constructCallArguments( std::vector<ParamData> const & params, bool enhanced ) const;
|
||||
std::string constructCallArgumentsEnumerateVectors( std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool vectorAsNullptr,
|
||||
bool enhanced,
|
||||
bool vectorAsNullptr ) const;
|
||||
std::string constructCallArgumentsGetVector( std::vector<ParamData> const & params,
|
||||
std::pair<size_t, size_t> const & vectorParamIndices,
|
||||
bool singular ) const;
|
||||
std::string constructCallArgumentsVectors( std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices ) const;
|
||||
std::string constructCommandEnumerateTwoVectors( std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
@ -558,6 +568,11 @@ private:
|
||||
constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const;
|
||||
std::string
|
||||
constructCommandStandardVoid( std::string const & name, CommandData const & commandData, bool definition ) const;
|
||||
std::string constructCommandTwoVectorsVoid( std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool definition,
|
||||
bool withAllocators ) const;
|
||||
std::string constructConstexprString( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string constructFunctionBodyEnhanced( std::string const & indentation,
|
||||
std::string const & name,
|
||||
|
@ -87368,6 +87368,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
reinterpret_cast<const VkBuffer *>( pCounterBuffers ),
|
||||
reinterpret_cast<const VkDeviceSize *>( pCounterBufferOffsets ) );
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template <typename Dispatch>
|
||||
VULKAN_HPP_INLINE void CommandBuffer::beginTransformFeedbackEXT(
|
||||
@ -87383,7 +87384,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
throw LogicError(
|
||||
VULKAN_HPP_NAMESPACE_STRING
|
||||
"::VkCommandBuffer::beginTransformFeedbackEXT: counterBuffers.size() != counterBufferOffsets.size()" );
|
||||
"::CommandBuffer::beginTransformFeedbackEXT: counterBuffers.size() != counterBufferOffsets.size()" );
|
||||
}
|
||||
# endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||
d.vkCmdBeginTransformFeedbackEXT( m_commandBuffer,
|
||||
@ -87551,6 +87552,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
reinterpret_cast<const VkBuffer *>( pBuffers ),
|
||||
reinterpret_cast<const VkDeviceSize *>( pOffsets ) );
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template <typename Dispatch>
|
||||
VULKAN_HPP_INLINE void
|
||||
@ -87565,7 +87567,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
if ( buffers.size() != offsets.size() )
|
||||
{
|
||||
throw LogicError( VULKAN_HPP_NAMESPACE_STRING
|
||||
"::VkCommandBuffer::bindVertexBuffers: buffers.size() != offsets.size()" );
|
||||
"::CommandBuffer::bindVertexBuffers: buffers.size() != offsets.size()" );
|
||||
}
|
||||
# endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||
d.vkCmdBindVertexBuffers( m_commandBuffer,
|
||||
@ -87757,6 +87759,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
reinterpret_cast<const VkAccelerationStructureBuildGeometryInfoKHR *>( pInfos ),
|
||||
reinterpret_cast<const VkAccelerationStructureBuildOffsetInfoKHR * const *>( ppOffsetInfos ) );
|
||||
}
|
||||
|
||||
# ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template <typename Dispatch>
|
||||
VULKAN_HPP_INLINE void CommandBuffer::buildAccelerationStructureKHR(
|
||||
@ -87770,7 +87773,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
if ( infos.size() != pOffsetInfos.size() )
|
||||
{
|
||||
throw LogicError( VULKAN_HPP_NAMESPACE_STRING
|
||||
"::VkCommandBuffer::buildAccelerationStructureKHR: infos.size() != pOffsetInfos.size()" );
|
||||
"::CommandBuffer::buildAccelerationStructureKHR: infos.size() != pOffsetInfos.size()" );
|
||||
}
|
||||
# endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||
d.vkCmdBuildAccelerationStructureKHR(
|
||||
@ -88523,6 +88526,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
reinterpret_cast<const VkBuffer *>( pCounterBuffers ),
|
||||
reinterpret_cast<const VkDeviceSize *>( pCounterBufferOffsets ) );
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template <typename Dispatch>
|
||||
VULKAN_HPP_INLINE void CommandBuffer::endTransformFeedbackEXT(
|
||||
@ -88538,7 +88542,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
throw LogicError(
|
||||
VULKAN_HPP_NAMESPACE_STRING
|
||||
"::VkCommandBuffer::endTransformFeedbackEXT: counterBuffers.size() != counterBufferOffsets.size()" );
|
||||
"::CommandBuffer::endTransformFeedbackEXT: counterBuffers.size() != counterBufferOffsets.size()" );
|
||||
}
|
||||
# endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||
d.vkCmdEndTransformFeedbackEXT( m_commandBuffer,
|
||||
@ -97556,6 +97560,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
reinterpret_cast<const VkSwapchainKHR *>( pSwapchains ),
|
||||
reinterpret_cast<const VkHdrMetadataEXT *>( pMetadata ) );
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template <typename Dispatch>
|
||||
VULKAN_HPP_INLINE void
|
||||
@ -97569,7 +97574,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
if ( swapchains.size() != metadata.size() )
|
||||
{
|
||||
throw LogicError( VULKAN_HPP_NAMESPACE_STRING
|
||||
"::VkDevice::setHdrMetadataEXT: swapchains.size() != metadata.size()" );
|
||||
"::Device::setHdrMetadataEXT: swapchains.size() != metadata.size()" );
|
||||
}
|
||||
# endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||
d.vkSetHdrMetadataEXT( m_device,
|
||||
|
Loading…
Reference in New Issue
Block a user