Closed chuigda closed 5 days ago
<command api="vulkan" successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_EXTENSION_NOT_PRESENT,VK_ERROR_FEATURE_NOT_PRESENT,VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_DEVICE_LOST"> <proto><type>VkResult</type> <name>vkCreateDevice</name></proto> <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param> <param>const <type>VkDeviceCreateInfo</type>* <name>pCreateInfo</name></param> <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param> <param><type>VkDevice</type>* <name>pDevice</name></param> </command>
比如这里的 VkAllocationCallbacks 是 optional 的,我们可以在对应的 binding 上面加 @nullable 注解,并且在 invoke 的时候检查 pAllocator != null ? pAllocator.segment() : MemorySegment.NULL。对于没有 optional 的情况则可以不检查。
VkAllocationCallbacks
@nullable
invoke
pAllocator != null ? pAllocator.segment() : MemorySegment.NULL
optional
Fixed by https://github.com/chuigda/vulkan4j/commit/71e776ff8165dc33135e7b5e7c3ad73e262a6f82
比如这里的
VkAllocationCallbacks
是 optional 的,我们可以在对应的 binding 上面加@nullable
注解,并且在invoke
的时候检查pAllocator != null ? pAllocator.segment() : MemorySegment.NULL
。对于没有optional
的情况则可以不检查。