Skip to content

Commit

Permalink
Better fix to prevent iOS deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Mar 9, 2024
1 parent 1175241 commit d100b39
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Veldrid/MTL/MTLGraphicsDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static readonly Dictionary<IntPtr, MTLGraphicsDevice> s_aotRegisteredBlo
private readonly IntPtr _completionBlockLiteral;

private readonly IMTLDisplayLink _displayLink;
private readonly AutoResetEvent _nextFrameReadyEvent = new AutoResetEvent(true);
private readonly AutoResetEvent _nextFrameReadyEvent;
private readonly EventWaitHandle _frameEndedEvent = new EventWaitHandle(true, EventResetMode.ManualReset);

public MTLDevice Device => _device;
Expand Down Expand Up @@ -126,7 +126,10 @@ public MTLGraphicsDevice(
}

if (_displayLink != null)
{
_nextFrameReadyEvent = new AutoResetEvent(true);
_displayLink.Callback += OnDisplayLinkCallback;
}

_completionHandlerFuncPtr = Marshal.GetFunctionPointerForDelegate<MTLCommandBufferHandler>(_completionHandler);
_completionBlockDescriptor = Marshal.AllocHGlobal(Unsafe.SizeOf<BlockDescriptor>());
Expand Down

0 comments on commit d100b39

Please sign in to comment.