From e7d5f8ad5c1a018b4e0187256cd8f1b8e0b50e58 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 4 Nov 2021 12:11:51 -0700 Subject: [PATCH] TextureCacheBase: Re-wrap GetTexture comment --- Source/Core/VideoCommon/TextureCacheBase.cpp | 44 +++++++------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index c774b6d2d1..3041e30473 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1300,42 +1300,30 @@ TextureCacheBase::GetTexture(const int textureCacheSafetyColorSampleSize, Textur // Search the texture cache for textures by address // // Find all texture cache entries for the current texture address, and decide whether to use one - // of - // them, or to create a new one + // of them, or to create a new one // // In most cases, the fastest way is to use only one texture cache entry for the same address. - // Usually, - // when a texture changes, the old version of the texture is unlikely to be used again. If there - // were - // new cache entries created for normal texture updates, there would be a slowdown due to a huge - // amount - // of unused cache entries. Also thanks to texture pooling, overwriting an existing cache entry is - // faster than creating a new one from scratch. + // Usually, when a texture changes, the old version of the texture is unlikely to be used again. + // If there were new cache entries created for normal texture updates, there would be a slowdown + // due to a huge amount of unused cache entries. Also thanks to texture pooling, overwriting an + // existing cache entry is faster than creating a new one from scratch. // // Some games use the same address for different textures though. If the same cache entry was used - // in - // this case, it would be constantly overwritten, and effectively there wouldn't be any caching - // for - // those textures. Examples for this are Metroid Prime and Castlevania 3. Metroid Prime has - // multiple - // sets of fonts on each other stored in a single texture and uses the palette to make different - // characters visible or invisible. In Castlevania 3 some textures are used for 2 different things - // or - // at least in 2 different ways(size 1024x1024 vs 1024x256). + // in this case, it would be constantly overwritten, and effectively there wouldn't be any caching + // for those textures. Examples for this are Metroid Prime and Castlevania 3. Metroid Prime has + // multiple sets of fonts on each other stored in a single texture and uses the palette to make + // different characters visible or invisible. In Castlevania 3 some textures are used for 2 + // different things or at least in 2 different ways (size 1024x1024 vs 1024x256). // // To determine whether to use multiple cache entries or a single entry, use the following - // heuristic: - // If the same texture address is used several times during the same frame, assume the address is - // used - // for different purposes and allow creating an additional cache entry. If there's at least one - // entry - // that hasn't been used for the same frame, then overwrite it, in order to keep the cache as - // small as - // possible. If the current texture is found in the cache, use that entry. + // heuristic: If the same texture address is used several times during the same frame, assume the + // address is used for different purposes and allow creating an additional cache entry. If there's + // at least one entry that hasn't been used for the same frame, then overwrite it, in order to + // keep the cache as small as possible. If the current texture is found in the cache, use that + // entry. // // For efb copies, the entry created in CopyRenderTargetToTexture always has to be used, or else - // it was - // done in vain. + // it was done in vain. auto iter_range = textures_by_address.equal_range(texture_info.GetRawAddress()); TexAddrCache::iterator iter = iter_range.first; TexAddrCache::iterator oldest_entry = iter;