Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pollEvents was apparently broken by a recent-ish
patch to SDL.
This should fix that. As an aside, this attempts to make polling events
a bit more efficient; We just statically allocate a single buffer for
events (AFAIK you can only call Poll from the main thread anyway, so the
fact that this isn't thread safe shouldn't be an issue), this way we avoid a bunch of unnecessary heap allocations we'd normally get via alloca.
I hope adding the
pumpEvents
call should be relatively noncontroversial, if people don't like the other bit I'll remove it. T reason I've added it is that the previous implementation would callPollEvent
twice andallocatea
once for each event, which is quite a loss becausePollEvent
needs to lock the event queue each time it's called andalloca
adds additional GC garbage. This is probably not the one thing that makes/breaks anyone's performance targets, but it is unnecessary extra work.Fixes issues like:
#241