mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Fix issue #34, provide null() references for structs
This commit is contained in:
parent
9af3c10574
commit
9c6888edf3
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
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