private VkObjectResult <IVkInstance> CreateInstanceInternal(IntPtr data, VkInstanceCreateInfo createInfo, VkAllocationCallbacks allocator) { var unmanaged = (byte *)data; var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged); var pAllocator = allocator.MarshalIndirect(ref unmanaged); VkInstance.HandleType handle; var result = Direct.CreateInstance(pCreateInfo, pAllocator, &handle); var instance = result == VkResult.Success ? new VkInstance(handle, allocator) : null; return(new VkObjectResult <IVkInstance>(result, instance)); }