forked from suyu/suyu
video_core: Make the renderer global a unique_ptr
This commit is contained in:
parent
4bc961d5fd
commit
5e17a586da
2 changed files with 10 additions and 6 deletions
|
@ -2,7 +2,10 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "common/emu_window.h"
|
#include "common/emu_window.h"
|
||||||
|
#include "common/make_unique.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -18,8 +21,8 @@
|
||||||
|
|
||||||
namespace VideoCore {
|
namespace VideoCore {
|
||||||
|
|
||||||
EmuWindow* g_emu_window = nullptr; ///< Frontend emulator window
|
EmuWindow* g_emu_window = nullptr; ///< Frontend emulator window
|
||||||
RendererBase* g_renderer = nullptr; ///< Renderer plugin
|
std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
||||||
|
|
||||||
std::atomic<bool> g_hw_renderer_enabled;
|
std::atomic<bool> g_hw_renderer_enabled;
|
||||||
std::atomic<bool> g_shader_jit_enabled;
|
std::atomic<bool> g_shader_jit_enabled;
|
||||||
|
@ -29,7 +32,7 @@ void Init(EmuWindow* emu_window) {
|
||||||
Pica::Init();
|
Pica::Init();
|
||||||
|
|
||||||
g_emu_window = emu_window;
|
g_emu_window = emu_window;
|
||||||
g_renderer = new RendererOpenGL();
|
g_renderer = Common::make_unique<RendererOpenGL>();
|
||||||
g_renderer->SetWindow(g_emu_window);
|
g_renderer->SetWindow(g_emu_window);
|
||||||
g_renderer->Init();
|
g_renderer->Init();
|
||||||
|
|
||||||
|
@ -40,7 +43,7 @@ void Init(EmuWindow* emu_window) {
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
Pica::Shutdown();
|
Pica::Shutdown();
|
||||||
|
|
||||||
delete g_renderer;
|
g_renderer.reset();
|
||||||
|
|
||||||
LOG_DEBUG(Render, "shutdown OK");
|
LOG_DEBUG(Render, "shutdown OK");
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
class RendererBase;
|
class RendererBase;
|
||||||
|
@ -29,8 +30,8 @@ static const int kScreenBottomHeight = 240; ///< 3DS bottom screen height
|
||||||
// Video core renderer
|
// Video core renderer
|
||||||
// ---------------------
|
// ---------------------
|
||||||
|
|
||||||
extern RendererBase* g_renderer; ///< Renderer plugin
|
extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
||||||
extern EmuWindow* g_emu_window; ///< Emu window
|
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)
|
// 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;
|
extern std::atomic<bool> g_hw_renderer_enabled;
|
||||||
|
|
Loading…
Reference in a new issue