diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-05-10 06:10:16 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-21 02:36:12 +0200 |
commit | 28d7c2f5a5089051410d37a03d5a4a42e4230842 (patch) | |
tree | 6d6abb3269c95065d0cc1207720d374f1fdc3e25 | |
parent | Reduce amount of size calculations. (diff) | |
download | yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.gz yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.bz2 yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.lz yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.xz yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.zst yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.zip |
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index fbfd1ff0b..1c2b63dae 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -4,11 +4,11 @@ #pragma once -#include <list> #include <memory> #include <set> #include <tuple> #include <unordered_map> +#include <vector> #include <boost/icl/interval_map.hpp> #include <boost/range/iterator_range.hpp> @@ -172,7 +172,7 @@ public: return nullptr; } const CacheAddr page = cache_addr >> registry_page_bits; - std::list<TSurface>& list = registry[page]; + std::vector<TSurface>& list = registry[page]; for (auto& s : list) { if (s->GetCacheAddr() == cache_addr) { return s; @@ -482,7 +482,8 @@ private: CacheAddr start = surface->GetCacheAddr() >> registry_page_bits; const CacheAddr end = (surface->GetCacheAddrEnd() - 1) >> registry_page_bits; while (start <= end) { - registry[start].remove(surface); + auto& reg{registry[start]}; + reg.erase(std::find(reg.begin(), reg.end(), surface)); start++; } } @@ -496,7 +497,7 @@ private: const CacheAddr end = (cache_addr_end - 1) >> registry_page_bits; std::vector<TSurface> surfaces; while (start <= end) { - std::list<TSurface>& list = registry[start]; + std::vector<TSurface>& list = registry[start]; for (auto& s : list) { if (!s->IsPicked() && s->Overlaps(cache_addr, cache_addr_end)) { s->MarkAsPicked(true); @@ -553,12 +554,12 @@ private: // large in size. static constexpr u64 registry_page_bits{20}; static constexpr u64 registry_page_size{1 << registry_page_bits}; - std::unordered_map<CacheAddr, std::list<TSurface>> registry; + std::unordered_map<CacheAddr, std::vector<TSurface>> registry; /// The surface reserve is a "backup" cache, this is where we put unique surfaces that have /// previously been used. This is to prevent surfaces from being constantly created and /// destroyed when used with different surface parameters. - std::unordered_map<SurfaceParams, std::list<TSurface>> surface_reserve; + std::unordered_map<SurfaceParams, std::vector<TSurface>> surface_reserve; std::array<RenderInfo, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> render_targets; DepthBufferInfo depth_buffer; |