public VkObjectResult <IVkSurfaceKHR> CreateXcbSurfaceKHR(VkXcbSurfaceCreateInfoKHR 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.CreateXcbSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle); var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null; return(new VkObjectResult <IVkSurfaceKHR>(result, instance)); } }