summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2016-06-26 12:48:59 +0200
committerGitHub <noreply@github.com>2016-06-26 12:48:59 +0200
commit3887328bbaf43320b22ef2ca4ade325c23789d0f (patch)
tree4b3501c75657ecca47e85e3aa3fd4361641b78a3 /Source/Core/VideoCommon
parentb16333a25cc0d8396f71fa1e410484026adea964 (diff)
parentd79aeaa1e9b224b3bb147c605fb8ffd6e2bfc890 (diff)
Merge pull request #3510 from degasus/master
VideoBackends: Merge backend initialization and shutdown.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/CommandProcessor.cpp4
-rw-r--r--Source/Core/VideoCommon/CommandProcessor.h1
-rw-r--r--Source/Core/VideoCommon/GeometryShaderManager.cpp4
-rw-r--r--Source/Core/VideoCommon/GeometryShaderManager.h1
-rw-r--r--Source/Core/VideoCommon/MainBase.cpp65
-rw-r--r--Source/Core/VideoCommon/OpcodeDecoding.cpp4
-rw-r--r--Source/Core/VideoCommon/OpcodeDecoding.h1
-rw-r--r--Source/Core/VideoCommon/PixelShaderManager.cpp4
-rw-r--r--Source/Core/VideoCommon/PixelShaderManager.h1
-rw-r--r--Source/Core/VideoCommon/VertexLoaderManager.cpp2
-rw-r--r--Source/Core/VideoCommon/VertexLoaderManager.h2
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp4
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.h1
-rw-r--r--Source/Core/VideoCommon/VideoBackendBase.h5
-rw-r--r--Source/Core/VideoCommon/VideoState.cpp7
-rw-r--r--Source/Core/VideoCommon/VideoState.h1
16 files changed, 70 insertions, 37 deletions
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..eeed59e597 100644
--- a/Source/Core/VideoCommon/MainBase.cpp
+++ b/Source/Core/VideoCommon/MainBase.cpp
@@ -9,12 +9,23 @@
#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"
+#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"
@@ -147,13 +158,65 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index)
return result;
}
+void VideoBackendBase::ShowConfig(void* parent_handle)
+{
+ if (!m_initialized)
+ InitBackendInfo();
+
+ Host_ShowVideoConfig(parent_handle, GetDisplayName());
+}
+
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();
+
+ g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.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 <bool is_preprocess>
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 <bool is_preprocess = false>
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<std::mutex> 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<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>>;
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..3db7cd917f 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.h
+++ b/Source/Core/VideoCommon/VideoBackendBase.h
@@ -73,7 +73,8 @@ public:
virtual std::string GetName() const = 0;
virtual std::string GetDisplayName() const { return GetName(); }
- virtual void ShowConfig(void*) = 0;
+ void ShowConfig(void*);
+ virtual void InitBackendInfo() = 0;
virtual void Video_Prepare() = 0;
void Video_ExitLoop();
@@ -98,6 +99,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();