From ffddfd8662bda4fedcfcc8cad73f02bd7a522925 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 22 Dec 2012 17:30:13 +0100 Subject: do only invalid hashes instead of all textures on loading this is a hack, but only the gpu thread is allowed to call ogl commands suggestion: create an unused texture cache, so we can move all textures there --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source/Core/VideoCommon/Src/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 7c47c35bb6..2bcaead19c 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -72,6 +72,18 @@ void TextureCache::Invalidate() textures.clear(); } +// this function is dirty hack to work around a OGL bug. +// it is only used on loading states. It will work for normal textures, +// but for efb2ram, it wouldn't be checked. So there may be glitches on loading +void TextureCache::InvalidateHashes() +{ + TexCache::iterator + iter = textures.begin(), + tcend = textures.end(); + for (; iter != tcend; ++iter) + iter->second->hash = TEXHASH_INVALID; +} + TextureCache::~TextureCache() { Invalidate(); -- cgit v1.2.3 From bd0abb3d2fe5047554bb6b87fa8e3f6aa3f42e0b Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 23 Dec 2012 13:32:23 +0100 Subject: revert last commit, add CheckInvalidState to VideoBackend --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'Source/Core/VideoCommon/Src/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 2bcaead19c..7c47c35bb6 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -72,18 +72,6 @@ void TextureCache::Invalidate() textures.clear(); } -// this function is dirty hack to work around a OGL bug. -// it is only used on loading states. It will work for normal textures, -// but for efb2ram, it wouldn't be checked. So there may be glitches on loading -void TextureCache::InvalidateHashes() -{ - TexCache::iterator - iter = textures.begin(), - tcend = textures.end(); - for (; iter != tcend; ++iter) - iter->second->hash = TEXHASH_INVALID; -} - TextureCache::~TextureCache() { Invalidate(); -- cgit v1.2.3 From 5a7835103337d754248cda10f9d938765fd28535 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Wed, 19 Dec 2012 16:55:44 +0100 Subject: TextureCacheBase: Fix a potential bug when using custom textures. --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/Src/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 7c47c35bb6..9fc18ef1bd 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -377,7 +377,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int 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 && width == entry->native_width && height == entry->native_height && full_format == entry->format && entry->num_mipmaps == maxlevel) + 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)) { // reuse the texture @@ -396,14 +396,21 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, pcfmt = LoadCustomTexture(tex_hash, texformat, 0, width, height); if (pcfmt != PC_TEX_FMT_NONE) { - expandedWidth = width; - expandedHeight = height; + if (expandedWidth != width || expandedHeight != height) + { + expandedWidth = width; + expandedHeight = height; + + // If we thought we could reuse the texture before, make sure to delete it now! + delete entry; + entry = NULL; + } using_custom_texture = true; } } - // TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems when preloading is enabled - if (pcfmt == PC_TEX_FMT_NONE) + // TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems here when preloading is enabled + if (!using_custom_texture) pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); -- cgit v1.2.3