Merge pull request #3504 from degasus/master

VideoBackend: Cleanup API a bit.
This commit is contained in:
Pierre Bourdon
2016-01-13 01:27:24 +01:00
38 changed files with 142 additions and 264 deletions
+2 -2
View File
@@ -189,7 +189,7 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->m_strVideoBackend = strBackend;
config->sBackend = sBackend;
config->m_strGPUDeterminismMode = m_strGPUDeterminismMode;
VideoBackend::ActivateBackend(config->m_strVideoBackend);
VideoBackendBase::ActivateBackend(config->m_strVideoBackend);
}
static ConfigCache config_cache;
@@ -264,7 +264,7 @@ bool BootCore(const std::string& _rFilename)
config_cache.bSetVolume = true;
dsp_section->Get("EnableJIT", &SConfig::GetInstance().m_DSPEnableJIT, SConfig::GetInstance().m_DSPEnableJIT);
dsp_section->Get("Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend);
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
VideoBackendBase::ActivateBackend(StartUp.m_strVideoBackend);
core_section->Get("GPUDeterminismMode", &StartUp.m_strGPUDeterminismMode, StartUp.m_strGPUDeterminismMode);
for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i)
+10 -8
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);
Fifo::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();
Fifo::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);
+2 -1
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);
+3 -2
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);
Fifo::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);
Fifo::EmulatorState(true);
AudioCommon::ClearAudioBuffer(false);
}
}
+2 -1
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
+2 -1
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);
+2 -2
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)
@@ -181,7 +181,7 @@ static void PatchEngineCallback(u64 userdata, int cyclesLate)
static void ThrottleCallback(u64 last_time, int cyclesLate)
{
// Allow the GPU thread to sleep. Setting this flag here limits the wakeups to 1 kHz.
GpuMaySleep();
Fifo::GpuMaySleep();
u32 time = Common::Timer::GetTimeMs();
+3 -2
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);
}
}
+1 -1
View File
@@ -121,7 +121,7 @@ bool DolphinApp::OnInit()
if (m_select_audio_emulation)
SConfig::GetInstance().bDSPHLE = (m_audio_emulation_name.Upper() == "HLE");
VideoBackend::ActivateBackend(SConfig::GetInstance().m_strVideoBackend);
VideoBackendBase::ActivateBackend(SConfig::GetInstance().m_strVideoBackend);
// Enable the PNG image handler for screenshots
wxImage::AddHandler(new wxPNGHandler);
@@ -61,7 +61,7 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:"));
wxChoice* const choice_backend = new wxChoice(page_general, wxID_ANY);
for (const VideoBackend* backend : g_available_video_backends)
for (const VideoBackendBase* backend : g_available_video_backends)
{
choice_backend->AppendString(StrToWxStr(backend->GetDisplayName()));
}
@@ -24,7 +24,7 @@ public:
void Event_Backend(wxCommandEvent &ev)
{
VideoBackend* new_backend = g_available_video_backends[ev.GetInt()];
VideoBackendBase* new_backend = g_available_video_backends[ev.GetInt()];
if (g_video_backend != new_backend)
{
+1 -1
View File
@@ -235,7 +235,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
choice_backend = new wxChoice(page_general, wxID_ANY);
RegisterControl(choice_backend, wxGetTranslation(backend_desc));
for (const VideoBackend* backend : g_available_video_backends)
for (const VideoBackendBase* backend : g_available_video_backends)
{
choice_backend->AppendString(wxGetTranslation(StrToWxStr(backend->GetDisplayName())));
}
+1 -1
View File
@@ -82,7 +82,7 @@ public:
protected:
void Event_Backend(wxCommandEvent &ev)
{
VideoBackend* new_backend = g_available_video_backends[ev.GetInt()];
VideoBackendBase* new_backend = g_available_video_backends[ev.GetInt()];
if (g_video_backend != new_backend)
{
bool do_switch = !Core::IsRunning();
+3 -3
View File
@@ -26,10 +26,10 @@ void Init()
{
LogManager::Init();
SConfig::Init();
VideoBackend::PopulateList();
VideoBackendBase::PopulateList();
WiimoteReal::LoadSettings();
GCAdapter::Init();
VideoBackend::ActivateBackend(SConfig::GetInstance().m_strVideoBackend);
VideoBackendBase::ActivateBackend(SConfig::GetInstance().m_strVideoBackend);
SetEnableAlert(SConfig::GetInstance().bUsePanicHandlers);
}
@@ -38,7 +38,7 @@ void Shutdown()
{
GCAdapter::Shutdown();
WiimoteReal::Shutdown();
VideoBackend::ClearList();
VideoBackendBase::ClearList();
SConfig::Shutdown();
LogManager::Shutdown();
}
+1 -1
View File
@@ -718,7 +718,7 @@ void formatBufferDump(const u8* in, u8* out, int w, int h, int p)
// This function has the final picture. We adjust the aspect ratio here.
void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, float Gamma)
{
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
if (Fifo::g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
{
if (SConfig::GetInstance().m_DumpFrames && !frame_data.empty())
AVIDump::AddFrame(&frame_data[0], fbWidth, fbHeight);
+1 -1
View File
@@ -10,7 +10,7 @@
namespace DX11
{
class VideoBackend : public VideoBackendHardware
class VideoBackend : public VideoBackendBase
{
bool Initialize(void*) override;
void Shutdown() override;
+2 -2
View File
@@ -183,7 +183,7 @@ void VideoBackend::Video_Prepare()
// VideoCommon
BPInit();
Fifo_Init();
Fifo::Init();
IndexGenerator::Init();
VertexLoaderManager::Init();
OpcodeDecoder_Init();
@@ -206,7 +206,7 @@ void VideoBackend::Shutdown()
if (g_renderer)
{
// VideoCommon
Fifo_Shutdown();
Fifo::Shutdown();
CommandProcessor::Shutdown();
GeometryShaderManager::Shutdown();
PixelShaderManager::Shutdown();
+1 -1
View File
@@ -1235,7 +1235,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
}
static int w = 0, h = 0;
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
if (Fifo::g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
{
DumpFrame(frame_data, w, h);
Core::Callback_VideoCopiedToXFB(false);
+1 -1
View File
@@ -10,7 +10,7 @@
namespace OGL
{
class VideoBackend : public VideoBackendHardware
class VideoBackend : public VideoBackendBase
{
bool Initialize(void *) override;
void Shutdown() override;
+2 -2
View File
@@ -181,7 +181,7 @@ void VideoBackend::Video_Prepare()
BPInit();
g_vertex_manager = std::make_unique<VertexManager>();
g_perf_query = GetPerfQuery();
Fifo_Init(); // must be done before OpcodeDecoder_Init()
Fifo::Init(); // must be done before OpcodeDecoder_Init()
OpcodeDecoder_Init();
IndexGenerator::Init();
VertexShaderManager::Init();
@@ -215,7 +215,7 @@ void VideoBackend::Video_Cleanup()
if (!g_renderer)
return;
Fifo_Shutdown();
Fifo::Shutdown();
// The following calls are NOT Thread Safe
// And need to be called from the video thread

Some files were not shown because too many files have changed in this diff Show More