public void Wait() { Span <Fence> fences = stackalloc Fence[1]; fences[0] = _fence; FenceHelper.WaitAllIndefinitely(_api, _device, fences); }
/// <summary> /// Wait until all the fences on the holder with buffer uses overlapping the specified range are signaled. /// </summary> /// <param name="api">Vulkan API instance</param> /// <param name="device">GPU device that the fences belongs to</param> /// <param name="offset">Start offset of the buffer range</param> /// <param name="size">Size of the buffer range in bytes</param> /// <param name="hasTimeout">Indicates if <paramref name="timeout"/> should be used</param> /// <param name="timeout">Timeout in nanoseconds</param> /// <returns>True if all fences were signaled before the timeout expired, false otherwise</returns> private bool WaitForFencesImpl(Vk api, Device device, int offset, int size, bool hasTimeout, ulong timeout) { FenceHolder[] fenceHolders; Fence[] fences; lock (_fences) { fenceHolders = size != 0 ? GetOverlappingFences(offset, size) : _fences.Keys.ToArray(); fences = new Fence[fenceHolders.Length]; for (int i = 0; i < fenceHolders.Length; i++) { fences[i] = fenceHolders[i].Get(); } } if (fences.Length == 0) { return(true); } bool signaled = true; if (hasTimeout) { signaled = FenceHelper.AllSignaled(api, device, fences, timeout); } else { FenceHelper.WaitAllIndefinitely(api, device, fences); } for (int i = 0; i < fenceHolders.Length; i++) { fenceHolders[i].Put(); } return(signaled); }