summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.h
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2016-06-16 21:51:39 +1200
committerScott Mansell <phiren@gmail.com>2016-06-17 23:46:22 +1200
commit94eaacae3036c421dcd346360c0bf835bd211469 (patch)
treed4eb497cd81d88e4ac1a3ca7a1538ac0036ddf5a /Source/Core/VideoCommon/TextureCacheBase.h
parentaa07f0903bbb7cec174371cfe53086676226c341 (diff)
TextureCache: Track efb copies used in a partially updated texture
Fixes a major preformance regression in Skies of Arcadia during battle transisions. I had plans for a more advanced version of this code after 5.0, but here is a minimal implemenation for now.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.h')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h
index e87dfc29d1..bb8dfe1111 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.h
+++ b/Source/Core/VideoCommon/TextureCacheBase.h
@@ -8,6 +8,7 @@
#include <memory>
#include <tuple>
#include <unordered_map>
+#include <unordered_set>
#include "Common/CommonTypes.h"
#include "VideoCommon/BPMemory.h"
@@ -68,6 +69,11 @@ public:
// Keep an iterator to the entry in textures_by_hash, so it does not need to be searched when removing the cache entry
std::multimap<u64, TCacheEntryBase*>::iterator textures_by_hash_iter;
+ // This is used to keep track of both:
+ // * efb copies used by this partially updated texture
+ // * partially updated textures which refer to this efb copy
+ std::unordered_set<TCacheEntryBase*> references;
+
void SetGeneralParameters(u32 _addr, u32 _size, u32 _format)
{
addr = _addr;
@@ -89,11 +95,20 @@ public:
hash = _hash;
}
+ // This texture entry is used by the other entry as a sub-texture
+ void CreateReference(TCacheEntryBase* other_entry)
+ {
+ this->references.emplace(other_entry);
+ other_entry->references.emplace(this);
+ }
+
void SetEfbCopy(u32 stride);
+ void Reset(); // Prepare for reuse
TCacheEntryBase(const TCacheEntryConfig& c) : config(c) {}
virtual ~TCacheEntryBase();
+
virtual void Bind(unsigned int stage) = 0;
virtual bool Save(const std::string& filename, unsigned int level) = 0;