After using 3.10 for a while, I've discovered a few deadlocks, null refs and race conditions in the new rendering system when disposing or stopping a player.
I've looked into fixing them and some might be easier fixes than others.
Renderer.Preset.cs:
- RenderIdleLoop is the only place that sets isIdleRunning to false. However, it can call
RenderIdleLoop -> RenderIdle -> SharpGenException -> ResetLocal -> RenderIdleStop.
RenderIdleStop waits for isIdleRunning to be set to false which cannot happen since RenderIdleLoop is waiting for itself.
SwapChain.cs:
- Multiple threads can call DisposeLocal at the same time which may provoke uncaught null ref exceptions.
Renderer.VP.D3.cs:
- D3Dispose might stall on
vp.Dispose(), tried moving context.ClearState() and context.Flush() earlier in the Dispose call, but that would also sometimes stall. I think it might have to do with another thread already using the context for rendering while Dispose is trying to free the resource.
After using 3.10 for a while, I've discovered a few deadlocks, null refs and race conditions in the new rendering system when disposing or stopping a player.
I've looked into fixing them and some might be easier fixes than others.
Renderer.Preset.cs:
RenderIdleLoop -> RenderIdle -> SharpGenException -> ResetLocal -> RenderIdleStop.
RenderIdleStop waits for isIdleRunning to be set to false which cannot happen since RenderIdleLoop is waiting for itself.
SwapChain.cs:
Renderer.VP.D3.cs:
vp.Dispose(), tried movingcontext.ClearState()andcontext.Flush()earlier in the Dispose call, but that would also sometimes stall. I think it might have to do with another thread already using the context for rendering while Dispose is trying to free the resource.