TextureCacheBase: Add m_ prefix to member variables

This commit is contained in:
Dentomologist 2023-09-01 22:50:48 -07:00
parent 5e5887a378
commit d5d3eb5025
2 changed files with 117 additions and 117 deletions

View file

@ -81,23 +81,23 @@ TCacheEntry::~TCacheEntry()
void TextureCacheBase::CheckTempSize(size_t required_size)
{
if (required_size <= temp_size)
if (required_size <= m_temp_size)
return;
temp_size = required_size;
Common::FreeAlignedMemory(temp);
temp = static_cast<u8*>(Common::AllocateAlignedMemory(temp_size, 16));
m_temp_size = required_size;
Common::FreeAlignedMemory(m_temp);
m_temp = static_cast<u8*>(Common::AllocateAlignedMemory(m_temp_size, 16));
}
TextureCacheBase::TextureCacheBase()
{
SetBackupConfig(g_ActiveConfig);
temp_size = 2048 * 2048 * 4;
temp = static_cast<u8*>(Common::AllocateAlignedMemory(temp_size, 16));
m_temp_size = 2048 * 2048 * 4;
m_temp = static_cast<u8*>(Common::AllocateAlignedMemory(m_temp_size, 16));
TexDecoder_SetTexFmtOverlayOptions(backup_config.texfmt_overlay,
backup_config.texfmt_overlay_center);
TexDecoder_SetTexFmtOverlayOptions(m_backup_config.texfmt_overlay,
m_backup_config.texfmt_overlay_center);
HiresTexture::Init();
@ -117,8 +117,8 @@ void TextureCacheBase::Shutdown()
TextureCacheBase::~TextureCacheBase()
{
Common::FreeAlignedMemory(temp);
temp = nullptr;
Common::FreeAlignedMemory(m_temp);
m_temp = nullptr;
}
bool TextureCacheBase::Initialize()
@ -137,18 +137,18 @@ void TextureCacheBase::Invalidate()
FlushEFBCopies();
TMEM::InvalidateAll();
for (auto& bind : bound_textures)
for (auto& bind : m_bound_textures)
bind.reset();
textures_by_hash.clear();
textures_by_address.clear();
m_textures_by_hash.clear();
m_textures_by_address.clear();
texture_pool.clear();
m_texture_pool.clear();
}
void TextureCacheBase::OnConfigChanged(const VideoConfig& config)
{
if (config.bHiresTextures != backup_config.hires_textures ||
config.bCacheHiresTextures != backup_config.cache_hires_textures)
if (config.bHiresTextures != m_backup_config.hires_textures ||
config.bCacheHiresTextures != m_backup_config.cache_hires_textures)
{
HiresTexture::Update();
}
@ -157,15 +157,15 @@ void TextureCacheBase::OnConfigChanged(const VideoConfig& config)
config.graphics_mod_config ? config.graphics_mod_config->GetChangeCount() : 0;
// TODO: Invalidating texcache is really stupid in some of these cases
if (config.iSafeTextureCache_ColorSamples != backup_config.color_samples ||
config.bTexFmtOverlayEnable != backup_config.texfmt_overlay ||
config.bTexFmtOverlayCenter != backup_config.texfmt_overlay_center ||
config.bHiresTextures != backup_config.hires_textures ||
config.bEnableGPUTextureDecoding != backup_config.gpu_texture_decoding ||
config.bDisableCopyToVRAM != backup_config.disable_vram_copies ||
config.bArbitraryMipmapDetection != backup_config.arbitrary_mipmap_detection ||
config.bGraphicMods != backup_config.graphics_mods ||
change_count != backup_config.graphics_mod_change_count)
if (config.iSafeTextureCache_ColorSamples != m_backup_config.color_samples ||
config.bTexFmtOverlayEnable != m_backup_config.texfmt_overlay ||
config.bTexFmtOverlayCenter != m_backup_config.texfmt_overlay_center ||
config.bHiresTextures != m_backup_config.hires_textures ||
config.bEnableGPUTextureDecoding != m_backup_config.gpu_texture_decoding ||
config.bDisableCopyToVRAM != m_backup_config.disable_vram_copies ||
config.bArbitraryMipmapDetection != m_backup_config.arbitrary_mipmap_detection ||
config.bGraphicMods != m_backup_config.graphics_mods ||
change_count != m_backup_config.graphics_mod_change_count)
{
Invalidate();
TexDecoder_SetTexFmtOverlayOptions(config.bTexFmtOverlayEnable, config.bTexFmtOverlayCenter);
@ -176,8 +176,8 @@ void TextureCacheBase::OnConfigChanged(const VideoConfig& config)
void TextureCacheBase::Cleanup(int _frameCount)
{
TexAddrCache::iterator iter = textures_by_address.begin();
TexAddrCache::iterator tcend = textures_by_address.end();
TexAddrCache::iterator iter = m_textures_by_address.begin();
TexAddrCache::iterator tcend = m_textures_by_address.end();
while (iter != tcend)
{
if (iter->second->frameCount == FRAMECOUNT_INVALID)
@ -214,8 +214,8 @@ void TextureCacheBase::Cleanup(int _frameCount)
}
}
TexPool::iterator iter2 = texture_pool.begin();
TexPool::iterator tcend2 = texture_pool.end();
TexPool::iterator iter2 = m_texture_pool.begin();
TexPool::iterator tcend2 = m_texture_pool.end();
while (iter2 != tcend2)
{
if (iter2->second.frameCount == FRAMECOUNT_INVALID)
@ -224,7 +224,7 @@ void TextureCacheBase::Cleanup(int _frameCount)
}
if (_frameCount > TEXTURE_POOL_KILL_THRESHOLD + iter2->second.frameCount)
{
iter2 = texture_pool.erase(iter2);
iter2 = m_texture_pool.erase(iter2);
}
else
{
@ -246,18 +246,18 @@ bool TCacheEntry::OverlapsMemoryRange(u32 range_address, u32 range_size) const
void TextureCacheBase::SetBackupConfig(const VideoConfig& config)
{
backup_config.color_samples = config.iSafeTextureCache_ColorSamples;
backup_config.texfmt_overlay = config.bTexFmtOverlayEnable;
backup_config.texfmt_overlay_center = config.bTexFmtOverlayCenter;
backup_config.hires_textures = config.bHiresTextures;
backup_config.cache_hires_textures = config.bCacheHiresTextures;
backup_config.stereo_3d = config.stereo_mode != StereoMode::Off;
backup_config.efb_mono_depth = config.bStereoEFBMonoDepth;
backup_config.gpu_texture_decoding = config.bEnableGPUTextureDecoding;
backup_config.disable_vram_copies = config.bDisableCopyToVRAM;
backup_config.arbitrary_mipmap_detection = config.bArbitraryMipmapDetection;
backup_config.graphics_mods = config.bGraphicMods;
backup_config.graphics_mod_change_count =
m_backup_config.color_samples = config.iSafeTextureCache_ColorSamples;
m_backup_config.texfmt_overlay = config.bTexFmtOverlayEnable;
m_backup_config.texfmt_overlay_center = config.bTexFmtOverlayCenter;
m_backup_config.hires_textures = config.bHiresTextures;
m_backup_config.cache_hires_textures = config.bCacheHiresTextures;
m_backup_config.stereo_3d = config.stereo_mode != StereoMode::Off;
m_backup_config.efb_mono_depth = config.bStereoEFBMonoDepth;
m_backup_config.gpu_texture_decoding = config.bEnableGPUTextureDecoding;
m_backup_config.disable_vram_copies = config.bDisableCopyToVRAM;
m_backup_config.arbitrary_mipmap_detection = config.bArbitraryMipmapDetection;
m_backup_config.graphics_mods = config.bGraphicMods;
m_backup_config.graphics_mod_change_count =
config.graphics_mod_config ? config.graphics_mod_config->GetChangeCount() : 0;
}
@ -348,7 +348,7 @@ RcTcacheEntry TextureCacheBase::ApplyPaletteToEntry(RcTcacheEntry& entry, const
g_gfx->EndUtilityDrawing();
}
textures_by_address.emplace(decoded_entry->addr, decoded_entry);
m_textures_by_address.emplace(decoded_entry->addr, decoded_entry);
return decoded_entry;
}
@ -394,7 +394,7 @@ RcTcacheEntry TextureCacheBase::ReinterpretEntry(const RcTcacheEntry& existing_e
g_gfx->EndUtilityDrawing();
reinterpreted_entry->texture->FinishedRendering();
textures_by_address.emplace(reinterpreted_entry->addr, reinterpreted_entry);
m_textures_by_address.emplace(reinterpreted_entry->addr, reinterpreted_entry);
return reinterpreted_entry;
}
@ -431,7 +431,7 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(RcTcacheEntry& entry, u32 new_wi
// At this point new_texture has the old texture in it,
// we can potentially reuse this, so let's move it back to the pool
auto config = new_texture->texture->GetConfig();
texture_pool.emplace(
m_texture_pool.emplace(
config, TexPoolEntry(std::move(new_texture->texture), std::move(new_texture->framebuffer)));
}
@ -562,7 +562,7 @@ void TextureCacheBase::DoState(PointerWrap& p)
// Flush all pending XFB copies before either loading or saving.
FlushEFBCopies();
p.Do(last_entry_id);
p.Do(m_last_entry_id);
if (p.IsWriteMode() || p.IsMeasureMode())
DoSaveState(p);
@ -601,14 +601,14 @@ void TextureCacheBase::DoSaveState(PointerWrap& p)
return iter != entry_map.end() ? std::make_optional(iter->second) : std::nullopt;
};
// Transform the textures_by_address and textures_by_hash maps to a mapping
// Transform the m_textures_by_address and m_textures_by_hash maps to a mapping
// of address/hash to entry ID.
std::vector<std::pair<u32, u32>> textures_by_address_list;
std::vector<std::pair<u64, u32>> textures_by_hash_list;
std::vector<std::pair<u32, u32>> bound_textures_list;
if (Config::Get(Config::GFX_SAVE_TEXTURE_CACHE_TO_STATE))
{
for (const auto& it : textures_by_address)
for (const auto& it : m_textures_by_address)
{
if (ShouldSaveEntry(it.second))
{
@ -616,7 +616,7 @@ void TextureCacheBase::DoSaveState(PointerWrap& p)
textures_by_address_list.emplace_back(it.first, id);
}
}
for (const auto& it : textures_by_hash)
for (const auto& it : m_textures_by_hash)
{
if (ShouldSaveEntry(it.second))
{
@ -624,10 +624,10 @@ void TextureCacheBase::DoSaveState(PointerWrap& p)
textures_by_hash_list.emplace_back(it.first, id);
}
}
for (u32 i = 0; i < bound_textures.size(); i++)
for (u32 i = 0; i < m_bound_textures.size(); i++)
{
const auto& tentry = bound_textures[i];
if (bound_textures[i] && ShouldSaveEntry(tentry))
const auto& tentry = m_bound_textures[i];
if (m_bound_textures[i] && ShouldSaveEntry(tentry))
{
const u32 id = AddCacheEntryToMap(tentry);
bound_textures_list.emplace_back(i, id);
@ -715,7 +715,7 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
auto tex = DeserializeTexture(p);
auto entry =
std::make_shared<TCacheEntry>(std::move(tex->texture), std::move(tex->framebuffer));
entry->textures_by_hash_iter = textures_by_hash.end();
entry->textures_by_hash_iter = m_textures_by_hash.end();
entry->DoState(p);
if (entry->texture && commit_state)
id_map.emplace(i, entry);
@ -746,7 +746,7 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
auto& entry = GetEntry(id);
if (entry)
textures_by_address.emplace(addr, entry);
m_textures_by_address.emplace(addr, entry);
}
// Fill in hash map.
@ -760,12 +760,12 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
auto& entry = GetEntry(id);
if (entry)
entry->textures_by_hash_iter = textures_by_hash.emplace(hash, entry);
entry->textures_by_hash_iter = m_textures_by_hash.emplace(hash, entry);
}
// Clear bound textures
for (u32 i = 0; i < bound_textures.size(); i++)
bound_textures[i].reset();
for (u32 i = 0; i < m_bound_textures.size(); i++)
m_bound_textures[i].reset();
// Fill in bound textures
p.Do(size);
@ -778,7 +778,7 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
auto& entry = GetEntry(id);
if (entry)
bound_textures[index] = entry;
m_bound_textures[index] = entry;
}
}
@ -1114,9 +1114,9 @@ void TextureCacheBase::BindTextures(BitSet32 used_textures)
{
auto& system = Core::System::GetInstance();
auto& pixel_shader_manager = system.GetPixelShaderManager();
for (u32 i = 0; i < bound_textures.size(); i++)
for (u32 i = 0; i < m_bound_textures.size(); i++)
{
const RcTcacheEntry& tentry = bound_textures[i];
const RcTcacheEntry& tentry = m_bound_textures[i];
if (used_textures[i] && tentry)
{
g_gfx->SetTexture(i, tentry->texture.get());
@ -1295,9 +1295,9 @@ TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool fo
{
// if this stage was not invalidated by changes to texture registers, keep the current texture
if (!force_reload && TMEM::IsValid(texture_info.GetStage()) &&
bound_textures[texture_info.GetStage()])
m_bound_textures[texture_info.GetStage()])
{
TCacheEntry* entry = bound_textures[texture_info.GetStage()].get();
TCacheEntry* entry = m_bound_textures[texture_info.GetStage()].get();
// If the TMEM configuration is such that this texture is more or less guaranteed to still
// be in TMEM, then we know we can reuse the old entry without even hashing the memory
//
@ -1337,7 +1337,7 @@ TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool fo
action->OnTextureLoad(&texture_load);
}
}
bound_textures[texture_info.GetStage()] = entry;
m_bound_textures[texture_info.GetStage()] = entry;
// We need to keep track of invalided textures until they have actually been replaced or
// re-loaded
@ -1427,12 +1427,12 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
//
// For efb copies, the entry created in CopyRenderTargetToTexture always has to be used, or else
// it was done in vain.
auto iter_range = textures_by_address.equal_range(texture_info.GetRawAddress());
auto iter_range = m_textures_by_address.equal_range(texture_info.GetRawAddress());
TexAddrCache::iterator iter = iter_range.first;
TexAddrCache::iterator oldest_entry = iter;
int temp_frameCount = 0x7fffffff;
TexAddrCache::iterator unconverted_copy = textures_by_address.end();
TexAddrCache::iterator unreinterpreted_copy = textures_by_address.end();
TexAddrCache::iterator unconverted_copy = m_textures_by_address.end();
TexAddrCache::iterator unreinterpreted_copy = m_textures_by_address.end();
while (iter != iter_range.second)
{
@ -1482,7 +1482,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
else
{
// Prefer the already-converted copy.
unconverted_copy = textures_by_address.end();
unconverted_copy = m_textures_by_address.end();
}
// TODO: We should check width/height/levels for EFB copies. I'm not sure what effect
@ -1540,7 +1540,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
++iter;
}
if (unreinterpreted_copy != textures_by_address.end())
if (unreinterpreted_copy != m_textures_by_address.end())
{
auto decoded_entry =
ReinterpretEntry(unreinterpreted_copy->second, texture_info.GetTextureFormat());
@ -1554,7 +1554,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
return decoded_entry;
}
if (unconverted_copy != textures_by_address.end())
if (unconverted_copy != m_textures_by_address.end())
{
auto decoded_entry = ApplyPaletteToEntry(
unconverted_copy->second, texture_info.GetTlutAddress(), texture_info.GetTlutFormat());
@ -1575,7 +1575,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
std::max(texture_info.GetTextureSize(), palette_size) <=
(u32)textureCacheSafetyColorSampleSize * 8)
{
auto hash_range = textures_by_hash.equal_range(full_hash);
auto hash_range = m_textures_by_hash.equal_range(full_hash);
TexHashCache::iterator hash_iter = hash_range.first;
while (hash_iter != hash_range.second)
{
@ -1777,7 +1777,7 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
total_texture_size += mip_downsample_buffer_size;
CheckTempSize(total_texture_size);
dst_buffer = temp;
dst_buffer = m_temp;
if (!(texture_info.GetTextureFormat() == TextureFormat::RGBA8 && texture_info.IsFromTmem()))
{
TexDecoder_Decode(dst_buffer, texture_info.GetData(), expanded_width, expanded_height,
@ -1841,12 +1841,12 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
}
}
const auto iter = textures_by_address.emplace(texture_info.GetRawAddress(), entry);
const auto iter = m_textures_by_address.emplace(texture_info.GetRawAddress(), entry);
if (safety_color_sample_size == 0 ||
std::max(texture_info.GetTextureSize(), creation_info.palette_size) <=
(u32)safety_color_sample_size * 8)
{
entry->textures_by_hash_iter = textures_by_hash.emplace(creation_info.full_hash, entry);
entry->textures_by_hash_iter = m_textures_by_hash.emplace(creation_info.full_hash, entry);
}
const TextureAndTLUTFormat full_format(texture_info.GetTextureFormat(),
@ -1860,7 +1860,7 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
entry->SetNotCopy();
INCSTAT(g_stats.num_textures_uploaded);
SETSTAT(g_stats.num_textures_alive, static_cast<int>(textures_by_address.size()));
SETSTAT(g_stats.num_textures_alive, static_cast<int>(m_textures_by_address.size()));
entry = DoPartialTextureUpdates(iter->second, texture_info.GetTlutAddress(),
texture_info.GetTlutFormat());
@ -1930,8 +1930,8 @@ RcTcacheEntry TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height
{
const u32 decoded_size = width * height * sizeof(u32);
CheckTempSize(decoded_size);
TexDecoder_DecodeXFB(temp, src_data, width, height, stride);
entry->texture->Load(0, width, height, width, temp, decoded_size);
TexDecoder_DecodeXFB(m_temp, src_data, width, height, stride);
entry->texture->Load(0, width, height, width, m_temp, decoded_size);
}
// Stitch any VRAM copies into the new RAM copy.
@ -1939,8 +1939,8 @@ RcTcacheEntry TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height
entry->texture->FinishedRendering();
// Insert into the texture cache so we can re-use it next frame, if needed.
textures_by_address.emplace(entry->addr, entry);
SETSTAT(g_stats.num_textures_alive, static_cast<int>(textures_by_address.size()));
m_textures_by_address.emplace(entry->addr, entry);
SETSTAT(g_stats.num_textures_alive, static_cast<int>(m_textures_by_address.size()));
INCSTAT(g_stats.num_textures_uploaded);
if (g_ActiveConfig.bDumpXFBTarget || g_ActiveConfig.bGraphicMods)
@ -1965,7 +1965,7 @@ RcTcacheEntry TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height
RcTcacheEntry TextureCacheBase::GetXFBFromCache(u32 address, u32 width, u32 height, u32 stride)
{
auto iter_range = textures_by_address.equal_range(address);
auto iter_range = m_textures_by_address.equal_range(address);
TexAddrCache::iterator iter = iter_range.first;
while (iter != iter_range.second)
@ -2526,10 +2526,10 @@ void TextureCacheBase::CopyRenderTargetToTexture(
// Do not load textures by hash, if they were at least partly overwritten by an efb copy.
// In this case, comparing the hash is not enough to check, if two textures are identical.
if (overlapping_entry->textures_by_hash_iter != textures_by_hash.end())
if (overlapping_entry->textures_by_hash_iter != m_textures_by_hash.end())
{
textures_by_hash.erase(overlapping_entry->textures_by_hash_iter);
overlapping_entry->textures_by_hash_iter = textures_by_hash.end();
m_textures_by_hash.erase(overlapping_entry->textures_by_hash_iter);
overlapping_entry->textures_by_hash_iter = m_textures_by_hash.end();
}
}
++iter.first;
@ -2553,7 +2553,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
{
const u64 hash = entry->CalculateHash();
entry->SetHashes(hash, hash);
textures_by_address.emplace(dstAddr, std::move(entry));
m_textures_by_address.emplace(dstAddr, std::move(entry));
}
}
@ -2569,10 +2569,10 @@ void TextureCacheBase::FlushEFBCopies()
void TextureCacheBase::FlushStaleBinds()
{
for (u32 i = 0; i < bound_textures.size(); i++)
for (u32 i = 0; i < m_bound_textures.size(); i++)
{
if (!TMEM::IsCached(i))
bound_textures[i].reset();
m_bound_textures[i].reset();
}
}
@ -2709,8 +2709,8 @@ RcTcacheEntry TextureCacheBase::AllocateCacheEntry(const TextureConfig& config)
auto cacheEntry =
std::make_shared<TCacheEntry>(std::move(alloc->texture), std::move(alloc->framebuffer));
cacheEntry->textures_by_hash_iter = textures_by_hash.end();
cacheEntry->id = last_entry_id++;
cacheEntry->textures_by_hash_iter = m_textures_by_hash.end();
cacheEntry->id = m_last_entry_id++;
return cacheEntry;
}
@ -2718,10 +2718,10 @@ std::optional<TextureCacheBase::TexPoolEntry>
TextureCacheBase::AllocateTexture(const TextureConfig& config)
{
TexPool::iterator iter = FindMatchingTextureFromPool(config);
if (iter != texture_pool.end())
if (iter != m_texture_pool.end())
{
auto entry = std::move(iter->second);
texture_pool.erase(iter);
m_texture_pool.erase(iter);
return std::move(entry);
}
@ -2757,16 +2757,16 @@ TextureCacheBase::FindMatchingTextureFromPool(const TextureConfig& config)
// which potentially means that a driver has to maintain two copies of the texture anyway.
// Render-target textures are fine through, as they have to be generated in a seperated pass.
// As non-render-target textures are usually static, this should not matter much.
auto range = texture_pool.equal_range(config);
auto range = m_texture_pool.equal_range(config);
auto matching_iter = std::find_if(range.first, range.second, [](const auto& iter) {
return iter.first.IsRenderTarget() || iter.second.frameCount != FRAMECOUNT_INVALID;
});
return matching_iter != range.second ? matching_iter : texture_pool.end();
return matching_iter != range.second ? matching_iter : m_texture_pool.end();
}
TextureCacheBase::TexAddrCache::iterator TextureCacheBase::GetTexCacheIter(TCacheEntry* entry)
{
auto iter_range = textures_by_address.equal_range(entry->addr);
auto iter_range = m_textures_by_address.equal_range(entry->addr);
TexAddrCache::iterator iter = iter_range.first;
while (iter != iter_range.second)
{
@ -2776,7 +2776,7 @@ TextureCacheBase::TexAddrCache::iterator TextureCacheBase::GetTexCacheIter(TCach
}
++iter;
}
return textures_by_address.end();
return m_textures_by_address.end();
}
std::pair<TextureCacheBase::TexAddrCache::iterator, TextureCacheBase::TexAddrCache::iterator>
@ -2790,8 +2790,8 @@ TextureCacheBase::FindOverlappingTextures(u32 addr, u32 size_in_bytes)
// 1024 x 1024 texel times 8 nibbles per texel
constexpr u32 max_texture_size = 1024 * 1024 * 4;
u32 lower_addr = addr > max_texture_size ? addr - max_texture_size : 0;
auto begin = textures_by_address.lower_bound(lower_addr);
auto end = textures_by_address.upper_bound(addr + size_in_bytes);
auto begin = m_textures_by_address.lower_bound(lower_addr);
auto end = m_textures_by_address.upper_bound(addr + size_in_bytes);
return std::make_pair(begin, end);
}
@ -2799,15 +2799,15 @@ TextureCacheBase::FindOverlappingTextures(u32 addr, u32 size_in_bytes)
TextureCacheBase::TexAddrCache::iterator
TextureCacheBase::InvalidateTexture(TexAddrCache::iterator iter, bool discard_pending_efb_copy)
{
if (iter == textures_by_address.end())
return textures_by_address.end();
if (iter == m_textures_by_address.end())
return m_textures_by_address.end();
RcTcacheEntry& entry = iter->second;
if (entry->textures_by_hash_iter != textures_by_hash.end())
if (entry->textures_by_hash_iter != m_textures_by_hash.end())
{
textures_by_hash.erase(entry->textures_by_hash_iter);
entry->textures_by_hash_iter = textures_by_hash.end();
m_textures_by_hash.erase(entry->textures_by_hash_iter);
entry->textures_by_hash_iter = m_textures_by_hash.end();
}
// If this is a pending EFB copy, we don't want to flush it here.
@ -2840,7 +2840,7 @@ TextureCacheBase::InvalidateTexture(TexAddrCache::iterator iter, bool discard_pe
}
entry->invalidated = true;
return textures_by_address.erase(iter);
return m_textures_by_address.erase(iter);
}
void TextureCacheBase::ReleaseToPool(TCacheEntry* entry)
@ -2848,8 +2848,8 @@ void TextureCacheBase::ReleaseToPool(TCacheEntry* entry)
if (!entry->texture)
return;
auto config = entry->texture->GetConfig();
texture_pool.emplace(config,
TexPoolEntry(std::move(entry->texture), std::move(entry->framebuffer)));
m_texture_pool.emplace(config,
TexPoolEntry(std::move(entry->texture), std::move(entry->framebuffer)));
}
bool TextureCacheBase::CreateUtilityTextures()

View file

@ -138,7 +138,7 @@ struct TCacheEntry
u64 id = 0;
u32 content_semaphore = 0; // Counts up
// Indicates that this TCacheEntry has been invalided from textures_by_address
// Indicates that this TCacheEntry has been invalided from m_textures_by_address
bool invalidated = false;
bool reference_changed = false; // used by xfb to determine when a reference xfb changed
@ -151,7 +151,7 @@ struct TCacheEntry
// used to delete textures which haven't been used for TEXTURE_KILL_THRESHOLD frames
int frameCount = FRAMECOUNT_INVALID;
// Keep an iterator to the entry in textures_by_hash, so it does not need to be searched when
// Keep an iterator to the entry in m_textures_by_hash, so it does not need to be searched when
// removing the cache entry
std::multimap<u64, std::shared_ptr<TCacheEntry>>::iterator textures_by_hash_iter;
@ -330,8 +330,8 @@ protected:
float gamma, bool clamp_top, bool clamp_bottom,
const std::array<u32, 3>& filter_coefficients);
alignas(16) u8* temp = nullptr;
size_t temp_size = 0;
alignas(16) u8* m_temp = nullptr;
size_t m_temp_size = 0;
private:
using TexAddrCache = std::multimap<u32, RcTcacheEntry>;
@ -405,20 +405,20 @@ private:
void DoSaveState(PointerWrap& p);
void DoLoadState(PointerWrap& p);
// textures_by_address is the authoritive version of what's actually "in" the texture cache
// m_textures_by_address is the authoritive version of what's actually "in" the texture cache
// but it's possible for invalidated TCache entries to live on elsewhere
TexAddrCache textures_by_address;
TexAddrCache m_textures_by_address;
// textures_by_hash is an alternative view of the texture cache
// All textures in here will also be in textures_by_address
TexHashCache textures_by_hash;
// m_textures_by_hash is an alternative view of the texture cache
// All textures in here will also be in m_textures_by_address
TexHashCache m_textures_by_hash;
// bound_textures are actually active in the current draw
// m_bound_textures are actually active in the current draw
// It's valid for textures to be in here after they've been invalidated
std::array<RcTcacheEntry, 8> bound_textures{};
std::array<RcTcacheEntry, 8> m_bound_textures{};
TexPool texture_pool;
u64 last_entry_id = 0;
TexPool m_texture_pool;
u64 m_last_entry_id = 0;
// Backup configuration values
struct BackupConfig
@ -437,7 +437,7 @@ private:
bool graphics_mods;
u32 graphics_mod_change_count;
};
BackupConfig backup_config = {};
BackupConfig m_backup_config = {};
// Encoding texture used for EFB copies to RAM.
std::unique_ptr<AbstractTexture> m_efb_encoding_texture;