mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-05 00:00:42 -07:00
misc: various performance clean up (#844)
## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change - Replace unnecessary precision timers with standard sleeps to reduce wakeups and background CPU usage. - Reuse buffers in raw input, touchscreen, and HID output paths to eliminate steady-state allocations. - Pre-index HID button groups and correctly process batched HID reports. No functional changes. ## Testing
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
@@ -103,6 +102,13 @@ namespace rawinput {
|
||||
std::vector<HIDTouchPoint> touch_points;
|
||||
};
|
||||
|
||||
struct HIDButtonInputGroup {
|
||||
USAGE usage_page;
|
||||
USHORT link_collection;
|
||||
std::vector<size_t> cap_indices;
|
||||
std::vector<USAGE> usages;
|
||||
};
|
||||
|
||||
struct DeviceHIDInfo {
|
||||
HANDLE handle;
|
||||
_HIDP_CAPS caps;
|
||||
@@ -125,11 +131,12 @@ namespace rawinput {
|
||||
|
||||
std::vector<std::vector<bool>> button_states;
|
||||
std::vector<std::vector<double>> button_up, button_down;
|
||||
std::vector<std::vector<uint8_t>> button_report_states;
|
||||
std::vector<std::vector<bool>> button_output_states;
|
||||
|
||||
// key: usage page, link collection
|
||||
// value: number of buttons for that key (combine ranges and nonranges)
|
||||
std::map<std::pair<USAGE, ULONG>, ULONG> button_usage_pages;
|
||||
std::vector<HIDButtonInputGroup> button_input_groups;
|
||||
std::vector<CHAR> output_report;
|
||||
std::vector<USAGE> button_output_usages;
|
||||
std::vector<USAGE> button_output_usages_off;
|
||||
|
||||
std::vector<float> value_states;
|
||||
std::vector<LONG> value_states_raw;
|
||||
|
||||
Reference in New Issue
Block a user