texture_cache: Change internal cache from lists to vectors
This commit is contained in:
parent
b347543e83
commit
28d7c2f5a5
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <boost/icl/interval_map.hpp>
|
#include <boost/icl/interval_map.hpp>
|
||||||
#include <boost/range/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
@ -172,7 +172,7 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const CacheAddr page = cache_addr >> registry_page_bits;
|
const CacheAddr page = cache_addr >> registry_page_bits;
|
||||||
std::list<TSurface>& list = registry[page];
|
std::vector<TSurface>& list = registry[page];
|
||||||
for (auto& s : list) {
|
for (auto& s : list) {
|
||||||
if (s->GetCacheAddr() == cache_addr) {
|
if (s->GetCacheAddr() == cache_addr) {
|
||||||
return s;
|
return s;
|
||||||
@ -482,7 +482,8 @@ private:
|
|||||||
CacheAddr start = surface->GetCacheAddr() >> registry_page_bits;
|
CacheAddr start = surface->GetCacheAddr() >> registry_page_bits;
|
||||||
const CacheAddr end = (surface->GetCacheAddrEnd() - 1) >> registry_page_bits;
|
const CacheAddr end = (surface->GetCacheAddrEnd() - 1) >> registry_page_bits;
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
registry[start].remove(surface);
|
auto& reg{registry[start]};
|
||||||
|
reg.erase(std::find(reg.begin(), reg.end(), surface));
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,7 +497,7 @@ private:
|
|||||||
const CacheAddr end = (cache_addr_end - 1) >> registry_page_bits;
|
const CacheAddr end = (cache_addr_end - 1) >> registry_page_bits;
|
||||||
std::vector<TSurface> surfaces;
|
std::vector<TSurface> surfaces;
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
std::list<TSurface>& list = registry[start];
|
std::vector<TSurface>& list = registry[start];
|
||||||
for (auto& s : list) {
|
for (auto& s : list) {
|
||||||
if (!s->IsPicked() && s->Overlaps(cache_addr, cache_addr_end)) {
|
if (!s->IsPicked() && s->Overlaps(cache_addr, cache_addr_end)) {
|
||||||
s->MarkAsPicked(true);
|
s->MarkAsPicked(true);
|
||||||
@ -553,12 +554,12 @@ private:
|
|||||||
// large in size.
|
// large in size.
|
||||||
static constexpr u64 registry_page_bits{20};
|
static constexpr u64 registry_page_bits{20};
|
||||||
static constexpr u64 registry_page_size{1 << registry_page_bits};
|
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
|
/// 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
|
/// previously been used. This is to prevent surfaces from being constantly created and
|
||||||
/// destroyed when used with different surface parameters.
|
/// 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;
|
std::array<RenderInfo, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> render_targets;
|
||||||
DepthBufferInfo depth_buffer;
|
DepthBufferInfo depth_buffer;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user