Merge pull request #1356 from asuessenbach/deadcode

Remove some dead code.
This commit is contained in:
Andreas Süßenbach 2022-07-18 11:42:25 +02:00 committed by GitHub
commit 9a561fa33f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 94 deletions

View File

@ -6588,20 +6588,8 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
( commandIt->second.successCodes[1] == "VK_INCOMPLETE" ) ) ( commandIt->second.successCodes[1] == "VK_INCOMPLETE" ) )
{ {
std::map<size_t, size_t> vectorParams = determineVectorParams( commandIt->second.params ); std::map<size_t, size_t> vectorParams = determineVectorParams( commandIt->second.params );
switch ( vectorParams.size() ) if ( vectorParams.size() == 1 )
{ {
case 0:
if ( ( commandIt->second.params[returnParams[0]].type.type != "void" ) && !isHandleType( commandIt->second.params[returnParams[0]].type.type ) &&
!isStructureChainAnchor( commandIt->second.params[returnParams[0]].type.type ) )
{
if ( ( commandIt->second.params[returnParams[1]].type.type != "void" ) && !isHandleType( commandIt->second.params[returnParams[1]].type.type ) &&
!isStructureChainAnchor( commandIt->second.params[returnParams[1]].type.type ) )
{
return generateRAIIHandleCommandResultMultiSuccessWithErrors2ReturnValues( commandIt, initialSkipCount, vectorParams, returnParams, definition );
}
}
break;
case 1:
if ( returnParams[0] == vectorParams.begin()->second ) if ( returnParams[0] == vectorParams.begin()->second )
{ {
if ( returnParams[1] == vectorParams.begin()->first ) if ( returnParams[1] == vectorParams.begin()->first )
@ -6625,73 +6613,12 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
} }
} }
} }
break;
default: assert( false ); break;
} }
} }
return ""; return "";
} }
std::string
VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors2ReturnValues( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParams,
std::vector<size_t> const & returnParams,
bool definition ) const
{
assert( returnParams.size() == 2 );
std::set<size_t> skippedParams = determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, returnParams, false );
std::string argumentList =
generateArgumentListEnhanced( commandIt->second.params, returnParams, vectorParams, skippedParams, {}, {}, definition, false, false, false );
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags, false, false );
std::string firstDataType = stripPostfix( commandIt->second.params[returnParams[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
std::string secondDataType = stripPostfix( commandIt->second.params[returnParams[1]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
if ( definition )
{
std::string const definitionTemplate =
R"(
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::tuple<VULKAN_HPP_NAMESPACE::Result, ${firstDataType}, ${secondDataType}> ${className}::${commandName}( ${argumentList} ) const
{${functionPointerCheck}
${firstDataType} ${firstDataName};
${secondDataType} ${secondDataName};
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
if ( ${failureCheck} )
{
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING"::${className}::${commandName}" );
}
return std::make_tuple( result, ${firstDataName},${secondDataName} );
}
)";
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, {}, true );
std::string valueName = startLowerCase( stripPrefix( commandIt->second.params[returnParams[0]].name, "p" ) );
return replaceWithMap( definitionTemplate,
{ { "argumentList", argumentList },
{ "callArguments", callArguments },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName },
{ "failureCheck", generateFailureCheck( commandIt->second.successCodes ) },
{ "firstDataName", startLowerCase( stripPrefix( commandIt->second.params[returnParams[0]].name, "p" ) ) },
{ "firstDataType", firstDataType },
{ "functionPointerCheck", generateFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
{ "secondDataName", startLowerCase( stripPrefix( commandIt->second.params[returnParams[1]].name, "p" ) ) },
{ "secondDataType", secondDataType },
{ "vkCommand", commandIt->first } } );
}
else
{
std::string const declarationTemplate =
R"(
VULKAN_HPP_NODISCARD std::tuple<VULKAN_HPP_NAMESPACE::Result, ${firstDataType}, ${secondDataType}> ${commandName}( ${argumentList} ) const;
)";
return replaceWithMap(
declarationTemplate,
{ { "argumentList", argumentList }, { "commandName", commandName }, { "firstDataType", firstDataType }, { "secondDataType", secondDataType } } );
}
}
std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::map<std::string, CommandData>::const_iterator commandIt, std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,

View File

@ -722,11 +722,6 @@ private:
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,
std::vector<size_t> const & returnParamIndices ) const; std::vector<size_t> const & returnParamIndices ) const;
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors2ReturnValues( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParams,
std::vector<size_t> const & returnParams,
bool definition ) const;
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::map<std::string, CommandData>::const_iterator commandIt, std::string generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,