summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2017-03-23 09:48:32 +0100
committerGitHub <noreply@github.com>2017-03-23 09:48:32 +0100
commit6d065a02b582368f3ae71d2683418297fec474f9 (patch)
treeb03abb573a4ec0a4a3e5fc9a90efc51e5afa0312 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent6a17d87b07dda4b31b76733e6c9dfb72c70444a7 (diff)
parentca8d9e22150a372c42fe44b4966a1fb7e73e05d8 (diff)
Merge pull request #5134 from degasus/texture_cache
TextureCache: Don't lock freed rendertargets for one frame.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 2f9b374dd6..966b30ee39 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -36,8 +36,8 @@
#include "VideoCommon/VideoConfig.h"
static const u64 TEXHASH_INVALID = 0;
-static const int TEXTURE_KILL_THRESHOLD =
- 64; // Sonic the Fighters (inside Sonic Gems Collection) loops a 64 frames animation
+// Sonic the Fighters (inside Sonic Gems Collection) loops a 64 frames animation
+static const int TEXTURE_KILL_THRESHOLD = 64;
static const int TEXTURE_POOL_KILL_THRESHOLD = 3;
static const int FRAMECOUNT_INVALID = 0;
@@ -1374,9 +1374,11 @@ TextureCacheBase::FindMatchingTextureFromPool(const TCacheEntryConfig& config)
// Find a texture from the pool that does not have a frameCount of FRAMECOUNT_INVALID.
// This prevents a texture from being used twice in a single frame with different data,
// which potentially means that a driver has to maintain two copies of the texture anyway.
+ // Render-target textures are fine through, as they have to be generated in a seperated pass.
+ // As non-render-target textures are usually static, this should not matter much.
auto range = texture_pool.equal_range(config);
auto matching_iter = std::find_if(range.first, range.second, [](const auto& iter) {
- return iter.second->frameCount != FRAMECOUNT_INVALID;
+ return iter.first.rendertarget || iter.second->frameCount != FRAMECOUNT_INVALID;
});
return matching_iter != range.second ? matching_iter : texture_pool.end();
}