[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

@ -90,7 +90,7 @@ void ComputePipeline::Configure() {
desc.is_written);
++ssbo_index;
}
texture_cache.SynchronizeComputeDescriptors();
texture_cache.SynchronizeDescriptors(true);
boost::container::static_vector<VideoCommon::ImageViewInOut, MAX_TEXTURES + MAX_IMAGES> views;
boost::container::static_vector<VideoCommon::SamplerId, MAX_TEXTURES> samplers;
@ -148,14 +148,14 @@ void ComputePipeline::Configure() {
const auto handle{read_handle(desc, index)};
views.push_back({handle.first});
VideoCommon::SamplerId sampler = texture_cache.GetComputeSamplerId(handle.second);
VideoCommon::SamplerId sampler = texture_cache.GetSamplerId(handle.second, true);
samplers.push_back(sampler);
}
}
for (const auto& desc : info.image_descriptors) {
add_image(desc, desc.is_written);
}
texture_cache.FillComputeImageViews(std::span(views.data(), views.size()));
texture_cache.FillImageViews(std::span(views.data(), views.size()), true);
if (!is_built) {
WaitForBuild();

View file

@ -283,7 +283,7 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
size_t views_index{};
size_t samplers_index{};
texture_cache.SynchronizeGraphicsDescriptors();
texture_cache.SynchronizeDescriptors(false);
buffer_cache.SetUniformBuffersState(enabled_uniform_buffer_masks, &uniform_buffer_sizes);
buffer_cache.runtime.SetBaseUniformBindings(base_uniform_bindings);
@ -354,7 +354,7 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
const auto handle{read_handle(desc, index)};
views[views_index++] = {handle.first};
VideoCommon::SamplerId sampler{texture_cache.GetGraphicsSamplerId(handle.second)};
VideoCommon::SamplerId sampler{texture_cache.GetSamplerId(handle.second, false)};
samplers[samplers_index++] = sampler;
}
}
@ -379,7 +379,7 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
if constexpr (Spec::enabled_stages[4]) {
config_stage(4);
}
texture_cache.FillGraphicsImageViews<Spec::has_images>(std::span(views.data(), views_index));
texture_cache.FillImageViews(std::span(views.data(), views_index), false, Spec::has_images);
texture_cache.UpdateRenderTargets(false);
state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle());

View file

@ -353,13 +353,13 @@ void RasterizerOpenGL::DrawTexture() {
gpu.TickWork();
};
texture_cache.SynchronizeGraphicsDescriptors();
texture_cache.SynchronizeDescriptors(false);
texture_cache.UpdateRenderTargets(false);
SyncState();
const auto& draw_texture_state = maxwell3d->draw_manager.draw_texture_state;
const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler);
const auto& sampler = texture_cache.GetSampler(draw_texture_state.src_sampler, true);
const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture);
const auto Scale = [&](auto dim) -> s32 {