public VkObjectResult <IVkSurfaceKHR> CreateWin32SurfaceKHR(VkWin32SurfaceCreateInfoKHR createInfo, IVkAllocationCallbacks allocator) { var unmanagedSize = createInfo.SizeOfMarshalIndirect() + allocator.SizeOfMarshalIndirect(); var unmanagedArray = new byte[unmanagedSize]; fixed(byte *unmanagedStart = unmanagedArray) { var unmanaged = unmanagedStart; var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged); var pAllocator = allocator.MarshalIndirect(ref unmanaged); VkSurfaceKHR.HandleType surfaceHandle; var result = Direct.CreateWin32SurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle); var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null; return(new VkObjectResult <IVkSurfaceKHR>(result, instance)); } }