Merge VideoBackendHardware into VideoBackend.
And rename it to VideoBackendBase because of conflicts within the backends itself.
This commit is contained in:
parent
12f745092c
commit
0c92603fd5
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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())));
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace DX11
|
||||
{
|
||||
|
||||
class VideoBackend : public VideoBackendHardware
|
||||
class VideoBackend : public VideoBackendBase
|
||||
{
|
||||
bool Initialize(void*) override;
|
||||
void Shutdown() override;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace OGL
|
||||
{
|
||||
|
||||
class VideoBackend : public VideoBackendHardware
|
||||
class VideoBackend : public VideoBackendBase
|
||||
{
|
||||
bool Initialize(void *) override;
|
||||
void Shutdown() override;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace MMIO { class Mapping; }
|
|||
namespace SW
|
||||
{
|
||||
|
||||
class VideoSoftware : public VideoBackendHardware
|
||||
class VideoSoftware : public VideoBackendBase
|
||||
{
|
||||
bool Initialize(void *window_handle) override;
|
||||
void Shutdown() override;
|
||||
|
|
|
@ -29,30 +29,30 @@ static volatile struct
|
|||
u32 fbHeight;
|
||||
} s_beginFieldArgs;
|
||||
|
||||
void VideoBackendHardware::EmuStateChange(EMUSTATE_CHANGE newState)
|
||||
void VideoBackendBase::EmuStateChange(EMUSTATE_CHANGE newState)
|
||||
{
|
||||
EmulatorState(newState == EMUSTATE_CHANGE_PLAY);
|
||||
}
|
||||
|
||||
// Enter and exit the video loop
|
||||
void VideoBackendHardware::Video_EnterLoop()
|
||||
void VideoBackendBase::Video_EnterLoop()
|
||||
{
|
||||
RunGpuLoop();
|
||||
}
|
||||
|
||||
void VideoBackendHardware::Video_ExitLoop()
|
||||
void VideoBackendBase::Video_ExitLoop()
|
||||
{
|
||||
ExitGpuLoop();
|
||||
s_FifoShuttingDown.Set();
|
||||
}
|
||||
|
||||
void VideoBackendHardware::Video_SetRendering(bool bEnabled)
|
||||
void VideoBackendBase::Video_SetRendering(bool bEnabled)
|
||||
{
|
||||
Fifo_SetRendering(bEnabled);
|
||||
}
|
||||
|
||||
// Run from the CPU thread (from VideoInterface.cpp)
|
||||
void VideoBackendHardware::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight)
|
||||
void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight)
|
||||
{
|
||||
if (m_initialized && g_ActiveConfig.bUseXFB)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ void VideoBackendHardware::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStri
|
|||
}
|
||||
|
||||
// Run from the CPU thread (from VideoInterface.cpp)
|
||||
void VideoBackendHardware::Video_EndField()
|
||||
void VideoBackendBase::Video_EndField()
|
||||
{
|
||||
if (m_initialized && g_ActiveConfig.bUseXFB && g_renderer)
|
||||
{
|
||||
|
@ -82,24 +82,24 @@ void VideoBackendHardware::Video_EndField()
|
|||
}
|
||||
}
|
||||
|
||||
void VideoBackendHardware::Video_AddMessage(const std::string& msg, u32 milliseconds)
|
||||
void VideoBackendBase::Video_AddMessage(const std::string& msg, u32 milliseconds)
|
||||
{
|
||||
OSD::AddMessage(msg, milliseconds);
|
||||
}
|
||||
|
||||
void VideoBackendHardware::Video_ClearMessages()
|
||||
void VideoBackendBase::Video_ClearMessages()
|
||||
{
|
||||
OSD::ClearMessages();
|
||||
}
|
||||
|
||||
// Screenshot
|
||||
bool VideoBackendHardware::Video_Screenshot(const std::string& filename)
|
||||
bool VideoBackendBase::Video_Screenshot(const std::string& filename)
|
||||
{
|
||||
Renderer::SetScreenshot(filename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 VideoBackendHardware::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)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ u32 VideoBackendHardware::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32
|
|||
}
|
||||
}
|
||||
|
||||
u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type)
|
||||
u32 VideoBackendBase::Video_GetQueryResult(PerfQueryType type)
|
||||
{
|
||||
if (!g_perf_query->ShouldEmulate())
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type)
|
|||
return g_perf_query->GetQueryResult(type);
|
||||
}
|
||||
|
||||
u16 VideoBackendHardware::Video_GetBoundingBox(int index)
|
||||
u16 VideoBackendBase::Video_GetBoundingBox(int index)
|
||||
{
|
||||
if (!g_ActiveConfig.backend_info.bSupportsBBox)
|
||||
return 0;
|
||||
|
@ -177,7 +177,7 @@ u16 VideoBackendHardware::Video_GetBoundingBox(int index)
|
|||
return result;
|
||||
}
|
||||
|
||||
void VideoBackendHardware::InitializeShared()
|
||||
void VideoBackendBase::InitializeShared()
|
||||
{
|
||||
VideoCommon_Init();
|
||||
|
||||
|
@ -187,7 +187,7 @@ void VideoBackendHardware::InitializeShared()
|
|||
}
|
||||
|
||||
// Run from the CPU thread
|
||||
void VideoBackendHardware::DoState(PointerWrap& p)
|
||||
void VideoBackendBase::DoState(PointerWrap& p)
|
||||
{
|
||||
bool software = false;
|
||||
p.Do(software);
|
||||
|
@ -202,7 +202,7 @@ void VideoBackendHardware::DoState(PointerWrap& p)
|
|||
p.DoMarker("VideoCommon");
|
||||
|
||||
p.Do(s_beginFieldArgs);
|
||||
p.DoMarker("VideoBackendHardware");
|
||||
p.DoMarker("VideoBackendBase");
|
||||
|
||||
// Refresh state.
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
|
@ -215,7 +215,7 @@ void VideoBackendHardware::DoState(PointerWrap& p)
|
|||
}
|
||||
}
|
||||
|
||||
void VideoBackendHardware::CheckInvalidState()
|
||||
void VideoBackendBase::CheckInvalidState()
|
||||
{
|
||||
if (m_invalid)
|
||||
{
|
||||
|
@ -226,32 +226,32 @@ void VideoBackendHardware::CheckInvalidState()
|
|||
}
|
||||
}
|
||||
|
||||
void VideoBackendHardware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
void VideoBackendBase::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
{
|
||||
Fifo_PauseAndLock(doLock, unpauseOnUnlock);
|
||||
}
|
||||
|
||||
void VideoBackendHardware::RunLoop(bool enable)
|
||||
void VideoBackendBase::RunLoop(bool enable)
|
||||
{
|
||||
VideoCommon_RunLoop(enable);
|
||||
}
|
||||
|
||||
void VideoBackendHardware::Video_GatherPipeBursted()
|
||||
void VideoBackendBase::Video_GatherPipeBursted()
|
||||
{
|
||||
CommandProcessor::GatherPipeBursted();
|
||||
}
|
||||
|
||||
int VideoBackendHardware::Video_Sync(int ticks)
|
||||
int VideoBackendBase::Video_Sync(int ticks)
|
||||
{
|
||||
return Fifo_Update(ticks);
|
||||
}
|
||||
|
||||
void VideoBackendHardware::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
void VideoBackendBase::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
{
|
||||
CommandProcessor::RegisterMMIO(mmio, base);
|
||||
}
|
||||
|
||||
void VideoBackendHardware::UpdateWantDeterminism(bool want)
|
||||
void VideoBackendBase::UpdateWantDeterminism(bool want)
|
||||
{
|
||||
Fifo_UpdateWantDeterminism(want);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
|
||||
std::vector<VideoBackend*> g_available_video_backends;
|
||||
VideoBackend* g_video_backend = nullptr;
|
||||
static VideoBackend* s_default_backend = nullptr;
|
||||
std::vector<VideoBackendBase*> g_available_video_backends;
|
||||
VideoBackendBase* g_video_backend = nullptr;
|
||||
static VideoBackendBase* s_default_backend = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
@ -26,9 +26,9 @@ __declspec(dllexport) DWORD NvOptimusEnablement = 1;
|
|||
}
|
||||
#endif
|
||||
|
||||
void VideoBackend::PopulateList()
|
||||
void VideoBackendBase::PopulateList()
|
||||
{
|
||||
VideoBackend* backends[4] = { nullptr };
|
||||
VideoBackendBase* backends[4] = { nullptr };
|
||||
|
||||
// OGL > D3D11 > SW
|
||||
g_available_video_backends.push_back(backends[0] = new OGL::VideoBackend);
|
||||
|
@ -37,7 +37,7 @@ void VideoBackend::PopulateList()
|
|||
#endif
|
||||
g_available_video_backends.push_back(backends[3] = new SW::VideoSoftware);
|
||||
|
||||
for (VideoBackend* backend : backends)
|
||||
for (VideoBackendBase* backend : backends)
|
||||
{
|
||||
if (backend)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ void VideoBackend::PopulateList()
|
|||
}
|
||||
}
|
||||
|
||||
void VideoBackend::ClearList()
|
||||
void VideoBackendBase::ClearList()
|
||||
{
|
||||
while (!g_available_video_backends.empty())
|
||||
{
|
||||
|
@ -56,12 +56,12 @@ void VideoBackend::ClearList()
|
|||
}
|
||||
}
|
||||
|
||||
void VideoBackend::ActivateBackend(const std::string& name)
|
||||
void VideoBackendBase::ActivateBackend(const std::string& name)
|
||||
{
|
||||
if (name.length() == 0) // If nullptr, set it to the default backend (expected behavior)
|
||||
g_video_backend = s_default_backend;
|
||||
|
||||
for (VideoBackend* backend : g_available_video_backends)
|
||||
for (VideoBackendBase* backend : g_available_video_backends)
|
||||
if (name == backend->GetName())
|
||||
g_video_backend = backend;
|
||||
}
|
||||
|
|
|
@ -57,18 +57,18 @@ struct SCPFifoStruct
|
|||
volatile u32 bFF_HiWatermark;
|
||||
};
|
||||
|
||||
class VideoBackend
|
||||
class VideoBackendBase
|
||||
{
|
||||
public:
|
||||
virtual ~VideoBackend() {}
|
||||
virtual ~VideoBackendBase() {}
|
||||
|
||||
virtual void EmuStateChange(EMUSTATE_CHANGE) = 0;
|
||||
void EmuStateChange(EMUSTATE_CHANGE);
|
||||
|
||||
virtual unsigned int PeekMessages() = 0;
|
||||
|
||||
virtual bool Initialize(void* window_handle) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void RunLoop(bool enable) = 0;
|
||||
void RunLoop(bool enable);
|
||||
|
||||
virtual std::string GetName() const = 0;
|
||||
virtual std::string GetDisplayName() const { return GetName(); }
|
||||
|
@ -76,29 +76,29 @@ public:
|
|||
virtual void ShowConfig(void*) = 0;
|
||||
|
||||
virtual void Video_Prepare() = 0;
|
||||
virtual void Video_EnterLoop() = 0;
|
||||
virtual void Video_ExitLoop() = 0;
|
||||
void Video_EnterLoop();
|
||||
void Video_ExitLoop();
|
||||
virtual void Video_Cleanup() = 0; // called from gl/d3d thread
|
||||
|
||||
virtual void Video_BeginField(u32, u32, u32, u32) = 0;
|
||||
virtual void Video_EndField() = 0;
|
||||
void Video_BeginField(u32, u32, u32, u32);
|
||||
void Video_EndField();
|
||||
|
||||
virtual u32 Video_AccessEFB(EFBAccessType, u32, u32, u32) = 0;
|
||||
virtual u32 Video_GetQueryResult(PerfQueryType type) = 0;
|
||||
virtual u16 Video_GetBoundingBox(int index) = 0;
|
||||
u32 Video_AccessEFB(EFBAccessType, u32, u32, u32);
|
||||
u32 Video_GetQueryResult(PerfQueryType type);
|
||||
u16 Video_GetBoundingBox(int index);
|
||||
|
||||
virtual void Video_AddMessage(const std::string& msg, unsigned int milliseconds) = 0;
|
||||
virtual void Video_ClearMessages() = 0;
|
||||
virtual bool Video_Screenshot(const std::string& filename) = 0;
|
||||
void Video_AddMessage(const std::string& msg, unsigned int milliseconds);
|
||||
void Video_ClearMessages();
|
||||
bool Video_Screenshot(const std::string& filename);
|
||||
|
||||
virtual void Video_SetRendering(bool bEnabled) = 0;
|
||||
void Video_SetRendering(bool bEnabled);
|
||||
|
||||
virtual void Video_GatherPipeBursted() = 0;
|
||||
void Video_GatherPipeBursted();
|
||||
|
||||
virtual int Video_Sync(int ticks) = 0;
|
||||
int Video_Sync(int ticks);
|
||||
|
||||
// Registers MMIO handlers for the CommandProcessor registers.
|
||||
virtual void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) = 0;
|
||||
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base);
|
||||
|
||||
static void PopulateList();
|
||||
static void ClearList();
|
||||
|
@ -107,60 +107,21 @@ public:
|
|||
// 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).
|
||||
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) = 0;
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true);
|
||||
|
||||
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
|
||||
virtual void DoState(PointerWrap &p) = 0;
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
virtual void CheckInvalidState() = 0;
|
||||
void CheckInvalidState();
|
||||
|
||||
virtual void UpdateWantDeterminism(bool want) {}
|
||||
|
||||
protected:
|
||||
bool m_initialized = false;
|
||||
};
|
||||
|
||||
extern std::vector<VideoBackend*> g_available_video_backends;
|
||||
extern VideoBackend* g_video_backend;
|
||||
|
||||
// inherited by D3D/OGL backends
|
||||
class VideoBackendHardware : public VideoBackend
|
||||
{
|
||||
void RunLoop(bool enable) override;
|
||||
|
||||
void EmuStateChange(EMUSTATE_CHANGE) override;
|
||||
|
||||
void Video_EnterLoop() override;
|
||||
void Video_ExitLoop() override;
|
||||
void Video_BeginField(u32, u32, u32, u32) override;
|
||||
void Video_EndField() override;
|
||||
|
||||
u32 Video_AccessEFB(EFBAccessType, u32, u32, u32) override;
|
||||
u32 Video_GetQueryResult(PerfQueryType type) override;
|
||||
u16 Video_GetBoundingBox(int index) override;
|
||||
|
||||
void Video_AddMessage(const std::string& pstr, unsigned int milliseconds) override;
|
||||
void Video_ClearMessages() override;
|
||||
bool Video_Screenshot(const std::string& filename) override;
|
||||
|
||||
void Video_SetRendering(bool bEnabled) override;
|
||||
|
||||
void Video_GatherPipeBursted() override;
|
||||
|
||||
int Video_Sync(int ticks) override;
|
||||
|
||||
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
|
||||
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) override;
|
||||
void DoState(PointerWrap &p) override;
|
||||
|
||||
void UpdateWantDeterminism(bool want) override;
|
||||
|
||||
bool m_invalid;
|
||||
|
||||
public:
|
||||
void CheckInvalidState() override;
|
||||
void UpdateWantDeterminism(bool want);
|
||||
|
||||
protected:
|
||||
void InitializeShared();
|
||||
|
||||
bool m_initialized = false;
|
||||
bool m_invalid = false;
|
||||
};
|
||||
|
||||
extern std::vector<VideoBackendBase*> g_available_video_backends;
|
||||
extern VideoBackendBase* g_video_backend;
|
||||
|
|
Loading…
Reference in New Issue