diff --git a/src/Veldrid/MTL/MTLGraphicsDevice.cs b/src/Veldrid/MTL/MTLGraphicsDevice.cs index 08be628b8..63ff45aa6 100644 --- a/src/Veldrid/MTL/MTLGraphicsDevice.cs +++ b/src/Veldrid/MTL/MTLGraphicsDevice.cs @@ -45,7 +45,7 @@ private static readonly Dictionary s_aotRegisteredBlo private readonly IMTLDisplayLink _displayLink; private readonly AutoResetEvent _nextFrameReadyEvent; - private readonly AutoResetEvent _frameEndedEvent = new AutoResetEvent(true); + private readonly EventWaitHandle _frameEndedEvent = new EventWaitHandle(true, EventResetMode.ManualReset); public MTLDevice Device => _device; public MTLCommandQueue CommandQueue => _commandQueue; @@ -62,7 +62,6 @@ public override void UpdateActiveDisplay(int x, int y, int w, int h) { if (_displayLink != null) { - _frameEndedEvent.Set(); _displayLink.UpdateActiveDisplay(x, y, w, h); } } @@ -248,6 +247,7 @@ private protected override void SubmitCommandsCore(CommandList commandList, Fenc private protected override void WaitForNextFrameReadyCore() { + _frameEndedEvent.Reset(); _nextFrameReadyEvent?.WaitOne(TimeSpan.FromSeconds(1)); // Should never time out. }