summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-05-10 01:10:16 -0300
committerGravatar ReinUsesLisp2019-06-20 21:36:12 -0300
commit28d7c2f5a5089051410d37a03d5a4a42e4230842 (patch)
tree6d6abb3269c95065d0cc1207720d374f1fdc3e25 /src
parentReduce amount of size calculations. (diff)
downloadyuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.gz
yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.tar.xz
yuzu-28d7c2f5a5089051410d37a03d5a4a42e4230842.zip
texture_cache: Change internal cache from lists to vectors
Diffstat (limited to 'src')
-rw-r--r--src/video_core/texture_cache/texture_cache.h13
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 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <list>
8#include <memory> 7#include <memory>
9#include <set> 8#include <set>
10#include <tuple> 9#include <tuple>
11#include <unordered_map> 10#include <unordered_map>
11#include <vector>
12 12
13#include <boost/icl/interval_map.hpp> 13#include <boost/icl/interval_map.hpp>
14#include <boost/range/iterator_range.hpp> 14#include <boost/range/iterator_range.hpp>
@@ -172,7 +172,7 @@ public:
172 return nullptr; 172 return nullptr;
173 } 173 }
174 const CacheAddr page = cache_addr >> registry_page_bits; 174 const CacheAddr page = cache_addr >> registry_page_bits;
175 std::list<TSurface>& list = registry[page]; 175 std::vector<TSurface>& list = registry[page];
176 for (auto& s : list) { 176 for (auto& s : list) {
177 if (s->GetCacheAddr() == cache_addr) { 177 if (s->GetCacheAddr() == cache_addr) {
178 return s; 178 return s;
@@ -482,7 +482,8 @@ private:
482 CacheAddr start = surface->GetCacheAddr() >> registry_page_bits; 482 CacheAddr start = surface->GetCacheAddr() >> registry_page_bits;
483 const CacheAddr end = (surface->GetCacheAddrEnd() - 1) >> registry_page_bits; 483 const CacheAddr end = (surface->GetCacheAddrEnd() - 1) >> registry_page_bits;
484 while (start <= end) { 484 while (start <= end) {
485 registry[start].remove(surface); 485 auto& reg{registry[start]};
486 reg.erase(std::find(reg.begin(), reg.end(), surface));
486 start++; 487 start++;
487 } 488 }
488 } 489 }
@@ -496,7 +497,7 @@ private:
496 const CacheAddr end = (cache_addr_end - 1) >> registry_page_bits; 497 const CacheAddr end = (cache_addr_end - 1) >> registry_page_bits;
497 std::vector<TSurface> surfaces; 498 std::vector<TSurface> surfaces;
498 while (start <= end) { 499 while (start <= end) {
499 std::list<TSurface>& list = registry[start]; 500 std::vector<TSurface>& list = registry[start];
500 for (auto& s : list) { 501 for (auto& s : list) {
501 if (!s->IsPicked() && s->Overlaps(cache_addr, cache_addr_end)) { 502 if (!s->IsPicked() && s->Overlaps(cache_addr, cache_addr_end)) {
502 s->MarkAsPicked(true); 503 s->MarkAsPicked(true);
@@ -553,12 +554,12 @@ private:
553 // large in size. 554 // large in size.
554 static constexpr u64 registry_page_bits{20}; 555 static constexpr u64 registry_page_bits{20};
555 static constexpr u64 registry_page_size{1 << registry_page_bits}; 556 static constexpr u64 registry_page_size{1 << registry_page_bits};
556 std::unordered_map<CacheAddr, std::list<TSurface>> registry; 557 std::unordered_map<CacheAddr, std::vector<TSurface>> registry;
557 558
558 /// The surface reserve is a "backup" cache, this is where we put unique surfaces that have 559 /// The surface reserve is a "backup" cache, this is where we put unique surfaces that have
559 /// previously been used. This is to prevent surfaces from being constantly created and 560 /// previously been used. This is to prevent surfaces from being constantly created and
560 /// destroyed when used with different surface parameters. 561 /// destroyed when used with different surface parameters.
561 std::unordered_map<SurfaceParams, std::list<TSurface>> surface_reserve; 562 std::unordered_map<SurfaceParams, std::vector<TSurface>> surface_reserve;
562 std::array<RenderInfo, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> render_targets; 563 std::array<RenderInfo, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> render_targets;
563 DepthBufferInfo depth_buffer; 564 DepthBufferInfo depth_buffer;
564 565