summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2019-10-15 19:29:00 -0400
committerGravatar Lioncash2019-10-15 19:31:33 -0400
commita24e8bf9cf0ca37d29ef44c441dc132885c82a6f (patch)
tree6bb844ba484679499c33587bc3c253901c79e9fe
parentMerge pull request #2977 from lioncash/algorithm (diff)
downloadyuzu-a24e8bf9cf0ca37d29ef44c441dc132885c82a6f.tar.gz
yuzu-a24e8bf9cf0ca37d29ef44c441dc132885c82a6f.tar.xz
yuzu-a24e8bf9cf0ca37d29ef44c441dc132885c82a6f.zip
texture_cache: Avoid unnecessary surface copies within PickStrategy() and TryReconstructSurface()
We can take these by const reference and avoid making unnecessary copies, preventing some atomic reference count increments and decrements.
-rw-r--r--src/video_core/texture_cache/texture_cache.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index ca2da8f97..0a23114f9 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -402,7 +402,7 @@ private:
402 if (params.block_depth > 1 || params.target == SurfaceTarget::Texture3D) { 402 if (params.block_depth > 1 || params.target == SurfaceTarget::Texture3D) {
403 return RecycleStrategy::Flush; 403 return RecycleStrategy::Flush;
404 } 404 }
405 for (auto s : overlaps) { 405 for (const auto& s : overlaps) {
406 const auto& s_params = s->GetSurfaceParams(); 406 const auto& s_params = s->GetSurfaceParams();
407 if (s_params.block_depth > 1 || s_params.target == SurfaceTarget::Texture3D) { 407 if (s_params.block_depth > 1 || s_params.target == SurfaceTarget::Texture3D) {
408 return RecycleStrategy::Flush; 408 return RecycleStrategy::Flush;
@@ -575,7 +575,7 @@ private:
575 } else if (Settings::values.use_accurate_gpu_emulation && passed_tests != overlaps.size()) { 575 } else if (Settings::values.use_accurate_gpu_emulation && passed_tests != overlaps.size()) {
576 return {}; 576 return {};
577 } 577 }
578 for (auto surface : overlaps) { 578 for (const auto& surface : overlaps) {
579 Unregister(surface); 579 Unregister(surface);
580 } 580 }
581 new_surface->MarkAsModified(modified, Tick()); 581 new_surface->MarkAsModified(modified, Tick());