mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-27 16:26:29 +02:00
[video_core] fix redundant resize-copy overload and just use default-init resize, to reduce stutter on Mario BP (#3874)
before vs. after Mario Brothership kept remaking vectors of sizes 256 AND 4095 (TIC) and 1215 AND 524287 (TSC) every single frame, which resulted in a noticeable overhead the main cause was because of using `resize(n, c)` instead of `resize(n)` (also to aggressively resize for more room beforehand), the copy overload of resize does a copy of... well.. the value over the entire vector, additionally __append() keeps getting called because the capacity goes bonkers and all over the place   Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3874 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
parent
5ea24621cf
commit
def03f6589
12 changed files with 219 additions and 327 deletions
|
|
@ -486,27 +486,17 @@ void TouchResource::ReadTouchInput() {
|
|||
SanitizeInput(current_touch_state);
|
||||
|
||||
std::scoped_lock lock{*input_mutex};
|
||||
if (current_touch_state.entry_count == previous_touch_state.entry_count) {
|
||||
if (current_touch_state.entry_count < 1) {
|
||||
return;
|
||||
}
|
||||
if (current_touch_state.entry_count == previous_touch_state.entry_count && current_touch_state.entry_count >= 1) {
|
||||
bool has_moved = false;
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(current_touch_state.entry_count);
|
||||
i++) {
|
||||
s32 delta_x = std::abs(static_cast<s32>(current_touch_state.states[i].position.x) -
|
||||
static_cast<s32>(previous_touch_state.states[i].position.x));
|
||||
s32 delta_y = std::abs(static_cast<s32>(current_touch_state.states[i].position.y) -
|
||||
static_cast<s32>(previous_touch_state.states[i].position.y));
|
||||
if (delta_x > 1 || delta_y > 1) {
|
||||
has_moved = true;
|
||||
}
|
||||
for (std::size_t i = 0; !has_moved && i < std::size_t(current_touch_state.entry_count); i++) {
|
||||
s32 delta_x = std::abs(s32(current_touch_state.states[i].position.x) - s32(previous_touch_state.states[i].position.x));
|
||||
s32 delta_y = std::abs(s32(current_touch_state.states[i].position.y) - s32(previous_touch_state.states[i].position.y));
|
||||
has_moved |= (delta_x > 1 || delta_y > 1);
|
||||
}
|
||||
if (!has_moved) {
|
||||
return;
|
||||
if (has_moved) {
|
||||
input_event->Signal();
|
||||
}
|
||||
}
|
||||
|
||||
input_event->Signal();
|
||||
}
|
||||
|
||||
void TouchResource::OnTouchUpdate(s64 timestamp) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue