From 7833ff25df5cb3bf10b363d30d7af8007094454a Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 13 Jan 2016 21:14:20 +0100 Subject: [PATCH 1/3] VideoBackends: Merge Initialize and Shutdown functions. --- Source/Core/VideoBackends/D3D/VideoBackend.h | 1 + Source/Core/VideoBackends/D3D/main.cpp | 72 ++++------------ .../Core/VideoBackends/D3D12/VideoBackend.h | 1 + Source/Core/VideoBackends/D3D12/main.cpp | 84 ++++++------------- .../Core/VideoBackends/Null/NullBackend.cpp | 35 +------- Source/Core/VideoBackends/Null/VideoBackend.h | 1 + Source/Core/VideoBackends/OGL/Render.cpp | 3 + Source/Core/VideoBackends/OGL/VideoBackend.h | 1 + Source/Core/VideoBackends/OGL/main.cpp | 64 ++++---------- Source/Core/VideoBackends/Software/SWmain.cpp | 73 +++++----------- .../VideoBackends/Software/VideoBackend.h | 1 + Source/Core/VideoCommon/CommandProcessor.cpp | 4 - Source/Core/VideoCommon/CommandProcessor.h | 1 - .../VideoCommon/GeometryShaderManager.cpp | 4 - .../Core/VideoCommon/GeometryShaderManager.h | 1 - Source/Core/VideoCommon/MainBase.cpp | 59 ++++++++++++- Source/Core/VideoCommon/OpcodeDecoding.cpp | 4 - Source/Core/VideoCommon/OpcodeDecoding.h | 1 - .../Core/VideoCommon/PixelShaderManager.cpp | 4 - Source/Core/VideoCommon/PixelShaderManager.h | 1 - .../Core/VideoCommon/VertexLoaderManager.cpp | 2 +- Source/Core/VideoCommon/VertexLoaderManager.h | 2 +- .../Core/VideoCommon/VertexShaderManager.cpp | 4 - Source/Core/VideoCommon/VertexShaderManager.h | 1 - Source/Core/VideoCommon/VideoBackendBase.h | 4 + Source/Core/VideoCommon/VideoState.cpp | 7 -- Source/Core/VideoCommon/VideoState.h | 1 - 27 files changed, 154 insertions(+), 282 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/VideoBackend.h b/Source/Core/VideoBackends/D3D/VideoBackend.h index 59491f735d..363c4b5068 100644 --- a/Source/Core/VideoBackends/D3D/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D/VideoBackend.h @@ -16,6 +16,7 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 8fd9989a92..791eda2a08 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -61,6 +61,11 @@ std::string VideoBackend::GetDisplayName() const return "Direct3D 11"; } +std::string VideoBackend::GetConfigName() const +{ + return "gfx_dx11"; +} + void InitBackendInfo() { HRESULT hr = DX11::D3D::LoadDXGI(); @@ -141,7 +146,7 @@ void InitBackendInfo() void VideoBackend::ShowConfig(void* hParent) { InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx11"); + Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); } bool VideoBackend::Initialize(void* window_handle) @@ -149,23 +154,10 @@ 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 +173,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(); } } diff --git a/Source/Core/VideoBackends/D3D12/VideoBackend.h b/Source/Core/VideoBackends/D3D12/VideoBackend.h index 9fbf639238..2efb3fba69 100644 --- a/Source/Core/VideoBackends/D3D12/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D12/VideoBackend.h @@ -16,6 +16,7 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/D3D12/main.cpp b/Source/Core/VideoBackends/D3D12/main.cpp index c0be65c7c4..5fc1658c9f 100644 --- a/Source/Core/VideoBackends/D3D12/main.cpp +++ b/Source/Core/VideoBackends/D3D12/main.cpp @@ -62,6 +62,11 @@ std::string VideoBackend::GetDisplayName() const return "Direct3D 12 (experimental)"; } +std::string VideoBackend::GetConfigName() const +{ + return "gfx_dx12"; +} + void InitBackendInfo() { HRESULT hr = D3D::LoadDXGI(); @@ -155,7 +160,7 @@ void InitBackendInfo() void VideoBackend::ShowConfig(void* hParent) { InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx12"); + Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); } bool VideoBackend::Initialize(void* window_handle) @@ -163,26 +168,13 @@ 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 +192,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(); } } diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp index 7a1691b9d5..2a1555ed27 100644 --- a/Source/Core/VideoBackends/Null/NullBackend.cpp +++ b/Source/Core/VideoBackends/Null/NullBackend.cpp @@ -53,7 +53,7 @@ static void InitBackendInfo() void VideoBackend::ShowConfig(void* parent) { InitBackendInfo(); - Host_ShowVideoConfig(parent, GetDisplayName(), "gfx_null"); + Host_ShowVideoConfig(parent, GetDisplayName(), GetConfigName()); } bool VideoBackend::Initialize(void* window_handle) @@ -61,28 +61,6 @@ 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 +80,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(); diff --git a/Source/Core/VideoBackends/Null/VideoBackend.h b/Source/Core/VideoBackends/Null/VideoBackend.h index e83f4b8279..46b7e39fc4 100644 --- a/Source/Core/VideoBackends/Null/VideoBackend.h +++ b/Source/Core/VideoBackends/Null/VideoBackend.h @@ -15,6 +15,7 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override { return "Null"; } std::string GetDisplayName() const override { return "Null"; } + std::string GetConfigName() const override { return "gfx_null"; } void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 8805a4bea8..bde616deac 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -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(); } diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h index 755ed9fa6f..b658615dd8 100644 --- a/Source/Core/VideoBackends/OGL/VideoBackend.h +++ b/Source/Core/VideoBackends/OGL/VideoBackend.h @@ -16,6 +16,7 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 48b580ad2d..9f08f62601 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -91,6 +91,11 @@ std::string VideoBackend::GetDisplayName() const return "OpenGL"; } +std::string VideoBackend::GetConfigName() const +{ + return "gfx_opengl"; +} + static std::vector GetShaders(const std::string& sub_dir = "") { std::vector paths = @@ -116,6 +121,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) @@ -131,35 +142,19 @@ void VideoBackend::ShowConfig(void* parent_handle) if (!m_initialized) InitBackendInfo(); - Host_ShowVideoConfig(parent_handle, GetDisplayName(), "gfx_opengl"); + Host_ShowVideoConfig(parent_handle, GetDisplayName(), GetConfigName()); } 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 +166,36 @@ void VideoBackend::Video_Prepare() g_renderer = std::make_unique(); - CommandProcessor::Init(); - PixelEngine::Init(); - - BPInit(); g_vertex_manager = std::make_unique(); 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(); g_sampler_cache = std::make_unique(); 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(); } diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index 083e9766e7..f37bc4aa14 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -134,6 +134,11 @@ std::string VideoSoftware::GetDisplayName() const return "Software Renderer"; } +std::string VideoSoftware::GetConfigName() const +{ + return "gfx_software"; +} + static void InitBackendInfo() { g_Config.backend_info.APIType = API_NONE; @@ -151,19 +156,13 @@ void VideoSoftware::ShowConfig(void* hParent) { if (!m_initialized) InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_software"); + Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); } 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 +172,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(); - - CommandProcessor::Init(); - PixelEngine::Init(); - - BPInit(); g_vertex_manager = std::make_unique(); g_perf_query = std::make_unique(); - Fifo::Init(); // must be done before OpcodeDecoder::Init() - OpcodeDecoder::Init(); - IndexGenerator::Init(); - VertexShaderManager::Init(); - PixelShaderManager::Init(); g_texture_cache = std::make_unique(); SWRenderer::Init(); - VertexLoaderManager::Init(); g_framebuffer_manager = std::make_unique(); - - // Notify the core that the video backend is ready - Host_Message(WM_USER_CREATE); - - INFO_LOG(VIDEO, "Video backend initialized."); } unsigned int VideoSoftware::PeekMessages() diff --git a/Source/Core/VideoBackends/Software/VideoBackend.h b/Source/Core/VideoBackends/Software/VideoBackend.h index efb057d968..121961c21c 100644 --- a/Source/Core/VideoBackends/Software/VideoBackend.h +++ b/Source/Core/VideoBackends/Software/VideoBackend.h @@ -21,6 +21,7 @@ class VideoSoftware : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp index fe53ffe8fe..cd471aae44 100644 --- a/Source/Core/VideoCommon/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/CommandProcessor.cpp @@ -453,10 +453,6 @@ void SetCPStatusFromCPU() } } -void Shutdown() -{ -} - void SetCpStatusRegister() { // Here always there is one fifo attached to the GPU diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h index 372ed55c3f..043062630e 100644 --- a/Source/Core/VideoCommon/CommandProcessor.h +++ b/Source/Core/VideoCommon/CommandProcessor.h @@ -119,7 +119,6 @@ union UCPClearReg { // Init void Init(); -void Shutdown(); void DoState(PointerWrap& p); void RegisterMMIO(MMIO::Mapping* mmio, u32 base); diff --git a/Source/Core/VideoCommon/GeometryShaderManager.cpp b/Source/Core/VideoCommon/GeometryShaderManager.cpp index 533bed8ecd..1bb841459d 100644 --- a/Source/Core/VideoCommon/GeometryShaderManager.cpp +++ b/Source/Core/VideoCommon/GeometryShaderManager.cpp @@ -30,10 +30,6 @@ void GeometryShaderManager::Init() dirty = true; } -void GeometryShaderManager::Shutdown() -{ -} - void GeometryShaderManager::Dirty() { // This function is called after a savestate is loaded. diff --git a/Source/Core/VideoCommon/GeometryShaderManager.h b/Source/Core/VideoCommon/GeometryShaderManager.h index 878c6d72bd..55f3b8ad43 100644 --- a/Source/Core/VideoCommon/GeometryShaderManager.h +++ b/Source/Core/VideoCommon/GeometryShaderManager.h @@ -15,7 +15,6 @@ class GeometryShaderManager public: static void Init(); static void Dirty(); - static void Shutdown(); static void DoState(PointerWrap& p); static void SetConstants(); diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index 6b2e3c91c3..a084e0cc09 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -9,12 +9,22 @@ #include "Common/Event.h" #include "Common/Flag.h" #include "Common/Logging/Log.h" +#include "Core/Host.h" #include "VideoCommon/AsyncRequests.h" #include "VideoCommon/BPStructs.h" +#include "VideoCommon/CPMemory.h" +#include "VideoCommon/CommandProcessor.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/GeometryShaderManager.h" +#include "VideoCommon/IndexGenerator.h" +#include "VideoCommon/OnScreenDisplay.h" +#include "VideoCommon/OpcodeDecoding.h" +#include "VideoCommon/PixelEngine.h" +#include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/VertexLoaderManager.h" +#include "VideoCommon/VertexShaderManager.h" #include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoState.h" @@ -149,11 +159,58 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index) void VideoBackendBase::InitializeShared() { - VideoCommon_Init(); + memset(&g_main_cp_state, 0, sizeof(g_main_cp_state)); + memset(&g_preprocess_cp_state, 0, sizeof(g_preprocess_cp_state)); + memset(texMem, 0, TMEM_SIZE); + + // Do our OSD callbacks + OSD::DoCallbacks(OSD::CallbackType::Initialization); + + // do not initialize again for the config window + m_initialized = true; s_FifoShuttingDown.Clear(); memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs)); m_invalid = false; + frameCount = 0; + + CommandProcessor::Init(); + Fifo::Init(); + OpcodeDecoder::Init(); + PixelEngine::Init(); + BPInit(); + VertexLoaderManager::Init(); + IndexGenerator::Init(); + VertexShaderManager::Init(); + GeometryShaderManager::Init(); + PixelShaderManager::Init(); + + 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) + GetConfigName() + ".ini"); + g_Config.GameIniLoad(); + g_Config.UpdateProjectionHack(); + g_Config.VerifyValidity(); + UpdateActiveConfig(); + + // Notify the core that the video backend is ready + Host_Message(WM_USER_CREATE); +} + +void VideoBackendBase::ShutdownShared() +{ + // Do our OSD callbacks + OSD::DoCallbacks(OSD::CallbackType::Shutdown); + + m_initialized = false; + + Fifo::Shutdown(); +} + +void VideoBackendBase::CleanupShared() +{ + VertexLoaderManager::Clear(); } // Run from the CPU thread diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 8932cde5fa..0a2d3c4014 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -121,10 +121,6 @@ void Init() s_bFifoErrorSeen = false; } -void Shutdown() -{ -} - template u8* Run(DataReader src, u32* cycles, bool in_display_list) { diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 13a68548d2..df462e0c30 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -42,7 +42,6 @@ class DataReader; namespace OpcodeDecoder { void Init(); -void Shutdown(); template u8* Run(DataReader src, u32* cycles, bool in_display_list); diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index be1a9cd1f3..b77f5e31a2 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -56,10 +56,6 @@ void PixelShaderManager::Dirty() dirty = true; } -void PixelShaderManager::Shutdown() -{ -} - void PixelShaderManager::SetConstants() { if (s_bFogRangeAdjustChanged) diff --git a/Source/Core/VideoCommon/PixelShaderManager.h b/Source/Core/VideoCommon/PixelShaderManager.h index 32493a6eec..fe57fd4655 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.h +++ b/Source/Core/VideoCommon/PixelShaderManager.h @@ -15,7 +15,6 @@ class PixelShaderManager public: static void Init(); static void Dirty(); - static void Shutdown(); static void DoState(PointerWrap& p); static void SetConstants(); // sets pixel shader constants diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index c8fa5485a9..7975ea1eb7 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -57,7 +57,7 @@ void Init() SETSTAT(stats.numVertexLoaders, 0); } -void Shutdown() +void Clear() { std::lock_guard lk(s_vertex_loader_map_lock); s_vertex_loader_map.clear(); diff --git a/Source/Core/VideoCommon/VertexLoaderManager.h b/Source/Core/VideoCommon/VertexLoaderManager.h index 1386df2381..2b273bb80f 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.h +++ b/Source/Core/VideoCommon/VertexLoaderManager.h @@ -20,7 +20,7 @@ using NativeVertexFormatMap = std::unordered_map>; void Init(); -void Shutdown(); +void Clear(); void MarkAllDirty(); diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index c90195f13e..19fb1f371d 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -216,10 +216,6 @@ void VertexShaderManager::Init() dirty = true; } -void VertexShaderManager::Shutdown() -{ -} - void VertexShaderManager::Dirty() { // This function is called after a savestate is loaded. diff --git a/Source/Core/VideoCommon/VertexShaderManager.h b/Source/Core/VideoCommon/VertexShaderManager.h index 1820a7fa71..a3da612b56 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.h +++ b/Source/Core/VideoCommon/VertexShaderManager.h @@ -19,7 +19,6 @@ class VertexShaderManager public: static void Init(); static void Dirty(); - static void Shutdown(); static void DoState(PointerWrap& p); // constant management diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index bc08469002..a5571c98fc 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -73,6 +73,8 @@ public: virtual std::string GetName() const = 0; virtual std::string GetDisplayName() const { return GetName(); } + virtual std::string GetConfigName() const = 0; + virtual void ShowConfig(void*) = 0; virtual void Video_Prepare() = 0; @@ -98,6 +100,8 @@ public: protected: void InitializeShared(); + void ShutdownShared(); + void CleanupShared(); bool m_initialized = false; bool m_invalid = false; diff --git a/Source/Core/VideoCommon/VideoState.cpp b/Source/Core/VideoCommon/VideoState.cpp index 6caccd5fd9..3eed6b5de0 100644 --- a/Source/Core/VideoCommon/VideoState.cpp +++ b/Source/Core/VideoCommon/VideoState.cpp @@ -65,10 +65,3 @@ void VideoCommon_DoState(PointerWrap& p) // TODO: search for more data that should be saved and add it here } - -void VideoCommon_Init() -{ - memset(&g_main_cp_state, 0, sizeof(g_main_cp_state)); - memset(&g_preprocess_cp_state, 0, sizeof(g_preprocess_cp_state)); - memset(texMem, 0, TMEM_SIZE); -} diff --git a/Source/Core/VideoCommon/VideoState.h b/Source/Core/VideoCommon/VideoState.h index 0f15c977f7..ec9b3e584e 100644 --- a/Source/Core/VideoCommon/VideoState.h +++ b/Source/Core/VideoCommon/VideoState.h @@ -7,4 +7,3 @@ class PointerWrap; void VideoCommon_DoState(PointerWrap& p); -void VideoCommon_Init(); From 5f2f4620676198bb63eeb169358435037491d4ad Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 13 Jan 2016 21:38:11 +0100 Subject: [PATCH 2/3] VideoBackends: Merge ShowConfig functions. --- Source/Core/VideoBackends/D3D/VideoBackend.h | 2 +- Source/Core/VideoBackends/D3D/main.cpp | 8 +------- Source/Core/VideoBackends/D3D12/VideoBackend.h | 2 +- Source/Core/VideoBackends/D3D12/main.cpp | 8 +------- Source/Core/VideoBackends/Null/NullBackend.cpp | 8 +------- Source/Core/VideoBackends/Null/VideoBackend.h | 2 +- Source/Core/VideoBackends/OGL/VideoBackend.h | 2 +- Source/Core/VideoBackends/OGL/main.cpp | 10 +--------- Source/Core/VideoBackends/Software/SWmain.cpp | 9 +-------- Source/Core/VideoBackends/Software/VideoBackend.h | 2 +- Source/Core/VideoCommon/MainBase.cpp | 9 +++++++++ Source/Core/VideoCommon/VideoBackendBase.h | 3 ++- 12 files changed, 21 insertions(+), 44 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/VideoBackend.h b/Source/Core/VideoBackends/D3D/VideoBackend.h index 363c4b5068..a6d3f45edc 100644 --- a/Source/Core/VideoBackends/D3D/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D/VideoBackend.h @@ -21,7 +21,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; diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 791eda2a08..c900e2aa37 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -66,7 +66,7 @@ std::string VideoBackend::GetConfigName() const return "gfx_dx11"; } -void InitBackendInfo() +void VideoBackend::InitBackendInfo() { HRESULT hr = DX11::D3D::LoadDXGI(); if (SUCCEEDED(hr)) @@ -143,12 +143,6 @@ void InitBackendInfo() DX11::D3D::UnloadD3D(); } -void VideoBackend::ShowConfig(void* hParent) -{ - InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); -} - bool VideoBackend::Initialize(void* window_handle) { if (window_handle == nullptr) diff --git a/Source/Core/VideoBackends/D3D12/VideoBackend.h b/Source/Core/VideoBackends/D3D12/VideoBackend.h index 2efb3fba69..207a768477 100644 --- a/Source/Core/VideoBackends/D3D12/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D12/VideoBackend.h @@ -21,7 +21,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; diff --git a/Source/Core/VideoBackends/D3D12/main.cpp b/Source/Core/VideoBackends/D3D12/main.cpp index 5fc1658c9f..8604735706 100644 --- a/Source/Core/VideoBackends/D3D12/main.cpp +++ b/Source/Core/VideoBackends/D3D12/main.cpp @@ -67,7 +67,7 @@ std::string VideoBackend::GetConfigName() const return "gfx_dx12"; } -void InitBackendInfo() +void VideoBackend::InitBackendInfo() { HRESULT hr = D3D::LoadDXGI(); if (FAILED(hr)) @@ -157,12 +157,6 @@ void InitBackendInfo() D3D::UnloadDXGI(); } -void VideoBackend::ShowConfig(void* hParent) -{ - InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); -} - bool VideoBackend::Initialize(void* window_handle) { if (window_handle == nullptr) diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp index 2a1555ed27..6d66a6920f 100644 --- a/Source/Core/VideoBackends/Null/NullBackend.cpp +++ b/Source/Core/VideoBackends/Null/NullBackend.cpp @@ -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,12 +50,6 @@ static void InitBackendInfo() g_Config.backend_info.AAModes = {1}; } -void VideoBackend::ShowConfig(void* parent) -{ - InitBackendInfo(); - Host_ShowVideoConfig(parent, GetDisplayName(), GetConfigName()); -} - bool VideoBackend::Initialize(void* window_handle) { InitializeShared(); diff --git a/Source/Core/VideoBackends/Null/VideoBackend.h b/Source/Core/VideoBackends/Null/VideoBackend.h index 46b7e39fc4..f853350de0 100644 --- a/Source/Core/VideoBackends/Null/VideoBackend.h +++ b/Source/Core/VideoBackends/Null/VideoBackend.h @@ -19,7 +19,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; } }; diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h index b658615dd8..3f3d76b5cf 100644 --- a/Source/Core/VideoBackends/OGL/VideoBackend.h +++ b/Source/Core/VideoBackends/OGL/VideoBackend.h @@ -21,7 +21,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; }; diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 9f08f62601..142004cbc3 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -111,7 +111,7 @@ static std::vector 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; @@ -137,14 +137,6 @@ 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(), GetConfigName()); -} - bool VideoBackend::Initialize(void* window_handle) { InitBackendInfo(); diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index f37bc4aa14..d5b9bed4ca 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -139,7 +139,7 @@ std::string VideoSoftware::GetConfigName() const return "gfx_software"; } -static void InitBackendInfo() +void VideoSoftware::InitBackendInfo() { g_Config.backend_info.APIType = API_NONE; g_Config.backend_info.bSupports3DVision = false; @@ -152,13 +152,6 @@ static void InitBackendInfo() g_Config.backend_info.AAModes = {1}; } -void VideoSoftware::ShowConfig(void* hParent) -{ - if (!m_initialized) - InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); -} - bool VideoSoftware::Initialize(void* window_handle) { InitBackendInfo(); diff --git a/Source/Core/VideoBackends/Software/VideoBackend.h b/Source/Core/VideoBackends/Software/VideoBackend.h index 121961c21c..4cca26462e 100644 --- a/Source/Core/VideoBackends/Software/VideoBackend.h +++ b/Source/Core/VideoBackends/Software/VideoBackend.h @@ -26,7 +26,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; }; diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index a084e0cc09..c51515eb89 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -9,6 +9,7 @@ #include "Common/Event.h" #include "Common/Flag.h" #include "Common/Logging/Log.h" +#include "Core/ConfigManager.h" #include "Core/Host.h" #include "VideoCommon/AsyncRequests.h" #include "VideoCommon/BPStructs.h" @@ -157,6 +158,14 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index) return result; } +void VideoBackendBase::ShowConfig(void* parent_handle) +{ + if (!m_initialized) + InitBackendInfo(); + + Host_ShowVideoConfig(parent_handle, GetDisplayName(), GetConfigName()); +} + void VideoBackendBase::InitializeShared() { memset(&g_main_cp_state, 0, sizeof(g_main_cp_state)); diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index a5571c98fc..ab0703b3a8 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -75,7 +75,8 @@ public: virtual std::string GetDisplayName() const { return GetName(); } virtual std::string GetConfigName() const = 0; - virtual void ShowConfig(void*) = 0; + void ShowConfig(void*); + virtual void InitBackendInfo() = 0; virtual void Video_Prepare() = 0; void Video_ExitLoop(); From d79aeaa1e9b224b3bb147c605fb8ffd6e2bfc890 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 26 Jun 2016 08:06:23 +0200 Subject: [PATCH 3/3] VideoCommon: Drop GetConfigName. We're past 5.0 now, so there is no need to look for old inis. --- Source/Android/jni/MainAndroid.cpp | 2 +- Source/Core/Core/Host.h | 3 +-- Source/Core/DolphinQt2/Host.cpp | 3 +-- Source/Core/DolphinWX/Main.cpp | 7 +++---- Source/Core/DolphinWX/MainNoGUI.cpp | 2 +- Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp | 8 ++------ Source/Core/DolphinWX/SoftwareVideoConfigDialog.h | 2 +- Source/Core/DolphinWX/VideoConfigDiag.cpp | 8 ++------ Source/Core/DolphinWX/VideoConfigDiag.h | 2 +- Source/Core/VideoBackends/D3D/VideoBackend.h | 1 - Source/Core/VideoBackends/D3D/main.cpp | 5 ----- Source/Core/VideoBackends/D3D12/VideoBackend.h | 1 - Source/Core/VideoBackends/D3D12/main.cpp | 5 ----- Source/Core/VideoBackends/Null/VideoBackend.h | 1 - Source/Core/VideoBackends/OGL/VideoBackend.h | 1 - Source/Core/VideoBackends/OGL/main.cpp | 5 ----- Source/Core/VideoBackends/Software/SWmain.cpp | 5 ----- Source/Core/VideoBackends/Software/VideoBackend.h | 1 - Source/Core/VideoCommon/MainBase.cpp | 7 ++----- Source/Core/VideoCommon/VideoBackendBase.h | 2 -- Source/UnitTests/TestUtils/StubHost.cpp | 2 +- 21 files changed, 16 insertions(+), 57 deletions(-) diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 4862e79080..2ccc634874 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -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&) { } diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h index b4a4ade373..c739f0dca1 100644 --- a/Source/Core/Core/Host.h +++ b/Source/Core/Core/Host.h @@ -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(); diff --git a/Source/Core/DolphinQt2/Host.cpp b/Source/Core/DolphinQt2/Host.cpp index c13e5a376b..62af45b489 100644 --- a/Source/Core/DolphinQt2/Host.cpp +++ b/Source/Core/DolphinQt2/Host.cpp @@ -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() diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 96fb4fa7f2..a9a7af6854 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -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(); } } diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 445a6c9fac..c262d6244b 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -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&) { } diff --git a/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp b/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp index f3737512e6..87c947bfcd 100644 --- a/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp +++ b/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp @@ -31,17 +31,13 @@ IntegerSetting::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); diff --git a/Source/Core/DolphinWX/SoftwareVideoConfigDialog.h b/Source/Core/DolphinWX/SoftwareVideoConfigDialog.h index 96c4cb4735..3fca996b91 100644 --- a/Source/Core/DolphinWX/SoftwareVideoConfigDialog.h +++ b/Source/Core/DolphinWX/SoftwareVideoConfigDialog.h @@ -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) diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index 64e4f7114e..9378d6fd7d 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -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); diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h index b6d0f2c515..cc07c62ca6 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/VideoConfigDiag.h @@ -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) diff --git a/Source/Core/VideoBackends/D3D/VideoBackend.h b/Source/Core/VideoBackends/D3D/VideoBackend.h index a6d3f45edc..81aa79417b 100644 --- a/Source/Core/VideoBackends/D3D/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D/VideoBackend.h @@ -16,7 +16,6 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; - std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index c900e2aa37..e630c177f9 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -61,11 +61,6 @@ std::string VideoBackend::GetDisplayName() const return "Direct3D 11"; } -std::string VideoBackend::GetConfigName() const -{ - return "gfx_dx11"; -} - void VideoBackend::InitBackendInfo() { HRESULT hr = DX11::D3D::LoadDXGI(); diff --git a/Source/Core/VideoBackends/D3D12/VideoBackend.h b/Source/Core/VideoBackends/D3D12/VideoBackend.h index 207a768477..d98ff9e5a2 100644 --- a/Source/Core/VideoBackends/D3D12/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D12/VideoBackend.h @@ -16,7 +16,6 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; - std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/D3D12/main.cpp b/Source/Core/VideoBackends/D3D12/main.cpp index 8604735706..a593220c56 100644 --- a/Source/Core/VideoBackends/D3D12/main.cpp +++ b/Source/Core/VideoBackends/D3D12/main.cpp @@ -62,11 +62,6 @@ std::string VideoBackend::GetDisplayName() const return "Direct3D 12 (experimental)"; } -std::string VideoBackend::GetConfigName() const -{ - return "gfx_dx12"; -} - void VideoBackend::InitBackendInfo() { HRESULT hr = D3D::LoadDXGI(); diff --git a/Source/Core/VideoBackends/Null/VideoBackend.h b/Source/Core/VideoBackends/Null/VideoBackend.h index f853350de0..5581d8511a 100644 --- a/Source/Core/VideoBackends/Null/VideoBackend.h +++ b/Source/Core/VideoBackends/Null/VideoBackend.h @@ -15,7 +15,6 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override { return "Null"; } std::string GetDisplayName() const override { return "Null"; } - std::string GetConfigName() const override { return "gfx_null"; } void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h index 3f3d76b5cf..17b542801d 100644 --- a/Source/Core/VideoBackends/OGL/VideoBackend.h +++ b/Source/Core/VideoBackends/OGL/VideoBackend.h @@ -16,7 +16,6 @@ class VideoBackend : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; - std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 142004cbc3..7fc91f86bf 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -91,11 +91,6 @@ std::string VideoBackend::GetDisplayName() const return "OpenGL"; } -std::string VideoBackend::GetConfigName() const -{ - return "gfx_opengl"; -} - static std::vector GetShaders(const std::string& sub_dir = "") { std::vector paths = diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index d5b9bed4ca..d34395570d 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -134,11 +134,6 @@ std::string VideoSoftware::GetDisplayName() const return "Software Renderer"; } -std::string VideoSoftware::GetConfigName() const -{ - return "gfx_software"; -} - void VideoSoftware::InitBackendInfo() { g_Config.backend_info.APIType = API_NONE; diff --git a/Source/Core/VideoBackends/Software/VideoBackend.h b/Source/Core/VideoBackends/Software/VideoBackend.h index 4cca26462e..99eec53a4e 100644 --- a/Source/Core/VideoBackends/Software/VideoBackend.h +++ b/Source/Core/VideoBackends/Software/VideoBackend.h @@ -21,7 +21,6 @@ class VideoSoftware : public VideoBackendBase std::string GetName() const override; std::string GetDisplayName() const override; - std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index c51515eb89..eeed59e597 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -163,7 +163,7 @@ void VideoBackendBase::ShowConfig(void* parent_handle) if (!m_initialized) InitBackendInfo(); - Host_ShowVideoConfig(parent_handle, GetDisplayName(), GetConfigName()); + Host_ShowVideoConfig(parent_handle, GetDisplayName()); } void VideoBackendBase::InitializeShared() @@ -194,10 +194,7 @@ void VideoBackendBase::InitializeShared() GeometryShaderManager::Init(); PixelShaderManager::Init(); - 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) + GetConfigName() + ".ini"); + g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"); g_Config.GameIniLoad(); g_Config.UpdateProjectionHack(); g_Config.VerifyValidity(); diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index ab0703b3a8..3db7cd917f 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -73,8 +73,6 @@ public: virtual std::string GetName() const = 0; virtual std::string GetDisplayName() const { return GetName(); } - virtual std::string GetConfigName() const = 0; - void ShowConfig(void*); virtual void InitBackendInfo() = 0; diff --git a/Source/UnitTests/TestUtils/StubHost.cpp b/Source/UnitTests/TestUtils/StubHost.cpp index cf2f4453fc..c6d1cbb12e 100644 --- a/Source/UnitTests/TestUtils/StubHost.cpp +++ b/Source/UnitTests/TestUtils/StubHost.cpp @@ -60,7 +60,7 @@ void Host_ConnectWiimote(int, bool) void Host_SetWiiMoteConnectionState(int) { } -void Host_ShowVideoConfig(void*, const std::string&, const std::string&) +void Host_ShowVideoConfig(void*, const std::string&) { } std::unique_ptr HostGL_CreateGLInterface()