mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #3510 from degasus/master
VideoBackends: Merge backend initialization and shutdown.
This commit is contained in:
@@ -143,7 +143,7 @@ void Host_SetWiiMoteConnectionState(int _State)
|
||||
{
|
||||
}
|
||||
|
||||
void Host_ShowVideoConfig(void*, const std::string&, const std::string&)
|
||||
void Host_ShowVideoConfig(void*, const std::string&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ void Host_SetWiiMoteConnectionState(int _State);
|
||||
void Host_UpdateDisasmDialog();
|
||||
void Host_UpdateMainFrame();
|
||||
void Host_UpdateTitle(const std::string& title);
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
|
||||
const std::string& config_name);
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name);
|
||||
|
||||
// TODO (neobrain): Remove this from host!
|
||||
void* Host_GetRenderHandle();
|
||||
|
||||
@@ -121,8 +121,7 @@ void Host_SetWiiMoteConnectionState(int state)
|
||||
void Host_ConnectWiimote(int wm_idx, bool connect)
|
||||
{
|
||||
}
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
|
||||
const std::string& config_name)
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name)
|
||||
{
|
||||
}
|
||||
void Host_RefreshDSPDebuggerWindow()
|
||||
|
||||
@@ -555,17 +555,16 @@ void Host_ConnectWiimote(int wm_idx, bool connect)
|
||||
}
|
||||
}
|
||||
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
|
||||
const std::string& config_name)
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name)
|
||||
{
|
||||
if (backend_name == "Software Renderer")
|
||||
{
|
||||
SoftwareVideoConfigDialog diag((wxWindow*)parent, backend_name, config_name);
|
||||
SoftwareVideoConfigDialog diag((wxWindow*)parent, backend_name);
|
||||
diag.ShowModal();
|
||||
}
|
||||
else
|
||||
{
|
||||
VideoConfigDiag diag((wxWindow*)parent, backend_name, config_name);
|
||||
VideoConfigDiag diag((wxWindow*)parent, backend_name);
|
||||
diag.ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ void Host_SetWiiMoteConnectionState(int _State)
|
||||
{
|
||||
}
|
||||
|
||||
void Host_ShowVideoConfig(void*, const std::string&, const std::string&)
|
||||
void Host_ShowVideoConfig(void*, const std::string&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -31,17 +31,13 @@ IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& se
|
||||
Bind(wxEVT_SPINCTRL, &IntegerSetting::UpdateValue, this);
|
||||
}
|
||||
|
||||
SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title,
|
||||
const std::string& ininame)
|
||||
SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title)
|
||||
: wxDialog(parent, wxID_ANY,
|
||||
wxString(wxString::Format(_("Dolphin %s Graphics Configuration"), title)))
|
||||
{
|
||||
VideoConfig& vconfig = g_Config;
|
||||
|
||||
if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
|
||||
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
else
|
||||
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");
|
||||
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
|
||||
wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
class SoftwareVideoConfigDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title, const std::string& ininame);
|
||||
SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title);
|
||||
~SoftwareVideoConfigDialog();
|
||||
|
||||
void Event_Backend(wxCommandEvent& ev)
|
||||
|
||||
@@ -329,16 +329,12 @@ static wxArrayString GetListOfResolutions()
|
||||
}
|
||||
#endif
|
||||
|
||||
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title,
|
||||
const std::string& ininame)
|
||||
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
|
||||
: wxDialog(parent, wxID_ANY, wxString::Format(_("Dolphin %s Graphics Configuration"),
|
||||
wxGetTranslation(StrToWxStr(title)))),
|
||||
vconfig(g_Config)
|
||||
{
|
||||
if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
|
||||
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
else
|
||||
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");
|
||||
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
|
||||
Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
class VideoConfigDiag : public wxDialog
|
||||
{
|
||||
public:
|
||||
VideoConfigDiag(wxWindow* parent, const std::string& title, const std::string& ininame);
|
||||
VideoConfigDiag(wxWindow* parent, const std::string& title);
|
||||
|
||||
protected:
|
||||
void Event_Backend(wxCommandEvent& ev)
|
||||
|
||||
@@ -20,7 +20,7 @@ class VideoBackend : public VideoBackendBase
|
||||
void Video_Prepare() override;
|
||||
void Video_Cleanup() override;
|
||||
|
||||
void ShowConfig(void* parent) override;
|
||||
void InitBackendInfo() override;
|
||||
|
||||
unsigned int PeekMessages() override;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ std::string VideoBackend::GetDisplayName() const
|
||||
return "Direct3D 11";
|
||||
}
|
||||
|
||||
void InitBackendInfo()
|
||||
void VideoBackend::InitBackendInfo()
|
||||
{
|
||||
HRESULT hr = DX11::D3D::LoadDXGI();
|
||||
if (SUCCEEDED(hr))
|
||||
@@ -138,34 +138,15 @@ void InitBackendInfo()
|
||||
DX11::D3D::UnloadD3D();
|
||||
}
|
||||
|
||||
void VideoBackend::ShowConfig(void* hParent)
|
||||
{
|
||||
InitBackendInfo();
|
||||
Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx11");
|
||||
}
|
||||
|
||||
bool VideoBackend::Initialize(void* window_handle)
|
||||
{
|
||||
if (window_handle == nullptr)
|
||||
return false;
|
||||
|
||||
InitializeShared();
|
||||
InitBackendInfo();
|
||||
|
||||
frameCount = 0;
|
||||
|
||||
if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
else
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini");
|
||||
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
g_Config.VerifyValidity();
|
||||
UpdateActiveConfig();
|
||||
InitializeShared();
|
||||
|
||||
m_window_handle = window_handle;
|
||||
m_initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -181,55 +162,27 @@ void VideoBackend::Video_Prepare()
|
||||
PixelShaderCache::Init();
|
||||
GeometryShaderCache::Init();
|
||||
D3D::InitUtils();
|
||||
|
||||
// VideoCommon
|
||||
BPInit();
|
||||
Fifo::Init();
|
||||
IndexGenerator::Init();
|
||||
VertexLoaderManager::Init();
|
||||
OpcodeDecoder::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
GeometryShaderManager::Init();
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
BBox::Init();
|
||||
|
||||
// Tell the host that the window is ready
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
{
|
||||
m_initialized = false;
|
||||
|
||||
// TODO: should be in Video_Cleanup
|
||||
if (g_renderer)
|
||||
{
|
||||
// VideoCommon
|
||||
Fifo::Shutdown();
|
||||
CommandProcessor::Shutdown();
|
||||
GeometryShaderManager::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
OpcodeDecoder::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
D3D::ShutdownUtils();
|
||||
PixelShaderCache::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
GeometryShaderCache::Shutdown();
|
||||
BBox::Shutdown();
|
||||
|
||||
// internal interfaces
|
||||
D3D::ShutdownUtils();
|
||||
PixelShaderCache::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
GeometryShaderCache::Shutdown();
|
||||
BBox::Shutdown();
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
g_texture_cache.reset();
|
||||
g_renderer.reset();
|
||||
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
g_texture_cache.reset();
|
||||
g_renderer.reset();
|
||||
}
|
||||
ShutdownShared();
|
||||
}
|
||||
|
||||
void VideoBackend::Video_Cleanup()
|
||||
{
|
||||
CleanupShared();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class VideoBackend : public VideoBackendBase
|
||||
void Video_Prepare() override;
|
||||
void Video_Cleanup() override;
|
||||
|
||||
void ShowConfig(void* parent) override;
|
||||
void InitBackendInfo() override;
|
||||
|
||||
unsigned int PeekMessages() override;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ std::string VideoBackend::GetDisplayName() const
|
||||
return "Direct3D 12 (experimental)";
|
||||
}
|
||||
|
||||
void InitBackendInfo()
|
||||
void VideoBackend::InitBackendInfo()
|
||||
{
|
||||
HRESULT hr = D3D::LoadDXGI();
|
||||
if (FAILED(hr))
|
||||
@@ -152,37 +152,18 @@ void InitBackendInfo()
|
||||
D3D::UnloadDXGI();
|
||||
}
|
||||
|
||||
void VideoBackend::ShowConfig(void* hParent)
|
||||
{
|
||||
InitBackendInfo();
|
||||
Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx12");
|
||||
}
|
||||
|
||||
bool VideoBackend::Initialize(void* window_handle)
|
||||
{
|
||||
if (window_handle == nullptr)
|
||||
return false;
|
||||
|
||||
InitializeShared();
|
||||
InitBackendInfo();
|
||||
|
||||
frameCount = 0;
|
||||
|
||||
if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
else
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "gfx_dx12.ini");
|
||||
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
g_Config.VerifyValidity();
|
||||
UpdateActiveConfig();
|
||||
InitializeShared();
|
||||
|
||||
if (FAILED(D3D::Create((HWND)window_handle)))
|
||||
return false;
|
||||
|
||||
m_window_handle = window_handle;
|
||||
m_initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -200,62 +181,36 @@ void VideoBackend::Video_Prepare()
|
||||
StaticShaderCache::Init();
|
||||
StateCache::Init(); // PSO cache is populated here, after constituent shaders are loaded.
|
||||
D3D::InitUtils();
|
||||
|
||||
// VideoCommon
|
||||
BPInit();
|
||||
Fifo::Init();
|
||||
IndexGenerator::Init();
|
||||
VertexLoaderManager::Init();
|
||||
OpcodeDecoder::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
GeometryShaderManager::Init();
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
BBox::Init();
|
||||
|
||||
// Tell the host that the window is ready
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
{
|
||||
m_initialized = true;
|
||||
|
||||
// TODO: should be in Video_Cleanup
|
||||
if (g_renderer)
|
||||
{
|
||||
// Immediately stop app from submitting work to GPU, and wait for all submitted work to
|
||||
// complete. D3D12TODO: Check this.
|
||||
D3D::command_list_mgr->ExecuteQueuedWork(true);
|
||||
|
||||
// VideoCommon
|
||||
Fifo::Shutdown();
|
||||
CommandProcessor::Shutdown();
|
||||
GeometryShaderManager::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
OpcodeDecoder::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
// Immediately stop app from submitting work to GPU, and wait for all submitted work to complete.
|
||||
// D3D12TODO: Check this.
|
||||
D3D::command_list_mgr->ExecuteQueuedWork(true);
|
||||
|
||||
// internal interfaces
|
||||
D3D::ShutdownUtils();
|
||||
ShaderCache::Shutdown();
|
||||
ShaderConstantsManager::Shutdown();
|
||||
StaticShaderCache::Shutdown();
|
||||
BBox::Shutdown();
|
||||
// internal interfaces
|
||||
D3D::ShutdownUtils();
|
||||
ShaderCache::Shutdown();
|
||||
ShaderConstantsManager::Shutdown();
|
||||
StaticShaderCache::Shutdown();
|
||||
BBox::Shutdown();
|
||||
|
||||
g_xfb_encoder.reset();
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
g_texture_cache.reset();
|
||||
g_renderer.reset();
|
||||
g_xfb_encoder.reset();
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
g_texture_cache.reset();
|
||||
g_renderer.reset();
|
||||
|
||||
D3D::Close();
|
||||
}
|
||||
D3D::Close();
|
||||
|
||||
ShutdownShared();
|
||||
}
|
||||
|
||||
void VideoBackend::Video_Cleanup()
|
||||
{
|
||||
CleanupShared();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Null
|
||||
{
|
||||
static void InitBackendInfo()
|
||||
void VideoBackend::InitBackendInfo()
|
||||
{
|
||||
g_Config.backend_info.APIType = API_NONE;
|
||||
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
|
||||
@@ -50,39 +50,11 @@ static void InitBackendInfo()
|
||||
g_Config.backend_info.AAModes = {1};
|
||||
}
|
||||
|
||||
void VideoBackend::ShowConfig(void* parent)
|
||||
{
|
||||
InitBackendInfo();
|
||||
Host_ShowVideoConfig(parent, GetDisplayName(), "gfx_null");
|
||||
}
|
||||
|
||||
bool VideoBackend::Initialize(void* window_handle)
|
||||
{
|
||||
InitializeShared();
|
||||
InitBackendInfo();
|
||||
|
||||
// Load Configs
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
g_Config.VerifyValidity();
|
||||
UpdateActiveConfig();
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::CallbackType::Initialization);
|
||||
|
||||
// Initialize VideoCommon
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
BPInit();
|
||||
Fifo::Init();
|
||||
OpcodeDecoder::Init();
|
||||
IndexGenerator::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
VertexLoaderManager::Init();
|
||||
Host_Message(WM_USER_CREATE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,19 +74,12 @@ void VideoBackend::Video_Prepare()
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
{
|
||||
// Shutdown VideoCommon
|
||||
Fifo::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
OpcodeDecoder::Shutdown();
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::CallbackType::Shutdown);
|
||||
ShutdownShared();
|
||||
}
|
||||
|
||||
void VideoBackend::Video_Cleanup()
|
||||
{
|
||||
CleanupShared();
|
||||
PixelShaderCache::s_instance.reset();
|
||||
VertexShaderCache::s_instance.reset();
|
||||
GeometryShaderCache::s_instance.reset();
|
||||
|
||||
@@ -18,7 +18,7 @@ class VideoBackend : public VideoBackendBase
|
||||
void Video_Prepare() override;
|
||||
void Video_Cleanup() override;
|
||||
|
||||
void ShowConfig(void* parent) override;
|
||||
void InitBackendInfo() override;
|
||||
|
||||
unsigned int PeekMessages() override { return 0; }
|
||||
};
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "VideoCommon/DriverDetails.h"
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#include "VideoCommon/ImageWrite.h"
|
||||
#include "VideoCommon/IndexGenerator.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/PixelShaderManager.h"
|
||||
@@ -753,6 +754,8 @@ Renderer::Renderer()
|
||||
}
|
||||
}
|
||||
}
|
||||
IndexGenerator::Init();
|
||||
|
||||
UpdateActiveConfig();
|
||||
ClearEFBCache();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class VideoBackend : public VideoBackendBase
|
||||
void Video_Prepare() override;
|
||||
void Video_Cleanup() override;
|
||||
|
||||
void ShowConfig(void* parent) override;
|
||||
void InitBackendInfo() override;
|
||||
|
||||
unsigned int PeekMessages() override;
|
||||
};
|
||||
|
||||
@@ -106,7 +106,7 @@ static std::vector<std::string> GetShaders(const std::string& sub_dir = "")
|
||||
return result;
|
||||
}
|
||||
|
||||
static void InitBackendInfo()
|
||||
void VideoBackend::InitBackendInfo()
|
||||
{
|
||||
g_Config.backend_info.APIType = API_OPENGL;
|
||||
g_Config.backend_info.bSupportsExclusiveFullscreen = false;
|
||||
@@ -116,6 +116,12 @@ static void InitBackendInfo()
|
||||
g_Config.backend_info.bSupportsPostProcessing = true;
|
||||
g_Config.backend_info.bSupportsSSAA = true;
|
||||
|
||||
// Overwritten in Render.cpp later
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = true;
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = true;
|
||||
g_Config.backend_info.bSupportsPaletteConversion = true;
|
||||
g_Config.backend_info.bSupportsClipControl = true;
|
||||
|
||||
g_Config.backend_info.Adapters.clear();
|
||||
|
||||
// aamodes - 1 is to stay consistent with D3D (means no AA)
|
||||
@@ -126,40 +132,16 @@ static void InitBackendInfo()
|
||||
g_Config.backend_info.AnaglyphShaders = GetShaders(ANAGLYPH_DIR DIR_SEP);
|
||||
}
|
||||
|
||||
void VideoBackend::ShowConfig(void* parent_handle)
|
||||
{
|
||||
if (!m_initialized)
|
||||
InitBackendInfo();
|
||||
|
||||
Host_ShowVideoConfig(parent_handle, GetDisplayName(), "gfx_opengl");
|
||||
}
|
||||
|
||||
bool VideoBackend::Initialize(void* window_handle)
|
||||
{
|
||||
InitializeShared();
|
||||
InitBackendInfo();
|
||||
|
||||
frameCount = 0;
|
||||
|
||||
if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
||||
else
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini");
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
g_Config.VerifyValidity();
|
||||
UpdateActiveConfig();
|
||||
InitializeShared();
|
||||
|
||||
InitInterface();
|
||||
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
||||
if (!GLInterface->Create(window_handle))
|
||||
return false;
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::CallbackType::Initialization);
|
||||
|
||||
m_initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -171,65 +153,36 @@ void VideoBackend::Video_Prepare()
|
||||
|
||||
g_renderer = std::make_unique<Renderer>();
|
||||
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
|
||||
BPInit();
|
||||
g_vertex_manager = std::make_unique<VertexManager>();
|
||||
g_perf_query = GetPerfQuery();
|
||||
Fifo::Init(); // must be done before OpcodeDecoder::Init()
|
||||
OpcodeDecoder::Init();
|
||||
IndexGenerator::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
GeometryShaderManager::Init();
|
||||
ProgramShaderCache::Init();
|
||||
g_texture_cache = std::make_unique<TextureCache>();
|
||||
g_sampler_cache = std::make_unique<SamplerCache>();
|
||||
Renderer::Init();
|
||||
VertexLoaderManager::Init();
|
||||
TextureConverter::Init();
|
||||
BoundingBox::Init();
|
||||
|
||||
// Notify the core that the video backend is ready
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
{
|
||||
m_initialized = false;
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::CallbackType::Shutdown);
|
||||
|
||||
GLInterface->Shutdown();
|
||||
GLInterface.reset();
|
||||
ShutdownShared();
|
||||
}
|
||||
|
||||
void VideoBackend::Video_Cleanup()
|
||||
{
|
||||
if (!g_renderer)
|
||||
return;
|
||||
|
||||
Fifo::Shutdown();
|
||||
|
||||
// The following calls are NOT Thread Safe
|
||||
// And need to be called from the video thread
|
||||
CleanupShared();
|
||||
Renderer::Shutdown();
|
||||
BoundingBox::Shutdown();
|
||||
TextureConverter::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
g_sampler_cache.reset();
|
||||
g_texture_cache.reset();
|
||||
ProgramShaderCache::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
GeometryShaderManager::Shutdown();
|
||||
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
|
||||
OpcodeDecoder::Shutdown();
|
||||
g_renderer.reset();
|
||||
GLInterface->ClearCurrent();
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ std::string VideoSoftware::GetDisplayName() const
|
||||
return "Software Renderer";
|
||||
}
|
||||
|
||||
static void InitBackendInfo()
|
||||
void VideoSoftware::InitBackendInfo()
|
||||
{
|
||||
g_Config.backend_info.APIType = API_NONE;
|
||||
g_Config.backend_info.bSupports3DVision = false;
|
||||
@@ -147,23 +147,10 @@ static void InitBackendInfo()
|
||||
g_Config.backend_info.AAModes = {1};
|
||||
}
|
||||
|
||||
void VideoSoftware::ShowConfig(void* hParent)
|
||||
{
|
||||
if (!m_initialized)
|
||||
InitBackendInfo();
|
||||
Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_software");
|
||||
}
|
||||
|
||||
bool VideoSoftware::Initialize(void* window_handle)
|
||||
{
|
||||
InitializeShared();
|
||||
InitBackendInfo();
|
||||
|
||||
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str());
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
g_Config.VerifyValidity();
|
||||
UpdateActiveConfig();
|
||||
InitializeShared();
|
||||
|
||||
SWOGLWindow::Init(window_handle);
|
||||
|
||||
@@ -173,71 +160,41 @@ bool VideoSoftware::Initialize(void* window_handle)
|
||||
SWRenderer::Init();
|
||||
DebugUtil::Init();
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::CallbackType::Initialization);
|
||||
|
||||
m_initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void VideoSoftware::Shutdown()
|
||||
{
|
||||
m_initialized = false;
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::CallbackType::Shutdown);
|
||||
|
||||
SWOGLWindow::Shutdown();
|
||||
|
||||
ShutdownShared();
|
||||
}
|
||||
|
||||
void VideoSoftware::Video_Cleanup()
|
||||
{
|
||||
if (g_renderer)
|
||||
{
|
||||
Fifo::Shutdown();
|
||||
SWRenderer::Shutdown();
|
||||
DebugUtil::Shutdown();
|
||||
// The following calls are NOT Thread Safe
|
||||
// And need to be called from the video thread
|
||||
SWRenderer::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
g_framebuffer_manager.reset();
|
||||
g_texture_cache.reset();
|
||||
VertexShaderManager::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
OpcodeDecoder::Shutdown();
|
||||
g_renderer.reset();
|
||||
}
|
||||
CleanupShared();
|
||||
|
||||
SWRenderer::Shutdown();
|
||||
DebugUtil::Shutdown();
|
||||
// The following calls are NOT Thread Safe
|
||||
// And need to be called from the video thread
|
||||
SWRenderer::Shutdown();
|
||||
g_framebuffer_manager.reset();
|
||||
g_texture_cache.reset();
|
||||
g_perf_query.reset();
|
||||
g_vertex_manager.reset();
|
||||
g_renderer.reset();
|
||||
}
|
||||
|
||||
// This is called after Video_Initialize() from the Core
|
||||
void VideoSoftware::Video_Prepare()
|
||||
{
|
||||
g_renderer = std::make_unique<SWRenderer>();
|
||||
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
|
||||
BPInit();
|
||||
g_vertex_manager = std::make_unique<SWVertexLoader>();
|
||||
g_perf_query = std::make_unique<PerfQuery>();
|
||||
Fifo::Init(); // must be done before OpcodeDecoder::Init()
|
||||
OpcodeDecoder::Init();
|
||||
IndexGenerator::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
g_texture_cache = std::make_unique<TextureCache>();
|
||||
SWRenderer::Init();
|
||||
VertexLoaderManager::Init();
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>();
|
||||
|
||||
// Notify the core that the video backend is ready
|
||||
Host_Message(WM_USER_CREATE);
|
||||
|
||||
INFO_LOG(VIDEO, "Video backend initialized.");
|
||||
}
|
||||
|
||||
unsigned int VideoSoftware::PeekMessages()
|
||||
|
||||
@@ -25,7 +25,7 @@ class VideoSoftware : public VideoBackendBase
|
||||
void Video_Prepare() override;
|
||||
void Video_Cleanup() override;
|
||||
|
||||
void ShowConfig(void* parent) override;
|
||||
void InitBackendInfo() override;
|
||||
|
||||
unsigned int PeekMessages() override;
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user