Input: Windows: Initialize DirectInput in WorkerThreadPool task#89363
Closed
kavaari wants to merge 1 commit intogodotengine:masterfrom
Closed
Input: Windows: Initialize DirectInput in WorkerThreadPool task#89363kavaari wants to merge 1 commit intogodotengine:masterfrom
kavaari wants to merge 1 commit intogodotengine:masterfrom
Conversation
Member
|
You used a merge commit to update your branch, please use rebase in the future instead, see here |
7d1aacb to
7acfc50
Compare
7acfc50 to
58b96c4
Compare
Member
|
@kavaari Could you look into rebasing this PR on |
Contributor
|
Hello! We replaced the previous joypad implementation on Windows (and Linux, macOS) with SDL in #106218 , so this PR now changes a file that now doesn't exist. Should this PR be closed or changed to modify SDL's code instead? |
Member
|
This was superseded by #113013. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a proposed improvement to #20566
I have the freeze issue with one of my audio devices causing huge (10s) freeze when USB device is removed / attached or when the game / editor launches, so I was able to debug this and create a workaround.
Fix the initial freeze by initializing DirectInput and enumerating devices in separate thread using the internal worker thread pool.
This doesn't completely solve the issue. Users affected need to wait for the DirectInput devices to be recognized. That can take 10+ seconds, but at least the game / app doesn't freeze. Note that this doesn't affect joypads which support XInput, those work normally and those should work immediately without waiting. Also the freeze can still happen when device is removed and attached immediately. This solution waits for the previous task to complete which then means the main thread is freezed during the wait.
This also improves the DirectInput fallback method. If XInput fails to init for some reason (dll not found), then XInput devices should fallback to DirectInput. That wasn't the case previously.