summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.cpp20
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.h1
2 files changed, 19 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
index a3d6c62740..ba54adbac5 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
@@ -119,8 +119,12 @@ void TextureCache::InvalidateRange(u32 start_address, u32 size)
void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
{
TexCache::iterator
- iter = textures.begin(),
- tcend = textures.end();
+ iter = textures.lower_bound(start_address),
+ tcend = textures.upper_bound(start_address + size);
+
+ if (iter != textures.begin())
+ iter--;
+
for (; iter != tcend; ++iter)
{
const int rangePosition = iter->second->IntersectsMemoryRange(start_address, size);
@@ -131,6 +135,18 @@ void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
}
}
+bool TextureCache::Find(u32 start_address, u64 hash)
+{
+ TexCache::iterator
+ iter = textures.lower_bound(start_address),
+ tcend = textures.upper_bound(start_address);
+
+ if (iter->second->hash == hash)
+ return true;
+
+ return false;
+}
+
int TextureCache::TCacheEntryBase::IntersectsMemoryRange(u32 range_address, u32 range_size) const
{
if (addr + size_in_bytes < range_address)
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h
index 24ca3dd761..d434bec5f6 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.h
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h
@@ -77,6 +77,7 @@ public:
static void InvalidateRange(u32 start_address, u32 size);
static void MakeRangeDynamic(u32 start_address, u32 size);
static void ClearRenderTargets(); // currently only used by OGL
+ static bool Find(u32 start_address, u64 hash);
virtual TCacheEntryBase* CreateTexture(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int tex_levels, PC_TexFormat pcfmt) = 0;