Merge pull request #52 from mtavenrath/issue_34

Fix issue #34, provide null() references for structs
This commit is contained in:
asuessenbach 2016-02-26 12:06:24 +01:00
commit fa439aa10f
3 changed files with 631 additions and 0 deletions

View File

@ -174,6 +174,10 @@ Here are a few code examples:
// Accept std::vector as source for updateBuffer
commandBuffer.updateBuffer(buffer, 0, {some values}); // update buffer with std::vector
// Sometimes it's necessary to pass a nullptr to a struct. For this case we've added T& null() to all structs T as replacement for nullptr.
device.allocateMemory(allocateInfo, vk::AllocationCallbacks::null());
}
catch (vk::Exception e)
{

View File

@ -2584,6 +2584,13 @@ void writeTypeStruct( std::ofstream & ofs, DependencyData const& dependencyData,
}
}
// null handle
ofs << " static " << dependencyData.name << "& null()" << std::endl
<< " {" << std::endl
<< " return *((" << dependencyData.name << "*)(nullptr));" << std::endl
<< " }" << std::endl
<< std::endl;
// the cast-operator to the wrapped struct, and the struct itself as a private member variable
ofs << " operator const Vk" << dependencyData.name << "&() const" << std::endl
<< " {" << std::endl

File diff suppressed because it is too large Load Diff