mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VideoBackend: Remove simple wrapper functions.
This commit is contained in:
@ -64,7 +64,9 @@
|
|||||||
#include "DiscIO/FileMonitor.h"
|
#include "DiscIO/FileMonitor.h"
|
||||||
#include "InputCommon/GCAdapter.h"
|
#include "InputCommon/GCAdapter.h"
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
|
#include "VideoCommon/Fifo.h"
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
|
#include "VideoCommon/RenderBase.h"
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
|
||||||
// This can mostly be removed when we move to VS2015
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_video_backend->Video_AddMessage(message, time_in_ms);
|
OSD::AddMessage(message, time_in_ms);
|
||||||
Host_UpdateTitle(message);
|
Host_UpdateTitle(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +264,7 @@ void Stop() // - Hammertime!
|
|||||||
|
|
||||||
s_is_stopping = true;
|
s_is_stopping = true;
|
||||||
|
|
||||||
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_STOP);
|
EmulatorState(false);
|
||||||
|
|
||||||
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
|
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
|
||||||
|
|
||||||
@ -534,7 +536,7 @@ void EmuThread()
|
|||||||
s_cpu_thread = std::thread(cpuThreadFunc);
|
s_cpu_thread = std::thread(cpuThreadFunc);
|
||||||
|
|
||||||
// become the GPU thread
|
// become the GPU thread
|
||||||
g_video_backend->Video_EnterLoop();
|
RunGpuLoop();
|
||||||
|
|
||||||
// We have now exited the Video Loop
|
// We have now exited the Video Loop
|
||||||
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Video Loop Ended").c_str());
|
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());
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Main Emu thread stopped").c_str());
|
||||||
|
|
||||||
// Clear on screen messages that haven't expired
|
// 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
|
// Reload sysconf file in order to see changes committed during emulation
|
||||||
if (core_parameter.bWii)
|
if (core_parameter.bWii)
|
||||||
@ -693,7 +695,7 @@ void SaveScreenShot()
|
|||||||
|
|
||||||
SetState(CORE_PAUSE);
|
SetState(CORE_PAUSE);
|
||||||
|
|
||||||
g_video_backend->Video_Screenshot(GenerateScreenshotName());
|
Renderer::SetScreenshot(GenerateScreenshotName());
|
||||||
|
|
||||||
if (!bPaused)
|
if (!bPaused)
|
||||||
SetState(CORE_RUN);
|
SetState(CORE_RUN);
|
||||||
@ -707,7 +709,7 @@ void SaveScreenShot(const std::string& name)
|
|||||||
|
|
||||||
std::string filePath = GenerateScreenshotFolderPath() + name + ".png";
|
std::string filePath = GenerateScreenshotFolderPath() + name + ".png";
|
||||||
|
|
||||||
g_video_backend->Video_Screenshot(filePath);
|
Renderer::SetScreenshot(filePath);
|
||||||
|
|
||||||
if (!bPaused)
|
if (!bPaused)
|
||||||
SetState(CORE_RUN);
|
SetState(CORE_RUN);
|
||||||
@ -736,7 +738,7 @@ bool PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
|||||||
DSP::GetDSPEmulator()->PauseAndLock(doLock, unpauseOnUnlock);
|
DSP::GetDSPEmulator()->PauseAndLock(doLock, unpauseOnUnlock);
|
||||||
|
|
||||||
// video has to come after CPU, because CPU thread can wait for video thread (s_efbAccessRequested).
|
// 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)
|
#if defined(__LIBUSB__) || defined(_WIN32)
|
||||||
GCAdapter::ResetRumble();
|
GCAdapter::ResetRumble();
|
||||||
@ -888,7 +890,7 @@ void UpdateWantDeterminism(bool initial)
|
|||||||
|
|
||||||
g_want_determinism = new_want_determinism;
|
g_want_determinism = new_want_determinism;
|
||||||
WiiSockMan::GetInstance().UpdateWantDeterminism(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.
|
// We need to clear the cache because some parts of the JIT depend on want_determinism, e.g. use of FMA.
|
||||||
JitInterface::ClearCache();
|
JitInterface::ClearCache();
|
||||||
Common::InitializeWiiRoot(g_want_determinism);
|
Common::InitializeWiiRoot(g_want_determinism);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
|
#include "VideoCommon/Fifo.h"
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
|
||||||
#define MAX_SLICE_LENGTH 20000
|
#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
|
//the VI will be desynchronized. So, We are waiting until the FIFO finish and
|
||||||
//while we process only the events required by the FIFO.
|
//while we process only the events required by the FIFO.
|
||||||
ProcessFifoWaitEvents();
|
ProcessFifoWaitEvents();
|
||||||
g_video_backend->Video_Sync(0);
|
Fifo_Update(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
idledCycles += DowncountToCycles(PowerPC::ppcState.downcount);
|
idledCycles += DowncountToCycles(PowerPC::ppcState.downcount);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "Core/HW/DSP.h"
|
#include "Core/HW/DSP.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
#include "VideoCommon/Fifo.h"
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -114,7 +115,7 @@ void EnableStepping(const bool stepping)
|
|||||||
{
|
{
|
||||||
PowerPC::Pause();
|
PowerPC::Pause();
|
||||||
m_StepEvent.Reset();
|
m_StepEvent.Reset();
|
||||||
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_PAUSE);
|
EmulatorState(false);
|
||||||
AudioCommon::ClearAudioBuffer(true);
|
AudioCommon::ClearAudioBuffer(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -137,7 +138,7 @@ void EnableStepping(const bool stepping)
|
|||||||
}
|
}
|
||||||
PowerPC::Start();
|
PowerPC::Start();
|
||||||
m_StepEvent.Set();
|
m_StepEvent.Set();
|
||||||
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_PLAY);
|
EmulatorState(true);
|
||||||
AudioCommon::ClearAudioBuffer(false);
|
AudioCommon::ClearAudioBuffer(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "Core/PowerPC/JitInterface.h"
|
#include "Core/PowerPC/JitInterface.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
|
#include "VideoCommon/CommandProcessor.h"
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
|
||||||
namespace GPFifo
|
namespace GPFifo
|
||||||
@ -80,7 +81,7 @@ static void UpdateGatherPipe()
|
|||||||
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_video_backend->Video_GatherPipeBursted();
|
CommandProcessor::GatherPipeBursted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// move back the spill bytes
|
// move back the spill bytes
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/PowerPC/JitCommon/JitBase.h"
|
#include "Core/PowerPC/JitCommon/JitBase.h"
|
||||||
|
|
||||||
|
#include "VideoCommon/CommandProcessor.h"
|
||||||
#include "VideoCommon/PixelEngine.h"
|
#include "VideoCommon/PixelEngine.h"
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ MMIO::Mapping* mmio_mapping;
|
|||||||
|
|
||||||
static void InitMMIO(MMIO::Mapping* mmio)
|
static void InitMMIO(MMIO::Mapping* mmio)
|
||||||
{
|
{
|
||||||
g_video_backend->RegisterCPMMIO(mmio, 0x0C000000);
|
CommandProcessor::RegisterMMIO(mmio, 0x0C000000);
|
||||||
PixelEngine::RegisterMMIO(mmio, 0x0C001000);
|
PixelEngine::RegisterMMIO(mmio, 0x0C001000);
|
||||||
VideoInterface::RegisterMMIO(mmio, 0x0C002000);
|
VideoInterface::RegisterMMIO(mmio, 0x0C002000);
|
||||||
ProcessorInterface::RegisterMMIO(mmio, 0x0C003000);
|
ProcessorInterface::RegisterMMIO(mmio, 0x0C003000);
|
||||||
|
@ -128,7 +128,7 @@ static void VICallback(u64 userdata, int cyclesLate)
|
|||||||
static void CPCallback(u64 userdata, int cyclesLate)
|
static void CPCallback(u64 userdata, int cyclesLate)
|
||||||
{
|
{
|
||||||
u64 now = CoreTiming::GetTicks();
|
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;
|
s_last_sync_gpu_tick = now;
|
||||||
|
|
||||||
if (next > 0)
|
if (next > 0)
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "InputCommon/GCPadStatus.h"
|
#include "InputCommon/GCPadStatus.h"
|
||||||
|
#include "VideoCommon/Fifo.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
// The chunk to allocate movie data in multiples of.
|
// 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...
|
// Don't forget to re-enable rendering in case it wasn't...
|
||||||
// as this won't be changed anymore when frameskip is turned off
|
// as this won't be changed anymore when frameskip is turned off
|
||||||
if (framesToSkip == 0)
|
if (framesToSkip == 0)
|
||||||
g_video_backend->Video_SetRendering(true);
|
Fifo_SetRendering(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPolledDevice()
|
void SetPolledDevice()
|
||||||
@ -288,7 +289,7 @@ void FrameSkipping()
|
|||||||
if (s_frameSkipCounter > s_framesToSkip || Core::ShouldSkipFrame(s_frameSkipCounter) == false)
|
if (s_frameSkipCounter > s_framesToSkip || Core::ShouldSkipFrame(s_frameSkipCounter) == false)
|
||||||
s_frameSkipCounter = 0;
|
s_frameSkipCounter = 0;
|
||||||
|
|
||||||
g_video_backend->Video_SetRendering(!s_frameSkipCounter);
|
Fifo_SetRendering(!s_frameSkipCounter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,28 +29,12 @@ static volatile struct
|
|||||||
u32 fbHeight;
|
u32 fbHeight;
|
||||||
} s_beginFieldArgs;
|
} 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()
|
void VideoBackendBase::Video_ExitLoop()
|
||||||
{
|
{
|
||||||
ExitGpuLoop();
|
ExitGpuLoop();
|
||||||
s_FifoShuttingDown.Set();
|
s_FifoShuttingDown.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBackendBase::Video_SetRendering(bool bEnabled)
|
|
||||||
{
|
|
||||||
Fifo_SetRendering(bEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run from the CPU thread (from VideoInterface.cpp)
|
// Run from the CPU thread (from VideoInterface.cpp)
|
||||||
void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight)
|
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)
|
u32 VideoBackendBase::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
|
||||||
{
|
{
|
||||||
if (!g_ActiveConfig.bEFBAccessEnable)
|
if (!g_ActiveConfig.bEFBAccessEnable)
|
||||||
@ -225,34 +192,3 @@ void VideoBackendBase::CheckInvalidState()
|
|||||||
TextureCacheBase::Invalidate();
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -62,13 +62,10 @@ class VideoBackendBase
|
|||||||
public:
|
public:
|
||||||
virtual ~VideoBackendBase() {}
|
virtual ~VideoBackendBase() {}
|
||||||
|
|
||||||
void EmuStateChange(EMUSTATE_CHANGE);
|
|
||||||
|
|
||||||
virtual unsigned int PeekMessages() = 0;
|
virtual unsigned int PeekMessages() = 0;
|
||||||
|
|
||||||
virtual bool Initialize(void* window_handle) = 0;
|
virtual bool Initialize(void* window_handle) = 0;
|
||||||
virtual void Shutdown() = 0;
|
virtual void Shutdown() = 0;
|
||||||
void RunLoop(bool enable);
|
|
||||||
|
|
||||||
virtual std::string GetName() const = 0;
|
virtual std::string GetName() const = 0;
|
||||||
virtual std::string GetDisplayName() const { return GetName(); }
|
virtual std::string GetDisplayName() const { return GetName(); }
|
||||||
@ -76,7 +73,6 @@ public:
|
|||||||
virtual void ShowConfig(void*) = 0;
|
virtual void ShowConfig(void*) = 0;
|
||||||
|
|
||||||
virtual void Video_Prepare() = 0;
|
virtual void Video_Prepare() = 0;
|
||||||
void Video_EnterLoop();
|
|
||||||
void Video_ExitLoop();
|
void Video_ExitLoop();
|
||||||
virtual void Video_Cleanup() = 0; // called from gl/d3d thread
|
virtual void Video_Cleanup() = 0; // called from gl/d3d thread
|
||||||
|
|
||||||
@ -87,35 +83,15 @@ public:
|
|||||||
u32 Video_GetQueryResult(PerfQueryType type);
|
u32 Video_GetQueryResult(PerfQueryType type);
|
||||||
u16 Video_GetBoundingBox(int index);
|
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 PopulateList();
|
||||||
static void ClearList();
|
static void ClearList();
|
||||||
static void ActivateBackend(const std::string& name);
|
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
|
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
|
||||||
void DoState(PointerWrap &p);
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
void CheckInvalidState();
|
void CheckInvalidState();
|
||||||
|
|
||||||
void UpdateWantDeterminism(bool want);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitializeShared();
|
void InitializeShared();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user