summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@googlemail.com>2012-01-31 19:58:26 +0100
committerNeoBrainX <NeoBrainX@googlemail.com>2012-01-31 19:58:32 +0100
commit013bda74ee4e7fb2615455826bd6a301ca7e7c64 (patch)
tree87157c9cf4e6f14578b864bf5c67c0c18d996288 /Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
parent04a7e33f0b629622ff851f962b9ab707f70a1b35 (diff)
parentd1605abfa98c39de0e9b9e57944f9dc864c03b42 (diff)
Merge branch 'texcache-cleanup'
Diffstat (limited to 'Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
index 39018c83bc..e59fbd496e 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
@@ -102,12 +102,12 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat)
{
- if (!isDynamic || g_ActiveConfig.bCopyEFBToTexture)
+ if (type != TCET_EC_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture)
{
g_renderer->ResetAPIState();
// stretch picture with increased internal resolution
- const D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)virtualW, (float)virtualH);
+ const D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)virtual_width, (float)virtual_height);
D3D::context->RSSetViewports(1, &vp);
// set transformation
@@ -149,17 +149,15 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
if (!g_ActiveConfig.bCopyEFBToTexture)
{
u8* dst = Memory::GetPointer(dstAddr);
- size_t encodeSize = g_encoder->Encode(dst, dstFormat, srcFormat, srcRect, isIntensity, scaleByHalf);
- hash = GetHash64(dst, encodeSize, g_ActiveConfig.iSafeTextureCache_ColorSamples);
- if (g_ActiveConfig.bEFBCopyCacheEnable)
- {
- // If the texture in RAM is already in the texture cache,
- // do not copy it again as it has not changed.
- if (TextureCache::Find(dstAddr, hash))
- return;
- }
+ size_t encoded_size = g_encoder->Encode(dst, dstFormat, srcFormat, srcRect, isIntensity, scaleByHalf);
+
+ hash = GetHash64(dst, (int)encoded_size, g_ActiveConfig.iSafeTextureCache_ColorSamples);
- TextureCache::MakeRangeDynamic(dstAddr, encodeSize);
+ // Mark texture entries in destination address range dynamic unless caching is enabled and the texture entry is up to date
+ if (!g_ActiveConfig.bEFBCopyCacheEnable)
+ TextureCache::MakeRangeDynamic(addr, (u32)encoded_size);
+ else if (!TextureCache::Find(addr, hash))
+ TextureCache::MakeRangeDynamic(addr, (u32)encoded_size);
}
}