VideoBackend: Remove simple wrapper functions.

This commit is contained in:
degasus 2016-01-12 09:55:29 +01:00
parent 0c92603fd5
commit c3481a576b
9 changed files with 23 additions and 104 deletions

View File

@ -64,7 +64,9 @@
#include "DiscIO/FileMonitor.h"
#include "InputCommon/GCAdapter.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/VideoBackendBase.h"
// This can mostly be removed when we move to VS2015
@ -165,7 +167,7 @@ void DisplayMessage(const std::string& message, int time_in_ms)
return;
}
g_video_backend->Video_AddMessage(message, time_in_ms);
OSD::AddMessage(message, time_in_ms);
Host_UpdateTitle(message);
}
@ -262,7 +264,7 @@ void Stop() // - Hammertime!
s_is_stopping = true;
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_STOP);
EmulatorState(false);
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
@ -534,7 +536,7 @@ void EmuThread()
s_cpu_thread = std::thread(cpuThreadFunc);
// become the GPU thread
g_video_backend->Video_EnterLoop();
RunGpuLoop();
// We have now exited the Video Loop
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Video Loop Ended").c_str());
@ -602,7 +604,7 @@ void EmuThread()
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Main Emu thread stopped").c_str());
// Clear on screen messages that haven't expired
g_video_backend->Video_ClearMessages();
OSD::ClearMessages();
// Reload sysconf file in order to see changes committed during emulation
if (core_parameter.bWii)
@ -693,7 +695,7 @@ void SaveScreenShot()
SetState(CORE_PAUSE);
g_video_backend->Video_Screenshot(GenerateScreenshotName());
Renderer::SetScreenshot(GenerateScreenshotName());
if (!bPaused)
SetState(CORE_RUN);
@ -707,7 +709,7 @@ void SaveScreenShot(const std::string& name)
std::string filePath = GenerateScreenshotFolderPath() + name + ".png";
g_video_backend->Video_Screenshot(filePath);
Renderer::SetScreenshot(filePath);
if (!bPaused)
SetState(CORE_RUN);
@ -736,7 +738,7 @@ bool PauseAndLock(bool doLock, bool unpauseOnUnlock)
DSP::GetDSPEmulator()->PauseAndLock(doLock, unpauseOnUnlock);
// video has to come after CPU, because CPU thread can wait for video thread (s_efbAccessRequested).
g_video_backend->PauseAndLock(doLock, unpauseOnUnlock);
Fifo_PauseAndLock(doLock, unpauseOnUnlock);
#if defined(__LIBUSB__) || defined(_WIN32)
GCAdapter::ResetRumble();
@ -888,7 +890,7 @@ void UpdateWantDeterminism(bool initial)
g_want_determinism = new_want_determinism;
WiiSockMan::GetInstance().UpdateWantDeterminism(new_want_determinism);
g_video_backend->UpdateWantDeterminism(new_want_determinism);
Fifo_UpdateWantDeterminism(new_want_determinism);
// We need to clear the cache because some parts of the JIT depend on want_determinism, e.g. use of FMA.
JitInterface::ClearCache();
Common::InitializeWiiRoot(g_want_determinism);

View File

@ -17,6 +17,7 @@
#include "Core/CoreTiming.h"
#include "Core/PowerPC/PowerPC.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/VideoBackendBase.h"
#define MAX_SLICE_LENGTH 20000
@ -445,7 +446,7 @@ void Idle()
//the VI will be desynchronized. So, We are waiting until the FIFO finish and
//while we process only the events required by the FIFO.
ProcessFifoWaitEvents();
g_video_backend->Video_Sync(0);
Fifo_Update(0);
}
idledCycles += DowncountToCycles(PowerPC::ppcState.downcount);

View File

@ -15,6 +15,7 @@
#include "Core/HW/DSP.h"
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/PowerPC.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/VideoBackendBase.h"
namespace
@ -114,7 +115,7 @@ void EnableStepping(const bool stepping)
{
PowerPC::Pause();
m_StepEvent.Reset();
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_PAUSE);
EmulatorState(false);
AudioCommon::ClearAudioBuffer(true);
}
else
@ -137,7 +138,7 @@ void EnableStepping(const bool stepping)
}
PowerPC::Start();
m_StepEvent.Set();
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_PLAY);
EmulatorState(true);
AudioCommon::ClearAudioBuffer(false);
}
}

View File

@ -14,6 +14,7 @@
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/VideoBackendBase.h"
namespace GPFifo
@ -80,7 +81,7 @@ static void UpdateGatherPipe()
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
}
g_video_backend->Video_GatherPipeBursted();
CommandProcessor::GatherPipeBursted();
}
// move back the spill bytes

View File

@ -35,6 +35,7 @@
#include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/VideoBackendBase.h"
@ -68,7 +69,7 @@ MMIO::Mapping* mmio_mapping;
static void InitMMIO(MMIO::Mapping* mmio)
{
g_video_backend->RegisterCPMMIO(mmio, 0x0C000000);
CommandProcessor::RegisterMMIO(mmio, 0x0C000000);
PixelEngine::RegisterMMIO(mmio, 0x0C001000);
VideoInterface::RegisterMMIO(mmio, 0x0C002000);
ProcessorInterface::RegisterMMIO(mmio, 0x0C003000);

View File

@ -128,7 +128,7 @@ static void VICallback(u64 userdata, int cyclesLate)
static void CPCallback(u64 userdata, int cyclesLate)
{
u64 now = CoreTiming::GetTicks();
int next = g_video_backend->Video_Sync((int)(now - s_last_sync_gpu_tick));
int next = Fifo_Update((int)(now - s_last_sync_gpu_tick));
s_last_sync_gpu_tick = now;
if (next > 0)

View File

@ -35,6 +35,7 @@
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
#include "Core/PowerPC/PowerPC.h"
#include "InputCommon/GCPadStatus.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/VideoConfig.h"
// The chunk to allocate movie data in multiples of.
@ -240,7 +241,7 @@ void SetFrameSkipping(unsigned int framesToSkip)
// Don't forget to re-enable rendering in case it wasn't...
// as this won't be changed anymore when frameskip is turned off
if (framesToSkip == 0)
g_video_backend->Video_SetRendering(true);
Fifo_SetRendering(true);
}
void SetPolledDevice()
@ -288,7 +289,7 @@ void FrameSkipping()
if (s_frameSkipCounter > s_framesToSkip || Core::ShouldSkipFrame(s_frameSkipCounter) == false)
s_frameSkipCounter = 0;
g_video_backend->Video_SetRendering(!s_frameSkipCounter);
Fifo_SetRendering(!s_frameSkipCounter);
}
}

View File

@ -29,28 +29,12 @@ static volatile struct
u32 fbHeight;
} s_beginFieldArgs;
void VideoBackendBase::EmuStateChange(EMUSTATE_CHANGE newState)
{
EmulatorState(newState == EMUSTATE_CHANGE_PLAY);
}
// Enter and exit the video loop
void VideoBackendBase::Video_EnterLoop()
{
RunGpuLoop();
}
void VideoBackendBase::Video_ExitLoop()
{
ExitGpuLoop();
s_FifoShuttingDown.Set();
}
void VideoBackendBase::Video_SetRendering(bool bEnabled)
{
Fifo_SetRendering(bEnabled);
}
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight)
{
@ -82,23 +66,6 @@ void VideoBackendBase::Video_EndField()
}
}
void VideoBackendBase::Video_AddMessage(const std::string& msg, u32 milliseconds)
{
OSD::AddMessage(msg, milliseconds);
}
void VideoBackendBase::Video_ClearMessages()
{
OSD::ClearMessages();
}
// Screenshot
bool VideoBackendBase::Video_Screenshot(const std::string& filename)
{
Renderer::SetScreenshot(filename.c_str());
return true;
}
u32 VideoBackendBase::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
{
if (!g_ActiveConfig.bEFBAccessEnable)
@ -225,34 +192,3 @@ void VideoBackendBase::CheckInvalidState()
TextureCacheBase::Invalidate();
}
}
void VideoBackendBase::PauseAndLock(bool doLock, bool unpauseOnUnlock)
{
Fifo_PauseAndLock(doLock, unpauseOnUnlock);
}
void VideoBackendBase::RunLoop(bool enable)
{
VideoCommon_RunLoop(enable);
}
void VideoBackendBase::Video_GatherPipeBursted()
{
CommandProcessor::GatherPipeBursted();
}
int VideoBackendBase::Video_Sync(int ticks)
{
return Fifo_Update(ticks);
}
void VideoBackendBase::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
{
CommandProcessor::RegisterMMIO(mmio, base);
}
void VideoBackendBase::UpdateWantDeterminism(bool want)
{
Fifo_UpdateWantDeterminism(want);
}

View File

@ -62,13 +62,10 @@ class VideoBackendBase
public:
virtual ~VideoBackendBase() {}
void EmuStateChange(EMUSTATE_CHANGE);
virtual unsigned int PeekMessages() = 0;
virtual bool Initialize(void* window_handle) = 0;
virtual void Shutdown() = 0;
void RunLoop(bool enable);
virtual std::string GetName() const = 0;
virtual std::string GetDisplayName() const { return GetName(); }
@ -76,7 +73,6 @@ public:
virtual void ShowConfig(void*) = 0;
virtual void Video_Prepare() = 0;
void Video_EnterLoop();
void Video_ExitLoop();
virtual void Video_Cleanup() = 0; // called from gl/d3d thread
@ -87,35 +83,15 @@ public:
u32 Video_GetQueryResult(PerfQueryType type);
u16 Video_GetBoundingBox(int index);
void Video_AddMessage(const std::string& msg, unsigned int milliseconds);
void Video_ClearMessages();
bool Video_Screenshot(const std::string& filename);
void Video_SetRendering(bool bEnabled);
void Video_GatherPipeBursted();
int Video_Sync(int ticks);
// Registers MMIO handlers for the CommandProcessor registers.
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base);
static void PopulateList();
static void ClearList();
static void ActivateBackend(const std::string& name);
// waits until is paused and fully idle, and acquires a lock on that state.
// or, if doLock is false, releases a lock on that state and optionally unpauses.
// calls must be balanced and non-recursive (once with doLock true, then once with doLock false).
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true);
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
void DoState(PointerWrap &p);
void CheckInvalidState();
void UpdateWantDeterminism(bool want);
protected:
void InitializeShared();