summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-12-30 17:12:30 +0100
committerbunnei <bunneidev@gmail.com>2015-12-30 17:12:30 +0100
commit82087672b7eba5a42e081c29b8e7b79cb4f77a25 (patch)
treedf3d942ea9730a53d2597cad0b8c86cd31321d6b
parentMerge pull request #1306 from Subv/sync (diff)
parentvideo_core: Make the renderer global a unique_ptr (diff)
downloadyuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.tar
yuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.tar.gz
yuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.tar.bz2
yuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.tar.lz
yuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.tar.xz
yuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.tar.zst
yuzu-82087672b7eba5a42e081c29b8e7b79cb4f77a25.zip
-rw-r--r--src/video_core/video_core.cpp11
-rw-r--r--src/video_core/video_core.h5
2 files changed, 10 insertions, 6 deletions
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index eaddda668..912db91a4 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -2,7 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <memory>
+
#include "common/emu_window.h"
+#include "common/make_unique.h"
#include "common/logging/log.h"
#include "core/core.h"
@@ -18,8 +21,8 @@
namespace VideoCore {
-EmuWindow* g_emu_window = nullptr; ///< Frontend emulator window
-RendererBase* g_renderer = nullptr; ///< Renderer plugin
+EmuWindow* g_emu_window = nullptr; ///< Frontend emulator window
+std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
std::atomic<bool> g_hw_renderer_enabled;
std::atomic<bool> g_shader_jit_enabled;
@@ -29,7 +32,7 @@ void Init(EmuWindow* emu_window) {
Pica::Init();
g_emu_window = emu_window;
- g_renderer = new RendererOpenGL();
+ g_renderer = Common::make_unique<RendererOpenGL>();
g_renderer->SetWindow(g_emu_window);
g_renderer->Init();
@@ -40,7 +43,7 @@ void Init(EmuWindow* emu_window) {
void Shutdown() {
Pica::Shutdown();
- delete g_renderer;
+ g_renderer.reset();
LOG_DEBUG(Render, "shutdown OK");
}
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 2867bf03e..accb0a4eb 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -5,6 +5,7 @@
#pragma once
#include <atomic>
+#include <memory>
class EmuWindow;
class RendererBase;
@@ -29,8 +30,8 @@ static const int kScreenBottomHeight = 240; ///< 3DS bottom screen height
// Video core renderer
// ---------------------
-extern RendererBase* g_renderer; ///< Renderer plugin
-extern EmuWindow* g_emu_window; ///< Emu window
+extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
+extern EmuWindow* g_emu_window; ///< Emu window
// TODO: Wrap these in a user settings struct along with any other graphics settings (often set from qt ui)
extern std::atomic<bool> g_hw_renderer_enabled;