[video_core] fix redundant resize-copy overload and just use default-init resize, to reduce stutter on Mario BP (#3874)
Some checks are pending
tx-src / sources (push) Waiting to run
Check Strings / check-strings (push) Waiting to run

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

![image](/attachments/e3ba07fb-1c85-4d56-9b81-bb16a8150c15)
![image](/attachments/5c4eba26-015a-4c95-9b24-b41695a62e51)

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:
lizzie 2026-05-29 03:28:47 +02:00 committed by crueter
parent 5ea24621cf
commit def03f6589
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
12 changed files with 219 additions and 327 deletions

View file

@ -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) {