private VkObjectResult <IVkDevice> CreateDevice(IntPtr data, VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator) { var unmanaged = (byte *)data; var createInfoRaw = createInfo.MarshalDirect(ref unmanaged); var pAllocator = allocator.MarshalIndirect(ref unmanaged); VkDevice.HandleType handle; var result = Direct.CreateDevice(Handle, &createInfoRaw, pAllocator, &handle); var device = result == VkResult.Success ? new VkDevice(this, handle, allocator) : null; return(new VkObjectResult <IVkDevice>(result, device)); }