Resolve instantiation issue with structures that are flagged as returnedonly (#382)
- make layout-structure default constructor an empty function - introduce default constructor for the corresponding (non-layout) structure, delegating to the layout-structure's constructor - introduce copy- and assignment constructors from the corresponding vulkan-structure, delegating to the copy- and assignment constructor from the layout-structure
This commit is contained in:
parent
a12c3807de
commit
a9a4860591
@ -2346,6 +2346,8 @@ std::string VulkanHppGenerator::appendStructConstructor(std::pair<std::string, S
|
||||
std::string arguments, initializers, copyOps;
|
||||
bool listedArgument = false;
|
||||
bool firstArgument = true;
|
||||
if (!structData.second.returnedOnly)
|
||||
{
|
||||
for (auto const& member : structData.second.members)
|
||||
{
|
||||
// gather the arguments
|
||||
@ -2383,11 +2385,12 @@ std::string VulkanHppGenerator::appendStructConstructor(std::pair<std::string, S
|
||||
{
|
||||
copyOps += "\n" + prefix;
|
||||
}
|
||||
}
|
||||
|
||||
std::string structConstructor = prefix + stripPrefix(structData.first, "Vk") + (arguments.empty() ? "()\n" : std::string("( " + arguments + " )")) + "\n";
|
||||
std::string structConstructor = prefix + stripPrefix(structData.first, "Vk") + (arguments.empty() ? "()" : std::string("( " + arguments + " )")) + "\n";
|
||||
if (withLayoutStructure)
|
||||
{
|
||||
structConstructor += prefix + " : layout::" + stripPrefix(structData.first, "Vk") + "( " + initializers + " )\n" + prefix + "{}\n";
|
||||
structConstructor += prefix + " : layout::" + stripPrefix(structData.first, "Vk") + (initializers.empty() ? "()" : std::string("( " + initializers + " )")) + "\n" + prefix + "{}\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2479,7 +2482,7 @@ void VulkanHppGenerator::appendStructCopyConstructors(std::string & str, std::st
|
||||
|
||||
${name}& operator=( Vk${name} const & rhs )
|
||||
{
|
||||
*reinterpret_cast<Vk${name}*>(this) = rhs;
|
||||
layout::${name}::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
)";
|
||||
@ -2596,12 +2599,11 @@ ${members} };
|
||||
});
|
||||
}
|
||||
|
||||
// only structs that are not returnedOnly get a constructor!
|
||||
std::string constructorAndSetters;
|
||||
std::string constructorAndSetters = appendStructConstructor(structure, " ", withLayoutStructure);
|
||||
appendStructCopyConstructors(constructorAndSetters, stripPrefix(structure.first, "Vk"), withLayoutStructure);
|
||||
if (!structure.second.returnedOnly)
|
||||
{
|
||||
constructorAndSetters += appendStructConstructor(structure, " ", withLayoutStructure);
|
||||
appendStructCopyConstructors(constructorAndSetters, stripPrefix(structure.first, "Vk"), withLayoutStructure);
|
||||
// only structs that are not returnedOnly get setters!
|
||||
for (auto const& member : structure.second.members)
|
||||
{
|
||||
appendStructSetter(constructorAndSetters, stripPrefix(structure.first, "Vk"), member);
|
||||
|
2719
vulkan/vulkan.hpp
2719
vulkan/vulkan.hpp
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user