mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-11 16:49:28 +02:00
Common: Refactor PointerWrap
This commit is contained in:
@ -432,7 +432,7 @@ void TextureCacheBase::SerializeTexture(AbstractTexture* tex, const TextureConfi
|
||||
PointerWrap& p)
|
||||
{
|
||||
// If we're in measure mode, skip the actual readback to save some time.
|
||||
const bool skip_readback = p.GetMode() == PointerWrap::MODE_MEASURE;
|
||||
const bool skip_readback = p.IsMeasureMode();
|
||||
p.DoPOD(config);
|
||||
|
||||
if (skip_readback || CheckReadbackTexture(config.width, config.height, config.format))
|
||||
@ -459,7 +459,7 @@ void TextureCacheBase::SerializeTexture(AbstractTexture* tex, const TextureConfi
|
||||
// needing to allocate/free an extra buffer.
|
||||
u8* texture_data = p.DoExternal(total_size);
|
||||
|
||||
if (!skip_readback && p.GetMode() == PointerWrap::MODE_MEASURE)
|
||||
if (!skip_readback && p.IsMeasureMode())
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO, "Couldn't acquire {} bytes for serializing texture.", total_size);
|
||||
return;
|
||||
@ -502,7 +502,7 @@ std::optional<TextureCacheBase::TexPoolEntry> TextureCacheBase::DeserializeTextu
|
||||
u32 total_size = 0;
|
||||
u8* texture_data = p.DoExternal(total_size);
|
||||
|
||||
if (p.GetMode() != PointerWrap::MODE_READ || total_size == 0)
|
||||
if (!p.IsReadMode() || total_size == 0)
|
||||
return std::nullopt;
|
||||
|
||||
auto tex = AllocateTexture(config);
|
||||
@ -542,7 +542,7 @@ void TextureCacheBase::DoState(PointerWrap& p)
|
||||
|
||||
p.Do(last_entry_id);
|
||||
|
||||
if (p.GetMode() == PointerWrap::MODE_WRITE || p.GetMode() == PointerWrap::MODE_MEASURE)
|
||||
if (p.IsWriteMode() || p.IsMeasureMode())
|
||||
DoSaveState(p);
|
||||
else
|
||||
DoLoadState(p);
|
||||
@ -673,7 +673,7 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
|
||||
// Only clear out state when actually restoring/loading.
|
||||
// Since we throw away entries when not in loading mode now, we don't need to check
|
||||
// before inserting entries into the cache, as GetEntry will always return null.
|
||||
const bool commit_state = p.GetMode() == PointerWrap::MODE_READ;
|
||||
const bool commit_state = p.IsReadMode();
|
||||
if (commit_state)
|
||||
Invalidate();
|
||||
|
||||
|
Reference in New Issue
Block a user