diff options
| author | Scott Mansell <phiren@gmail.com> | 2021-10-10 14:08:19 +1300 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2021-10-12 15:51:24 +1300 |
| commit | edb66dab8469736e5c2954fd3ffb9704de4542c3 (patch) | |
| tree | ee0966bea84dc6462ff83b47cb5c02442bf6eccf /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | d771bee0fee0f09f9c6eeb72d514fd9d66038b87 (diff) | |
TextureCache: Remove deleted textures from bound_textures
Fixes issue where vulkan might crash trying to bind a deleted
texture.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 9a01b57007..0f66284180 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -2552,13 +2552,21 @@ TextureCacheBase::InvalidateTexture(TexAddrCache::iterator iter, bool discard_pe for (size_t i = 0; i < bound_textures.size(); ++i) { - // If the entry is currently bound and tmem has it recorded as cached, keep it, but mark it as - // invalidated. This way it can still be used via tmem cache emulation, but nothing else. - // Spyro: A Hero's Tail is known for using such overwritten textures. - if (bound_textures[i] == entry && TMEM::IsCached(static_cast<u32>(i))) + if (bound_textures[i] == entry) { - bound_textures[i]->tmem_only = true; - return ++iter; + if (TMEM::IsCached(static_cast<u32>(i))) + { + // If the entry is currently bound and tmem has it recorded as cached, keep it, but mark it + // as invalidated. This way it can still be used via tmem cache emulation, but nothing else. + // Spyro: A Hero's Tail is known for using such overwritten textures. + bound_textures[i]->tmem_only = true; + return ++iter; + } + else + { + // Otherwise, delete the reference to it from bound_textures + bound_textures[i] = nullptr; + } } } |
