Closed MrBrixican closed 2 months ago
Oh good call, I missed this, thanks!
In general I think the whole thing could still be cleaned up a lot ... once SDL GPU is implemented, allowing texture writes in threads, all of this code will be a lot simpler.
SpriteFontBlitModes.Streaming
can lead to spin lock behavior inBlitModule.Update
.Specifically this code in
SpriteFont.cs
:The first if will be hit if there are any incomplete tasks. The else if will never be hit until all tasks are complete, essentially ignoring the purpose of MaximumMillisecondsPerFrame. Granted, this is only an issue if a character takes longer than 3 ms to blit, which is relatively unlikely in practice on powerful hardware, but can be simulated by adding a Thread.Sleep in the
BlitTask
.A simple swap of the first and second conditions should solve the issue.
Also, as an aside, shouldn't it be
>= MaximumMillisecondsPerFrame
sinceElapsedMilliseconds
is along
so the actual maximum being enforced is currentlyMaximumMillisecondsPerFrame + 1
.