mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #52 from mtavenrath/issue_34
Fix issue #34, provide null() references for structs
This commit is contained in:
commit
fa439aa10f
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
620
vulkan/vk_cpp.h
620
vulkan/vk_cpp.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user