From c5008fe9dea7baf3368e214fe70e148d3bcca83b Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 26 Dec 2011 17:35:27 +0100 Subject: TextureCache: Renaming some variables OGL: Fix a possible bug at texture dumping OGL: Add a TODO about a possible bug --- Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 7c741e08a9..3f12678ca4 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -90,15 +90,15 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo // Stretch picture with increased internal resolution vp.X = 0; vp.Y = 0; - vp.Width = virtualW; - vp.Height = virtualH; + vp.Width = virtual_width; + vp.Height = virtual_height; vp.MinZ = 0.0f; vp.MaxZ = 1.0f; D3D::dev->SetViewport(&vp); RECT destrect; - destrect.bottom = virtualH; + destrect.bottom = virtual_height; destrect.left = 0; - destrect.right = virtualW; + destrect.right = virtual_width; destrect.top = 0; PixelShaderManager::SetColorMatrix(colmat); // set transformation @@ -133,7 +133,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo D3D::drawShadedTexQuad(read_texture, &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(), - virtualW, virtualH, + virtual_width, virtual_height, // TODO: why is D3DFMT_D24X8 singled out here? why not D3DFMT_D24X4S4/D24S8/D24FS8/D32/D16/D15S1 too, or none of them? PixelShaderCache::GetDepthMatrixProgram(SSAAMode, (srcFormat == PIXELFMT_Z24) && bformat != FOURCC_RAWZ && bformat != D3DFMT_D24X8), VertexShaderCache::GetSimpleVertexShader(SSAAMode)); -- cgit v1.2.3 From 3b38295cbd08c98e7654e8715a88f4456cd61de5 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 27 Dec 2011 00:05:26 +0100 Subject: TextureCacheBase: De-uglify hybrid EFB copies (documentation needs updating though) TextureCacheBase: Fixed dynamic EFB copies being set to normal textures. --- Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 3f12678ca4..3bbd622c66 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -78,7 +78,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo FramebufferManager::GetEFBDepthTexture() : FramebufferManager::GetEFBColorTexture(); - if (!isDynamic || g_ActiveConfig.bCopyEFBToTexture) + if (efbcopy_state != EC_VRAM_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture) { LPDIRECT3DSURFACE9 Rendersurf = NULL; texture->GetSurfaceLevel(0, &Rendersurf); -- cgit v1.2.3 From cc54ee7d946da000b635beae03d998543a02d71d Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 30 Dec 2011 01:00:34 +0100 Subject: TextureCache: Move EFB copy cache code from TextureConverter to TextureCache --- .../Plugins/Plugin_VideoDX9/Src/TextureCache.cpp | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 3bbd622c66..bc84857795 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -21,6 +21,7 @@ #include "Statistics.h" #include "MemoryUtil.h" #include "Hash.h" +#include "HW/Memmap.h" #include "CommonPaths.h" #include "FileUtil.h" @@ -143,16 +144,25 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo if (!g_ActiveConfig.bCopyEFBToTexture) { - hash = TextureConverter::EncodeToRamFromTexture( - addr, - read_texture, - Renderer::GetTargetWidth(), - Renderer::GetTargetHeight(), - srcFormat == PIXELFMT_Z24, - isIntensity, - dstFormat, - scaleByHalf, - srcRect); + int encoded_size = TextureConverter::EncodeToRamFromTexture( + addr, + read_texture, + Renderer::GetTargetWidth(), + Renderer::GetTargetHeight(), + srcFormat == PIXELFMT_Z24, + isIntensity, + dstFormat, + scaleByHalf, + srcRect); + + u8* dst = Memory::GetPointer(addr); + hash = GetHash64(dst,encoded_size,g_ActiveConfig.iSafeTextureCache_ColorSamples); + + // 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,encoded_size); + else if (!TextureCache::Find(addr, hash)) + TextureCache::MakeRangeDynamic(addr,encoded_size); } D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER); -- cgit v1.2.3 From 1446fb33d515fc300c33afd535b22f441544b86e Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sun, 29 Jan 2012 20:24:23 +0100 Subject: TextureCacheBase: Replace the efbcopy_state member variable of texture cache entries with a more general "texture type" --- Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index bc84857795..2a3f12ddcf 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -79,7 +79,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo FramebufferManager::GetEFBDepthTexture() : FramebufferManager::GetEFBColorTexture(); - if (efbcopy_state != EC_VRAM_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture) + if (type != TCET_EC_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture) { LPDIRECT3DSURFACE9 Rendersurf = NULL; texture->GetSurfaceLevel(0, &Rendersurf); -- cgit v1.2.3