Fifo: Convert MemoryUpdate::Type to enum class

This commit is contained in:
Dentomologist 2023-08-29 19:27:59 -07:00
parent efa820763a
commit 9cabf20aaa
5 changed files with 13 additions and 12 deletions

View File

@ -385,7 +385,7 @@ u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate>& memUpdates
dstUpdate.dataOffset = dataOffset;
dstUpdate.dataSize = static_cast<u32>(srcUpdate.data.size());
dstUpdate.fifoPosition = srcUpdate.fifoPosition;
dstUpdate.type = srcUpdate.type;
dstUpdate.type = static_cast<u8>(srcUpdate.type);
u64 updateOffset = updateListOffset + (i * sizeof(FileMemoryUpdate));
file.Seek(updateOffset, File::SeekOrigin::Begin);

View File

@ -18,11 +18,11 @@ class IOFile;
struct MemoryUpdate
{
enum Type
enum class Type : u8
{
TEXTURE_MAP = 0x01,
XF_DATA = 0x02,
VERTEX_STREAM = 0x04,
TextureMap = 0x01,
XFData = 0x02,
VertexStream = 0x04,
TMEM = 0x08,
};

View File

@ -69,7 +69,7 @@ void FifoRecorder::FifoRecordAnalyzer::OnIndexedLoad(CPArray array, u32 index, u
{
const u32 load_address = m_cpmem.array_bases[array] + m_cpmem.array_strides[array] * index;
m_owner->UseMemory(load_address, size * sizeof(u32), MemoryUpdate::XF_DATA);
m_owner->UseMemory(load_address, size * sizeof(u32), MemoryUpdate::Type::XFData);
}
// TODO: The following code is copied with modifications from VertexLoaderBase.
@ -210,7 +210,7 @@ void FifoRecorder::FifoRecordAnalyzer::ProcessVertexComponent(
const u32 array_start = m_cpmem.array_bases[array_index] + byte_offset;
const u32 array_size = m_cpmem.array_strides[array_index] * max_index + component_size;
m_owner->UseMemory(array_start, array_size, MemoryUpdate::VERTEX_STREAM);
m_owner->UseMemory(array_start, array_size, MemoryUpdate::Type::VertexStream);
}
static FifoRecorder instance;

View File

@ -397,7 +397,7 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
memory.CopyFromEmu(texMem + tlutTMemAddr, addr, tlutXferCount);
if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(addr, tlutXferCount, MemoryUpdate::TMEM);
FifoRecorder::GetInstance().UseMemory(addr, tlutXferCount, MemoryUpdate::Type::TMEM);
TMEM::InvalidateAll();
@ -615,7 +615,7 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
}
if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(src_addr, bytes_read, MemoryUpdate::TMEM);
FifoRecorder::GetInstance().UseMemory(src_addr, bytes_read, MemoryUpdate::Type::TMEM);
TMEM::InvalidateAll();
}

View File

@ -1379,8 +1379,9 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
// its own memory modification tracking independent of the texture hashing below.
if (OpcodeDecoder::g_record_fifo_data && !texture_info.IsFromTmem())
{
FifoRecorder::GetInstance().UseMemory(
texture_info.GetRawAddress(), texture_info.GetFullLevelSize(), MemoryUpdate::TEXTURE_MAP);
FifoRecorder::GetInstance().UseMemory(texture_info.GetRawAddress(),
texture_info.GetFullLevelSize(),
MemoryUpdate::Type::TextureMap);
}
// TODO: This doesn't hash GB tiles for preloaded RGBA8 textures (instead, it's hashing more data
@ -2541,7 +2542,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
u32 address = dstAddr;
for (u32 i = 0; i < num_blocks_y; i++)
{
FifoRecorder::GetInstance().UseMemory(address, bytes_per_row, MemoryUpdate::TEXTURE_MAP,
FifoRecorder::GetInstance().UseMemory(address, bytes_per_row, MemoryUpdate::Type::TextureMap,
true);
address += dstStride;
}