Unnecessary updating of joysticks and gamepads #2362
Labels
area-Input
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
Summary
GLFW does not expose callbacks for joysticks and gamepads, meaning that in order to get updates from these devices, Silk.NET must get the state from GLFW every
Update
and manually diff the state retrieved to raise the necessary events. This causes something of an efficiency penalty (we've had a report of excessive temperatures, but most reports are profiling related) but is ultimately unavoidable. However, one of the most seemingly expensive parts of this is that we're updating all 16 gamepads/joysticks, even the disconnected ones! And interestingly GLFW does actually have a callback for joystick connection/disconnection.I would like to propose that we change the backend to only
Update
when we have received a callback indicating that the joystick is connected (i.e. cache the result, and also within that callback we should also cache the result ofglfwJoystickIsGamepad
). This should massively reduce the amount of complaints we get with this logic.Steps to reproduce
Comments
This was identified originally in discussion with @Chriz-G in Discord. I think they indicated they might be working on a fix. Further report received from @HolographicWings
The text was updated successfully, but these errors were encountered: