summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
diff options
context:
space:
mode:
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);
}
}