Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backends: Win32: Optimized the Gamepad input processing part #8556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MidTerm-CN
Copy link

According to the official documentation of Xinput, I found that there is code that can be optimized and done.

The point of the optimization is that there is no need to add events when there is no Gamepad input, and the new code does not add events for unupdated data

Document: https://learn.microsoft.com/en-us/windows/win32/api/XInput/ns-xinput-xinput_state

@ocornut
Copy link
Owner

ocornut commented Apr 7, 2025

Hello,

Thanks for the PR. I am not sure this would be meaningful optimization given the added complexity. Did you profile the code to measure how much there was to gain? AddInputEvent() already does a backward search for the value.

However the dwPacketNumber compare seems useful and very easy to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants