mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
VideoCommon: rename TextureCache to TextureCacheBase
This commit is contained in:
@ -28,25 +28,25 @@ static const int TEXTURE_KILL_THRESHOLD = 64; // Sonic the Fighters (inside Soni
|
||||
static const int TEXTURE_POOL_KILL_THRESHOLD = 3;
|
||||
static const int FRAMECOUNT_INVALID = 0;
|
||||
|
||||
TextureCache* g_texture_cache;
|
||||
TextureCacheBase* g_texture_cache;
|
||||
|
||||
alignas(16) u8* TextureCache::temp = nullptr;
|
||||
size_t TextureCache::temp_size;
|
||||
alignas(16) u8* TextureCacheBase::temp = nullptr;
|
||||
size_t TextureCacheBase::temp_size;
|
||||
|
||||
TextureCache::TexCache TextureCache::textures_by_address;
|
||||
TextureCache::TexCache TextureCache::textures_by_hash;
|
||||
TextureCache::TexPool TextureCache::texture_pool;
|
||||
TextureCache::TCacheEntryBase* TextureCache::bound_textures[8];
|
||||
TextureCacheBase::TexCache TextureCacheBase::textures_by_address;
|
||||
TextureCacheBase::TexCache TextureCacheBase::textures_by_hash;
|
||||
TextureCacheBase::TexPool TextureCacheBase::texture_pool;
|
||||
TextureCacheBase::TCacheEntryBase* TextureCacheBase::bound_textures[8];
|
||||
|
||||
TextureCache::BackupConfig TextureCache::backup_config;
|
||||
TextureCacheBase::BackupConfig TextureCacheBase::backup_config;
|
||||
|
||||
static bool invalidate_texture_cache_requested;
|
||||
|
||||
TextureCache::TCacheEntryBase::~TCacheEntryBase()
|
||||
TextureCacheBase::TCacheEntryBase::~TCacheEntryBase()
|
||||
{
|
||||
}
|
||||
|
||||
void TextureCache::CheckTempSize(size_t required_size)
|
||||
void TextureCacheBase::CheckTempSize(size_t required_size)
|
||||
{
|
||||
if (required_size <= temp_size)
|
||||
return;
|
||||
@ -56,7 +56,7 @@ void TextureCache::CheckTempSize(size_t required_size)
|
||||
temp = (u8*)AllocateAlignedMemory(temp_size, 16);
|
||||
}
|
||||
|
||||
TextureCache::TextureCache()
|
||||
TextureCacheBase::TextureCacheBase()
|
||||
{
|
||||
temp_size = 2048 * 2048 * 4;
|
||||
if (!temp)
|
||||
@ -71,12 +71,12 @@ TextureCache::TextureCache()
|
||||
invalidate_texture_cache_requested = false;
|
||||
}
|
||||
|
||||
void TextureCache::RequestInvalidateTextureCache()
|
||||
void TextureCacheBase::RequestInvalidateTextureCache()
|
||||
{
|
||||
invalidate_texture_cache_requested = true;
|
||||
}
|
||||
|
||||
void TextureCache::Invalidate()
|
||||
void TextureCacheBase::Invalidate()
|
||||
{
|
||||
UnbindTextures();
|
||||
|
||||
@ -94,7 +94,7 @@ void TextureCache::Invalidate()
|
||||
texture_pool.clear();
|
||||
}
|
||||
|
||||
TextureCache::~TextureCache()
|
||||
TextureCacheBase::~TextureCacheBase()
|
||||
{
|
||||
HiresTexture::Shutdown();
|
||||
Invalidate();
|
||||
@ -102,7 +102,7 @@ TextureCache::~TextureCache()
|
||||
temp = nullptr;
|
||||
}
|
||||
|
||||
void TextureCache::OnConfigChanged(VideoConfig& config)
|
||||
void TextureCacheBase::OnConfigChanged(VideoConfig& config)
|
||||
{
|
||||
if (g_texture_cache)
|
||||
{
|
||||
@ -143,7 +143,7 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
|
||||
backup_config.s_efb_mono_depth = config.bStereoEFBMonoDepth;
|
||||
}
|
||||
|
||||
void TextureCache::Cleanup(int _frameCount)
|
||||
void TextureCacheBase::Cleanup(int _frameCount)
|
||||
{
|
||||
TexCache::iterator iter = textures_by_address.begin();
|
||||
TexCache::iterator tcend = textures_by_address.end();
|
||||
@ -201,7 +201,7 @@ void TextureCache::Cleanup(int _frameCount)
|
||||
}
|
||||
}
|
||||
|
||||
bool TextureCache::TCacheEntryBase::OverlapsMemoryRange(u32 range_address, u32 range_size) const
|
||||
bool TextureCacheBase::TCacheEntryBase::OverlapsMemoryRange(u32 range_address, u32 range_size) const
|
||||
{
|
||||
if (addr + size_in_bytes <= range_address)
|
||||
return false;
|
||||
@ -212,7 +212,7 @@ bool TextureCache::TCacheEntryBase::OverlapsMemoryRange(u32 range_address, u32 r
|
||||
return true;
|
||||
}
|
||||
|
||||
TextureCache::TCacheEntryBase* TextureCache::DoPartialTextureUpdates(TexCache::iterator iter_t)
|
||||
TextureCacheBase::TCacheEntryBase* TextureCacheBase::DoPartialTextureUpdates(TexCache::iterator iter_t)
|
||||
{
|
||||
TCacheEntryBase* entry_to_update = iter_t->second;
|
||||
const bool isPaletteTexture = (entry_to_update->format == GX_TF_C4
|
||||
@ -272,7 +272,7 @@ TextureCache::TCacheEntryBase* TextureCache::DoPartialTextureUpdates(TexCache::i
|
||||
}
|
||||
if (entry_to_update->config.width != w || entry_to_update->config.height != h)
|
||||
{
|
||||
TextureCache::TCacheEntryConfig newconfig;
|
||||
TextureCacheBase::TCacheEntryConfig newconfig;
|
||||
newconfig.width = w;
|
||||
newconfig.height = h;
|
||||
newconfig.rendertarget = true;
|
||||
@ -315,7 +315,7 @@ TextureCache::TCacheEntryBase* TextureCache::DoPartialTextureUpdates(TexCache::i
|
||||
return entry_to_update;
|
||||
}
|
||||
|
||||
void TextureCache::DumpTexture(TCacheEntryBase* entry, std::string basename, unsigned int level)
|
||||
void TextureCacheBase::DumpTexture(TCacheEntryBase* entry, std::string basename, unsigned int level)
|
||||
{
|
||||
std::string szDir = File::GetUserPath(D_DUMPTEXTURES_IDX) +
|
||||
SConfig::GetInstance().m_strUniqueID;
|
||||
@ -339,8 +339,8 @@ static u32 CalculateLevelSize(u32 level_0_size, u32 level)
|
||||
return (level_0_size + ((1 << level) - 1)) >> level;
|
||||
}
|
||||
|
||||
// Used by TextureCache::Load
|
||||
TextureCache::TCacheEntryBase* TextureCache::ReturnEntry(unsigned int stage, TCacheEntryBase* entry)
|
||||
// Used by TextureCacheBase::Load
|
||||
TextureCacheBase::TCacheEntryBase* TextureCacheBase::ReturnEntry(unsigned int stage, TCacheEntryBase* entry)
|
||||
{
|
||||
entry->frameCount = FRAMECOUNT_INVALID;
|
||||
bound_textures[stage] = entry;
|
||||
@ -350,7 +350,7 @@ TextureCache::TCacheEntryBase* TextureCache::ReturnEntry(unsigned int stage, TCa
|
||||
return entry;
|
||||
}
|
||||
|
||||
void TextureCache::BindTextures()
|
||||
void TextureCacheBase::BindTextures()
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
@ -359,12 +359,12 @@ void TextureCache::BindTextures()
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache::UnbindTextures()
|
||||
void TextureCacheBase::UnbindTextures()
|
||||
{
|
||||
std::fill(std::begin(bound_textures), std::end(bound_textures), nullptr);
|
||||
}
|
||||
|
||||
TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
|
||||
TextureCacheBase::TCacheEntryBase* TextureCacheBase::Load(const u32 stage)
|
||||
{
|
||||
const FourTexUnits &tex = bpmem.tex[stage >> 2];
|
||||
const u32 id = stage & 3;
|
||||
@ -724,8 +724,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
|
||||
return ReturnEntry(stage, entry);
|
||||
}
|
||||
|
||||
void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride, PEControl::PixelFormat srcFormat,
|
||||
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
|
||||
void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride, PEControl::PixelFormat srcFormat,
|
||||
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
|
||||
{
|
||||
// Emulation methods:
|
||||
//
|
||||
@ -1101,10 +1101,10 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
|
||||
textures_by_address.emplace((u64)dstAddr, entry);
|
||||
}
|
||||
|
||||
TextureCache::TCacheEntryBase* TextureCache::AllocateTexture(const TCacheEntryConfig& config)
|
||||
TextureCacheBase::TCacheEntryBase* TextureCacheBase::AllocateTexture(const TCacheEntryConfig& config)
|
||||
{
|
||||
TexPool::iterator iter = texture_pool.find(config);
|
||||
TextureCache::TCacheEntryBase* entry;
|
||||
TextureCacheBase::TCacheEntryBase* entry;
|
||||
if (iter != texture_pool.end())
|
||||
{
|
||||
entry = iter->second;
|
||||
@ -1120,7 +1120,7 @@ TextureCache::TCacheEntryBase* TextureCache::AllocateTexture(const TCacheEntryCo
|
||||
return entry;
|
||||
}
|
||||
|
||||
TextureCache::TexCache::iterator TextureCache::FreeTexture(TexCache::iterator iter)
|
||||
TextureCacheBase::TexCache::iterator TextureCacheBase::FreeTexture(TexCache::iterator iter)
|
||||
{
|
||||
TCacheEntryBase* entry = iter->second;
|
||||
|
||||
@ -1136,7 +1136,7 @@ TextureCache::TexCache::iterator TextureCache::FreeTexture(TexCache::iterator it
|
||||
return textures_by_address.erase(iter);
|
||||
}
|
||||
|
||||
u32 TextureCache::TCacheEntryBase::BytesPerRow() const
|
||||
u32 TextureCacheBase::TCacheEntryBase::BytesPerRow() const
|
||||
{
|
||||
const u32 blockW = TexDecoder_GetBlockWidthInTexels(format);
|
||||
|
||||
@ -1151,7 +1151,7 @@ u32 TextureCache::TCacheEntryBase::BytesPerRow() const
|
||||
return numBlocksX * bytes_per_block;
|
||||
}
|
||||
|
||||
u32 TextureCache::TCacheEntryBase::NumBlocksY() const
|
||||
u32 TextureCacheBase::TCacheEntryBase::NumBlocksY() const
|
||||
{
|
||||
u32 blockH = TexDecoder_GetBlockHeightInTexels(format);
|
||||
// Round up source height to multiple of block size
|
||||
@ -1160,7 +1160,7 @@ u32 TextureCache::TCacheEntryBase::NumBlocksY() const
|
||||
return actualHeight / blockH;
|
||||
}
|
||||
|
||||
void TextureCache::TCacheEntryBase::SetEfbCopy(u32 stride)
|
||||
void TextureCacheBase::TCacheEntryBase::SetEfbCopy(u32 stride)
|
||||
{
|
||||
is_efb_copy = true;
|
||||
memory_stride = stride;
|
||||
@ -1171,7 +1171,7 @@ void TextureCache::TCacheEntryBase::SetEfbCopy(u32 stride)
|
||||
}
|
||||
|
||||
// Fill gamecube memory backing this texture with zeros.
|
||||
void TextureCache::TCacheEntryBase::Zero(u8* ptr)
|
||||
void TextureCacheBase::TCacheEntryBase::Zero(u8* ptr)
|
||||
{
|
||||
for (u32 i = 0; i < NumBlocksY(); i++)
|
||||
{
|
||||
@ -1180,7 +1180,7 @@ void TextureCache::TCacheEntryBase::Zero(u8* ptr)
|
||||
}
|
||||
}
|
||||
|
||||
u64 TextureCache::TCacheEntryBase::CalculateHash() const
|
||||
u64 TextureCacheBase::TCacheEntryBase::CalculateHash() const
|
||||
{
|
||||
u8* ptr = Memory::GetPointer(addr);
|
||||
if (memory_stride == BytesPerRow())
|
||||
|
Reference in New Issue
Block a user