mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Slightly improved vector-size determination on functions returning a vector and detection if a singular version of a function should be generated. (#229)
This commit is contained in:
parent
fbd17bb272
commit
76bf85b50e
@ -3434,16 +3434,21 @@ std::string VulkanHppGenerator::writeFunctionBodyEnhancedLocalReturnVariable(std
|
||||
else
|
||||
{
|
||||
// the size of the vector is given by an other parameter
|
||||
// that means (as this is not a two-step algorithm) it's size is determined by some other vector parameter!
|
||||
// first check, if that size has become the size of some other vector parameter
|
||||
// -> look for it and get it's actual size
|
||||
for (auto const& vectorParam : commandData.vectorParams)
|
||||
{
|
||||
if ((vectorParam.first != commandData.returnParam) && (vectorParam.second == it->second))
|
||||
if ((vectorParam.first != it->first) && (vectorParam.second == it->second))
|
||||
{
|
||||
size = startLowerCase(strip(commandData.params[vectorParam.first].name, "p")) + ".size()";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (size.empty())
|
||||
{
|
||||
// otherwise, just use that parameter
|
||||
size = commandData.params[it->second].name;
|
||||
}
|
||||
}
|
||||
assert(!size.empty());
|
||||
os << "( " << size << " )";
|
||||
@ -4388,7 +4393,10 @@ void VulkanHppGenerator::writeTypeCommand(std::ostream & os, std::string const&
|
||||
|
||||
// then a singular version, if a sized vector would be returned
|
||||
std::map<size_t, size_t>::const_iterator returnVector = commandData.vectorParams.find(commandData.returnParam);
|
||||
bool singular = (returnVector != commandData.vectorParams.end()) && (returnVector->second != ~0) && (commandData.params[returnVector->second].type.back() != '*');
|
||||
bool singular = (returnVector != commandData.vectorParams.end()) &&
|
||||
(returnVector->second != ~0) &&
|
||||
(commandData.params[returnVector->first].pureType != "void") &&
|
||||
(commandData.params[returnVector->second].type.back() != '*');
|
||||
if (singular)
|
||||
{
|
||||
writeFunction(enhanced, indentation, commandData, definition, true, true, false, false);
|
||||
|
Loading…
Reference in New Issue
Block a user