VideoCommon/OpcodeDecoding: Move g_bRecordFifoData into namespace

Keeps the global localized with the code that it's primarily related to.

Now it's obvious from a glance what the global variable is affecting.
This commit is contained in:
Lioncash 2019-12-05 08:11:52 -05:00
parent d8063e9c54
commit b2a9c36501
6 changed files with 24 additions and 20 deletions

View File

@ -25,6 +25,7 @@
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/GeometryShaderManager.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
@ -343,7 +344,7 @@ static void BPWritten(const BPCmd& bp)
Memory::CopyFromEmu(texMem + tlutTMemAddr, addr, tlutXferCount);
if (g_bRecordFifoData)
if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(addr, tlutXferCount, MemoryUpdate::TMEM);
TextureCacheBase::InvalidateAllBindPoints();
@ -566,7 +567,7 @@ static void BPWritten(const BPCmd& bp)
}
}
if (g_bRecordFifoData)
if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(src_addr, bytes_read, MemoryUpdate::TMEM);
TextureCacheBase::InvalidateAllBindPoints();

View File

@ -30,8 +30,6 @@
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/XFMemory.h"
bool g_bRecordFifoData = false;
namespace OpcodeDecoder
{
static bool s_is_fifo_error_seen = false;
@ -75,6 +73,8 @@ static void InterpretDisplayListPreprocess(u32 address, u32 size)
Run<true>(DataReader(start_address, start_address + size), nullptr, true);
}
bool g_record_fifo_data = false;
void Init()
{
s_is_fifo_error_seen = false;
@ -255,7 +255,7 @@ u8* Run(DataReader src, u32* cycles, bool in_display_list)
}
// Display lists get added directly into the FIFO stream
if (!is_preprocess && g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
if (!is_preprocess && g_record_fifo_data && cmd_byte != GX_CMD_CALL_DL)
{
const u8* const opcode_end = src.GetPointer();
FifoRecorder::GetInstance().WriteGPCommand(opcode_start, u32(opcode_end - opcode_start));

View File

@ -10,6 +10,9 @@ class DataReader;
namespace OpcodeDecoder
{
// Global flag to signal if FifoRecorder is active.
extern bool g_record_fifo_data;
enum
{
GX_NOP = 0x00,

View File

@ -65,6 +65,7 @@
#include "VideoCommon/NetPlayChatUI.h"
#include "VideoCommon/NetPlayGolfUI.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/PostProcessing.h"
@ -880,19 +881,18 @@ std::tuple<int, int> Renderer::CalculateOutputDimensions(int width, int height)
void Renderer::CheckFifoRecording()
{
bool wasRecording = g_bRecordFifoData;
g_bRecordFifoData = FifoRecorder::GetInstance().IsRecording();
const bool was_recording = OpcodeDecoder::g_record_fifo_data;
OpcodeDecoder::g_record_fifo_data = FifoRecorder::GetInstance().IsRecording();
if (g_bRecordFifoData)
if (!OpcodeDecoder::g_record_fifo_data)
return;
if (!was_recording)
{
if (!wasRecording)
{
RecordVideoMemory();
}
FifoRecorder::GetInstance().EndFrame(CommandProcessor::fifo.CPBase,
CommandProcessor::fifo.CPEnd);
RecordVideoMemory();
}
FifoRecorder::GetInstance().EndFrame(CommandProcessor::fifo.CPBase, CommandProcessor::fifo.CPEnd);
}
void Renderer::RecordVideoMemory()

View File

@ -38,6 +38,7 @@
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/HiresTextures.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/SamplerCommon.h"
@ -1260,9 +1261,11 @@ TextureCacheBase::GetTexture(u32 address, u32 width, u32 height, const TextureFo
// If we are recording a FifoLog, keep track of what memory we read. FifoRecorder does
// its own memory modification tracking independent of the texture hashing below.
if (g_bRecordFifoData && !from_tmem)
if (OpcodeDecoder::g_record_fifo_data && !from_tmem)
{
FifoRecorder::GetInstance().UseMemory(address, texture_size + additional_mips_size,
MemoryUpdate::TEXTURE_MAP);
}
// TODO: This doesn't hash GB tiles for preloaded RGBA8 textures (instead, it's hashing more data
// from the low tmem bank than it should)
@ -2294,7 +2297,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
++iter.first;
}
if (g_bRecordFifoData)
if (OpcodeDecoder::g_record_fifo_data)
{
// Mark the memory behind this efb copy as dynamicly generated for the Fifo log
u32 address = dstAddr;

View File

@ -6,9 +6,6 @@
#include "Common/CommonTypes.h"
// Global flag to signal if FifoRecorder is active.
extern bool g_bRecordFifoData;
// These are accurate (disregarding AA modes).
constexpr u32 EFB_WIDTH = 640;
constexpr u32 EFB_HEIGHT = 528;