From 5944d15021e39f2356f7fbe1b6a935426bc0bb8a Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Tue, 28 Oct 2014 14:47:13 +0100 Subject: TextureCache: Check the number of layers before reusing a texture. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 0618b3f1b9..d4296cc2aa 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -444,14 +444,15 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, // // TODO: Don't we need to force texture decoding to RGBA8 for dynamic EFB copies? // TODO: Actually, it should be enough if the internal texture format matches... - if ((entry->type == TCET_NORMAL && + if (((entry->type == TCET_NORMAL && width == entry->virtual_width && height == entry->virtual_height && full_format == entry->format && entry->num_mipmaps > maxlevel) || (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && - entry->native_height == height)) + entry->native_height == height)) && + entry->num_layers == 1) { // reuse the texture } @@ -519,6 +520,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, // But that will currently make the above "existing entry" tests fail as "texLevels" is not calculated until after. // Currently, we might try to reuse a texture which appears to have more levels than actual, maybe.. entry->num_mipmaps = maxlevel + 1; + entry->num_layers = 1; entry->type = TCET_NORMAL; GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true); -- cgit v1.2.3 From 4d9589b35f2629c558a9a7efdee3d66497fc0fc6 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Thu, 30 Oct 2014 15:13:31 +0100 Subject: Cosmetics. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index d4296cc2aa..4037a7470b 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -452,7 +452,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && entry->native_height == height)) && - entry->num_layers == 1) + entry->num_layers == 1) { // reuse the texture } -- cgit v1.2.3 From ee76c03160b72731facbce135be26d7ef8cebba5 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Tue, 4 Nov 2014 00:53:14 +0100 Subject: TextureCache: Recompile EFB2Tex shaders when stereo 3D is toggled. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 4037a7470b..651bb90708 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -115,6 +115,12 @@ void TextureCache::OnConfigChanged(VideoConfig& config) { g_texture_cache->ClearRenderTargets(); } + + if ((config.iStereoMode > 0) != backup_config.s_stereo_3d) + { + g_texture_cache->DeleteShaders(); + g_texture_cache->CompileShaders(); + } } backup_config.s_colorsamples = config.iSafeTextureCache_ColorSamples; @@ -126,6 +132,7 @@ void TextureCache::OnConfigChanged(VideoConfig& config) backup_config.s_texfmt_overlay_center = config.bTexFmtOverlayCenter; backup_config.s_hires_textures = config.bHiresTextures; backup_config.s_copy_cache_enable = config.bEFBCopyCacheEnable; + backup_config.s_stereo_3d = config.iStereoMode > 0; } void TextureCache::Cleanup() -- cgit v1.2.3 From 8210b9c915816cf8f778db1b633f2327897af005 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Thu, 6 Nov 2014 11:41:39 +0100 Subject: TextureCache: Ensure that all render target textures have as many layers as the frame buffer. Also fixes a case where the D3D code path did not initialize num_layers leading to undefined behaviour. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 651bb90708..e057b379ad 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -538,7 +538,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, entry->Load(width, height, expandedWidth, 0); } - entry->SetGeneralParameters(address, texture_size, full_format, entry->num_mipmaps); + entry->SetGeneralParameters(address, texture_size, full_format, entry->num_mipmaps, entry->num_layers); entry->SetDimensions(nativeW, nativeH, width, height); entry->hash = tex_hash; @@ -895,12 +895,12 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat TCacheEntryBase *entry = textures[dstAddr]; if (entry) { - if (entry->type == TCET_EC_DYNAMIC && entry->native_width == tex_w && entry->native_height == tex_h) + if (entry->type == TCET_EC_DYNAMIC && entry->native_width == tex_w && entry->native_height == tex_h && entry->num_layers == FramebufferManagerBase::GetEFBLayers()) { scaled_tex_w = tex_w; scaled_tex_h = tex_h; } - else if (!(entry->type == TCET_EC_VRAM && entry->virtual_width == scaled_tex_w && entry->virtual_height == scaled_tex_h)) + else if (!(entry->type == TCET_EC_VRAM && entry->virtual_width == scaled_tex_w && entry->virtual_height == scaled_tex_h && entry->num_layers == FramebufferManagerBase::GetEFBLayers())) { if (entry->type == TCET_EC_VRAM) { @@ -923,7 +923,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat textures[dstAddr] = entry = AllocateRenderTarget(scaled_tex_w, scaled_tex_h); // TODO: Using the wrong dstFormat, dumb... - entry->SetGeneralParameters(dstAddr, 0, dstFormat, 1); + entry->SetGeneralParameters(dstAddr, 0, dstFormat, 1, FramebufferManagerBase::GetEFBLayers()); entry->SetDimensions(tex_w, tex_h, scaled_tex_w, scaled_tex_h); entry->SetHashes(TEXHASH_INVALID); entry->type = TCET_EC_VRAM; -- cgit v1.2.3 From 0f63186371c4f0bcc784fa8506d18b9514075d29 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sat, 8 Nov 2014 16:19:15 +0100 Subject: TextureCache: Add "Mono EFB Depth Copy" stereoscopy option. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index e057b379ad..7fa540022d 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -116,7 +116,8 @@ void TextureCache::OnConfigChanged(VideoConfig& config) g_texture_cache->ClearRenderTargets(); } - if ((config.iStereoMode > 0) != backup_config.s_stereo_3d) + if ((config.iStereoMode > 0) != backup_config.s_stereo_3d || + config.bStereoMonoEFBDepth != backup_config.s_mono_efb_depth) { g_texture_cache->DeleteShaders(); g_texture_cache->CompileShaders(); @@ -133,6 +134,7 @@ void TextureCache::OnConfigChanged(VideoConfig& config) backup_config.s_hires_textures = config.bHiresTextures; backup_config.s_copy_cache_enable = config.bEFBCopyCacheEnable; backup_config.s_stereo_3d = config.iStereoMode > 0; + backup_config.s_mono_efb_depth = config.bStereoMonoEFBDepth; } void TextureCache::Cleanup() -- cgit v1.2.3