Fix issue #34, provide null() references for structs

This commit is contained in:
Markus Tavenrath 2016-02-26 11:41:21 +01:00
parent 9af3c10574
commit 9c6888edf3
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

@ -2555,6 +2555,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