Merge pull request #12148 from Dentomologist/fifo_convert_memoryupdate_type_to_enum_class

Fifo: Convert MemoryUpdate::Type to enum class
This commit is contained in:
Admiral H. Curtiss 2023-09-03 03:34:35 +02:00 committed by GitHub
commit 46a596c0d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.dataOffset = dataOffset;
dstUpdate.dataSize = static_cast<u32>(srcUpdate.data.size()); dstUpdate.dataSize = static_cast<u32>(srcUpdate.data.size());
dstUpdate.fifoPosition = srcUpdate.fifoPosition; dstUpdate.fifoPosition = srcUpdate.fifoPosition;
dstUpdate.type = srcUpdate.type; dstUpdate.type = static_cast<u8>(srcUpdate.type);
u64 updateOffset = updateListOffset + (i * sizeof(FileMemoryUpdate)); u64 updateOffset = updateListOffset + (i * sizeof(FileMemoryUpdate));
file.Seek(updateOffset, File::SeekOrigin::Begin); file.Seek(updateOffset, File::SeekOrigin::Begin);

View File

@ -18,11 +18,11 @@ class IOFile;
struct MemoryUpdate struct MemoryUpdate
{ {
enum Type enum class Type : u8
{ {
TEXTURE_MAP = 0x01, TextureMap = 0x01,
XF_DATA = 0x02, XFData = 0x02,
VERTEX_STREAM = 0x04, VertexStream = 0x04,
TMEM = 0x08, 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; 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. // 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_start = m_cpmem.array_bases[array_index] + byte_offset;
const u32 array_size = m_cpmem.array_strides[array_index] * max_index + component_size; 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; static FifoRecorder instance;

View File

@ -397,7 +397,7 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
memory.CopyFromEmu(texMem + tlutTMemAddr, addr, tlutXferCount); memory.CopyFromEmu(texMem + tlutTMemAddr, addr, tlutXferCount);
if (OpcodeDecoder::g_record_fifo_data) if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(addr, tlutXferCount, MemoryUpdate::TMEM); FifoRecorder::GetInstance().UseMemory(addr, tlutXferCount, MemoryUpdate::Type::TMEM);
TMEM::InvalidateAll(); TMEM::InvalidateAll();
@ -615,7 +615,7 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
} }
if (OpcodeDecoder::g_record_fifo_data) 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(); 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. // its own memory modification tracking independent of the texture hashing below.
if (OpcodeDecoder::g_record_fifo_data && !texture_info.IsFromTmem()) if (OpcodeDecoder::g_record_fifo_data && !texture_info.IsFromTmem())
{ {
FifoRecorder::GetInstance().UseMemory( FifoRecorder::GetInstance().UseMemory(texture_info.GetRawAddress(),
texture_info.GetRawAddress(), texture_info.GetFullLevelSize(), MemoryUpdate::TEXTURE_MAP); texture_info.GetFullLevelSize(),
MemoryUpdate::Type::TextureMap);
} }
// TODO: This doesn't hash GB tiles for preloaded RGBA8 textures (instead, it's hashing more data // 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; u32 address = dstAddr;
for (u32 i = 0; i < num_blocks_y; i++) 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); true);
address += dstStride; address += dstStride;
} }