mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-26 05:40:07 +00:00
Merge pull request #540 from asuessenbach/arraySize
Add support of array-sized function arguments
This commit is contained in:
commit
97b2a52d4f
@ -796,9 +796,9 @@ void VulkanHppGenerator::appendArgumentVector(std::string & str, size_t paramInd
|
||||
void VulkanHppGenerator::appendArgumentVulkanType(std::string & str, ParamData const& paramData) const
|
||||
{
|
||||
// this parameter is a vulkan type
|
||||
if (!paramData.type.postfix.empty())
|
||||
if (!paramData.type.postfix.empty() || !paramData.arraySizes.empty())
|
||||
{
|
||||
assert(paramData.type.postfix.back() == '*');
|
||||
assert((paramData.type.postfix.empty() || (paramData.type.postfix.back() == '*')) && (paramData.arraySizes.empty() || (paramData.arraySizes.size() == 1)));
|
||||
// it's a pointer -> needs a reinterpret cast to the vulkan type
|
||||
std::string parameterName = startLowerCase(stripPrefix(paramData.name, "p"));
|
||||
appendReinterpretCast(str, paramData.type.prefix.find("const") != std::string::npos, paramData.type.type, false);
|
||||
@ -811,7 +811,7 @@ void VulkanHppGenerator::appendArgumentVulkanType(std::string & str, ParamData c
|
||||
else
|
||||
{
|
||||
// other parameters can just use the pointer
|
||||
str += "&" + parameterName;
|
||||
str += (paramData.arraySizes.empty() ? "&" : "") + parameterName;
|
||||
}
|
||||
str += " )";
|
||||
}
|
||||
@ -2040,25 +2040,25 @@ void VulkanHppGenerator::appendFunctionBodyStandard(std::string & str, std::stri
|
||||
{
|
||||
str += ", ";
|
||||
}
|
||||
appendFunctionBodyStandardArgument(str, commandData.second.params[i].type, commandData.second.params[i].name);
|
||||
appendFunctionBodyStandardArgument(str, commandData.second.params[i].type, commandData.second.params[i].name, commandData.second.params[i].arraySizes);
|
||||
}
|
||||
str += std::string(" )") + (returnData.first ? " )" : "") + ";\n";
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::appendFunctionBodyStandardArgument(std::string & str, TypeData const& typeData, std::string const& name) const
|
||||
void VulkanHppGenerator::appendFunctionBodyStandardArgument(std::string & str, TypeData const& typeData, std::string const& name, std::vector<std::string> const& arraySizes) const
|
||||
{
|
||||
if (beginsWith(typeData.type, "Vk"))
|
||||
{
|
||||
// the parameter is a vulkan type
|
||||
if (!typeData.postfix.empty())
|
||||
if (!typeData.postfix.empty() || !arraySizes.empty())
|
||||
{
|
||||
assert(typeData.postfix.back() == '*');
|
||||
assert((typeData.postfix.empty() || (typeData.postfix.back() == '*')) && (arraySizes.empty() || (arraySizes.size() == 1)));
|
||||
// it's a pointer -> need to reinterpret_cast it
|
||||
appendReinterpretCast(str, typeData.prefix.find("const") == 0, typeData.type, typeData.postfix.find("* const") != std::string::npos);
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a value -> need to static_cast ist
|
||||
// it's a value -> need to static_cast it
|
||||
str += "static_cast<" + typeData.type + ">";
|
||||
}
|
||||
str += "( " + name + " )";
|
||||
|
@ -240,7 +240,7 @@ class VulkanHppGenerator
|
||||
void appendFunctionBodyEnhancedVectorOfStructureChain(std::string & str, std::string const& indentation, std::pair<std::string,CommandData> const& commandData, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool withAllocator) const;
|
||||
void appendFunctionBodyEnhancedVectorOfUniqueHandles(std::string & str, std::string const& indentation, std::string const& commandName, std::pair<std::string, CommandData> const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, bool singular, bool withAllocator) const;
|
||||
void appendFunctionBodyStandard(std::string & str, std::string const& indentation, std::pair<std::string, CommandData> const& commandData) const;
|
||||
void appendFunctionBodyStandardArgument(std::string & str, TypeData const& typeData, std::string const& name) const;
|
||||
void appendFunctionBodyStandardArgument(std::string & str, TypeData const& typeData, std::string const& name, std::vector<std::string> const& arraySizes) const;
|
||||
bool appendFunctionHeaderArgumentEnhanced(std::string & str, ParamData const& param, size_t paramIndex, std::map<size_t, size_t> const& vectorParamIndices, bool skip, bool argEncountered, bool isTemplateParam, bool isLastArgument, bool singular, bool withDefaults, bool withAllocator) const;
|
||||
void appendFunctionHeaderArgumentEnhancedPointer(std::string & str, ParamData const& param, std::string const& strippedParameterName, bool withDefaults, bool withAllocator) const;
|
||||
void appendFunctionHeaderArgumentEnhancedSimple(std::string & str, ParamData const& param, bool lastArgument, bool withDefaults, bool withAllocator) const;
|
||||
|
Loading…
Reference in New Issue
Block a user