mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
Move TCacheEntry out of TextureCacheBase
Allows for fowards declaration
This commit is contained in:
parent
2843cd10a8
commit
c1fd4a2013
2 changed files with 134 additions and 135 deletions
|
@ -62,13 +62,13 @@ static int xfb_count = 0;
|
|||
|
||||
std::unique_ptr<TextureCacheBase> g_texture_cache;
|
||||
|
||||
TextureCacheBase::TCacheEntry::TCacheEntry(std::unique_ptr<AbstractTexture> tex,
|
||||
TCacheEntry::TCacheEntry(std::unique_ptr<AbstractTexture> tex,
|
||||
std::unique_ptr<AbstractFramebuffer> fb)
|
||||
: texture(std::move(tex)), framebuffer(std::move(fb))
|
||||
{
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry::~TCacheEntry()
|
||||
TCacheEntry::~TCacheEntry()
|
||||
{
|
||||
for (auto& reference : references)
|
||||
reference->references.erase(this);
|
||||
|
@ -240,7 +240,7 @@ void TextureCacheBase::Cleanup(int _frameCount)
|
|||
}
|
||||
}
|
||||
|
||||
bool TextureCacheBase::TCacheEntry::OverlapsMemoryRange(u32 range_address, u32 range_size) const
|
||||
bool TCacheEntry::OverlapsMemoryRange(u32 range_address, u32 range_size) const
|
||||
{
|
||||
if (addr + size_in_bytes <= range_address)
|
||||
return false;
|
||||
|
@ -268,7 +268,7 @@ void TextureCacheBase::SetBackupConfig(const VideoConfig& config)
|
|||
config.graphics_mod_config ? config.graphics_mod_config->GetChangeCount() : 0;
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry*
|
||||
TCacheEntry*
|
||||
TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, const u8* palette, TLUTFormat tlutfmt)
|
||||
{
|
||||
DEBUG_ASSERT(g_ActiveConfig.backend_info.bSupportsPaletteConversion);
|
||||
|
@ -337,7 +337,7 @@ TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, const u8* palette, TLU
|
|||
return decoded_entry;
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry* TextureCacheBase::ReinterpretEntry(const TCacheEntry* existing_entry,
|
||||
TCacheEntry* TextureCacheBase::ReinterpretEntry(const TCacheEntry* existing_entry,
|
||||
TextureFormat new_format)
|
||||
{
|
||||
const AbstractPipeline* pipeline =
|
||||
|
@ -383,7 +383,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::ReinterpretEntry(const TCacheEn
|
|||
return reinterpreted_entry;
|
||||
}
|
||||
|
||||
void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntry* entry, u32 new_width,
|
||||
void TextureCacheBase::ScaleTextureCacheEntryTo(TCacheEntry* entry, u32 new_width,
|
||||
u32 new_height)
|
||||
{
|
||||
if (entry->GetWidth() == new_width && entry->GetHeight() == new_height)
|
||||
|
@ -746,7 +746,7 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
|
|||
}
|
||||
}
|
||||
|
||||
void TextureCacheBase::TCacheEntry::DoState(PointerWrap& p)
|
||||
void TCacheEntry::DoState(PointerWrap& p)
|
||||
{
|
||||
p.Do(addr);
|
||||
p.Do(size_in_bytes);
|
||||
|
@ -770,7 +770,7 @@ void TextureCacheBase::TCacheEntry::DoState(PointerWrap& p)
|
|||
p.Do(frameCount);
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry*
|
||||
TCacheEntry*
|
||||
TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, const u8* palette,
|
||||
TLUTFormat tlutfmt)
|
||||
{
|
||||
|
@ -1224,7 +1224,7 @@ private:
|
|||
std::vector<Level> levels;
|
||||
};
|
||||
|
||||
TextureCacheBase::TCacheEntry* TextureCacheBase::Load(const TextureInfo& texture_info)
|
||||
TCacheEntry* TextureCacheBase::Load(const TextureInfo& texture_info)
|
||||
{
|
||||
// if this stage was not invalidated by changes to texture registers, keep the current texture
|
||||
if (TMEM::IsValid(texture_info.GetStage()) && bound_textures[texture_info.GetStage()])
|
||||
|
@ -1272,7 +1272,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::Load(const TextureInfo& texture
|
|||
return entry;
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry*
|
||||
TCacheEntry*
|
||||
TextureCacheBase::GetTexture(const int textureCacheSafetyColorSampleSize,
|
||||
const TextureInfo& texture_info)
|
||||
{
|
||||
|
@ -1729,7 +1729,7 @@ TextureCacheBase::GetTexture(const int textureCacheSafetyColorSampleSize,
|
|||
return entry;
|
||||
}
|
||||
|
||||
static void GetDisplayRectForXFBEntry(TextureCacheBase::TCacheEntry* entry, u32 width, u32 height,
|
||||
static void GetDisplayRectForXFBEntry(TCacheEntry* entry, u32 width, u32 height,
|
||||
MathUtil::Rectangle<int>* display_rect)
|
||||
{
|
||||
// Scale the sub-rectangle to the full resolution of the texture.
|
||||
|
@ -1739,7 +1739,7 @@ static void GetDisplayRectForXFBEntry(TextureCacheBase::TCacheEntry* entry, u32
|
|||
display_rect->bottom = static_cast<int>(height * entry->GetHeight() / entry->native_height);
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry*
|
||||
TCacheEntry*
|
||||
TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
|
||||
MathUtil::Rectangle<int>* display_rect)
|
||||
{
|
||||
|
@ -1822,7 +1822,7 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
|
|||
return entry;
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry* TextureCacheBase::GetXFBFromCache(u32 address, u32 width, u32 height,
|
||||
TCacheEntry* TextureCacheBase::GetXFBFromCache(u32 address, u32 width, u32 height,
|
||||
u32 stride)
|
||||
{
|
||||
auto iter_range = textures_by_address.equal_range(address);
|
||||
|
@ -2555,7 +2555,7 @@ void TextureCacheBase::UninitializeXFBMemory(u8* dst, u32 stride, u32 bytes_per_
|
|||
}
|
||||
}
|
||||
|
||||
TextureCacheBase::TCacheEntry* TextureCacheBase::AllocateCacheEntry(const TextureConfig& config)
|
||||
TCacheEntry* TextureCacheBase::AllocateCacheEntry(const TextureConfig& config)
|
||||
{
|
||||
std::optional<TexPoolEntry> alloc = AllocateTexture(config);
|
||||
if (!alloc)
|
||||
|
@ -2619,7 +2619,7 @@ TextureCacheBase::FindMatchingTextureFromPool(const TextureConfig& config)
|
|||
}
|
||||
|
||||
TextureCacheBase::TexAddrCache::iterator
|
||||
TextureCacheBase::GetTexCacheIter(TextureCacheBase::TCacheEntry* entry)
|
||||
TextureCacheBase::GetTexCacheIter(TCacheEntry* entry)
|
||||
{
|
||||
auto iter_range = textures_by_address.equal_range(entry->addr);
|
||||
TexAddrCache::iterator iter = iter_range.first;
|
||||
|
@ -2967,7 +2967,7 @@ bool TextureCacheBase::DecodeTextureOnGPU(TCacheEntry* entry, u32 dst_level, con
|
|||
return true;
|
||||
}
|
||||
|
||||
u32 TextureCacheBase::TCacheEntry::BytesPerRow() const
|
||||
u32 TCacheEntry::BytesPerRow() const
|
||||
{
|
||||
// RGBA takes two cache lines per block; all others take one
|
||||
const u32 bytes_per_block = format == TextureFormat::RGBA8 ? 64 : 32;
|
||||
|
@ -2975,7 +2975,7 @@ u32 TextureCacheBase::TCacheEntry::BytesPerRow() const
|
|||
return NumBlocksX() * bytes_per_block;
|
||||
}
|
||||
|
||||
u32 TextureCacheBase::TCacheEntry::NumBlocksX() const
|
||||
u32 TCacheEntry::NumBlocksX() const
|
||||
{
|
||||
const u32 blockW = TexDecoder_GetBlockWidthInTexels(format.texfmt);
|
||||
|
||||
|
@ -2985,7 +2985,7 @@ u32 TextureCacheBase::TCacheEntry::NumBlocksX() const
|
|||
return actualWidth / blockW;
|
||||
}
|
||||
|
||||
u32 TextureCacheBase::TCacheEntry::NumBlocksY() const
|
||||
u32 TCacheEntry::NumBlocksY() const
|
||||
{
|
||||
u32 blockH = TexDecoder_GetBlockHeightInTexels(format.texfmt);
|
||||
// Round up source height to multiple of block size
|
||||
|
@ -2994,7 +2994,7 @@ u32 TextureCacheBase::TCacheEntry::NumBlocksY() const
|
|||
return actualHeight / blockH;
|
||||
}
|
||||
|
||||
void TextureCacheBase::TCacheEntry::SetXfbCopy(u32 stride)
|
||||
void TCacheEntry::SetXfbCopy(u32 stride)
|
||||
{
|
||||
is_efb_copy = false;
|
||||
is_xfb_copy = true;
|
||||
|
@ -3006,7 +3006,7 @@ void TextureCacheBase::TCacheEntry::SetXfbCopy(u32 stride)
|
|||
size_in_bytes = memory_stride * NumBlocksY();
|
||||
}
|
||||
|
||||
void TextureCacheBase::TCacheEntry::SetEfbCopy(u32 stride)
|
||||
void TCacheEntry::SetEfbCopy(u32 stride)
|
||||
{
|
||||
is_efb_copy = true;
|
||||
is_xfb_copy = false;
|
||||
|
@ -3018,14 +3018,14 @@ void TextureCacheBase::TCacheEntry::SetEfbCopy(u32 stride)
|
|||
size_in_bytes = memory_stride * NumBlocksY();
|
||||
}
|
||||
|
||||
void TextureCacheBase::TCacheEntry::SetNotCopy()
|
||||
void TCacheEntry::SetNotCopy()
|
||||
{
|
||||
is_efb_copy = false;
|
||||
is_xfb_copy = false;
|
||||
is_xfb_container = false;
|
||||
}
|
||||
|
||||
int TextureCacheBase::TCacheEntry::HashSampleSize() const
|
||||
int TCacheEntry::HashSampleSize() const
|
||||
{
|
||||
if (should_force_safe_hashing)
|
||||
{
|
||||
|
@ -3035,7 +3035,7 @@ int TextureCacheBase::TCacheEntry::HashSampleSize() const
|
|||
return g_ActiveConfig.iSafeTextureCache_ColorSamples;
|
||||
}
|
||||
|
||||
u64 TextureCacheBase::TCacheEntry::CalculateHash() const
|
||||
u64 TCacheEntry::CalculateHash() const
|
||||
{
|
||||
const u32 bytes_per_row = BytesPerRow();
|
||||
const u32 hash_sample_size = HashSampleSize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue