Merge pull request #3369 from lioncash/unique
VideoBackends: Simplify initialization and deinitialization of resources
This commit is contained in:
commit
365a326798
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
@ -20,19 +22,19 @@
|
||||||
#error Platform doesnt have a GLInterface
|
#error Platform doesnt have a GLInterface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cInterfaceBase* HostGL_CreateGLInterface()
|
std::unique_ptr<cInterfaceBase> HostGL_CreateGLInterface()
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
return new cInterfaceEGLAndroid;
|
return std::make_unique<cInterfaceEGLAndroid>();
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
return new cInterfaceAGL;
|
return std::make_unique<cInterfaceAGL>();
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
return new cInterfaceWGL;
|
return std::make_unique<cInterfaceWGL>();
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
#if defined(USE_EGL) && USE_EGL
|
#if defined(USE_EGL) && USE_EGL
|
||||||
return new cInterfaceEGLX11;
|
return std::make_unique<cInterfaceEGLX11>();
|
||||||
#else
|
#else
|
||||||
return new cInterfaceGLX;
|
return std::make_unique<cInterfaceGLX>();
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
@ -42,8 +43,8 @@ public:
|
||||||
virtual bool PeekMessages() { return false; }
|
virtual bool PeekMessages() { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cInterfaceBase *GLInterface;
|
extern std::unique_ptr<cInterfaceBase> GLInterface;
|
||||||
|
|
||||||
// This function has to be defined along the Host_ functions from Core/Host.h.
|
// This function has to be defined along the Host_ functions from Core/Host.h.
|
||||||
// Current canonical implementation: DolphinWX/GLInterface/GLInterface.cpp.
|
// Current canonical implementation: DolphinWX/GLInterface/GLInterface.cpp.
|
||||||
cInterfaceBase* HostGL_CreateGLInterface();
|
std::unique_ptr<cInterfaceBase> HostGL_CreateGLInterface();
|
||||||
|
|
|
@ -2,12 +2,14 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
#include "Common/GL/GLUtil.h"
|
#include "Common/GL/GLUtil.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
|
||||||
cInterfaceBase *GLInterface;
|
std::unique_ptr<cInterfaceBase> GLInterface;
|
||||||
static GLuint attributelessVAO = 0;
|
static GLuint attributelessVAO = 0;
|
||||||
static GLuint attributelessVBO = 0;
|
static GLuint attributelessVBO = 0;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "VideoBackends/D3D/D3DBase.h"
|
#include "VideoBackends/D3D/D3DBase.h"
|
||||||
#include "VideoBackends/D3D/D3DShader.h"
|
#include "VideoBackends/D3D/D3DShader.h"
|
||||||
#include "VideoBackends/D3D/D3DState.h"
|
#include "VideoBackends/D3D/D3DState.h"
|
||||||
|
@ -21,7 +23,7 @@
|
||||||
namespace DX11
|
namespace DX11
|
||||||
{
|
{
|
||||||
|
|
||||||
static TextureEncoder* g_encoder = nullptr;
|
static std::unique_ptr<TextureEncoder> g_encoder;
|
||||||
const size_t MAX_COPY_BUFFERS = 32;
|
const size_t MAX_COPY_BUFFERS = 32;
|
||||||
ID3D11Buffer* efbcopycbuf[MAX_COPY_BUFFERS] = { 0 };
|
ID3D11Buffer* efbcopycbuf[MAX_COPY_BUFFERS] = { 0 };
|
||||||
|
|
||||||
|
@ -377,7 +379,7 @@ ID3D11PixelShader *GetConvertShader(const char* Type)
|
||||||
TextureCache::TextureCache()
|
TextureCache::TextureCache()
|
||||||
{
|
{
|
||||||
// FIXME: Is it safe here?
|
// FIXME: Is it safe here?
|
||||||
g_encoder = new PSTextureEncoder;
|
g_encoder = std::make_unique<PSTextureEncoder>();
|
||||||
g_encoder->Init();
|
g_encoder->Init();
|
||||||
|
|
||||||
palette_buf = nullptr;
|
palette_buf = nullptr;
|
||||||
|
@ -407,8 +409,7 @@ TextureCache::~TextureCache()
|
||||||
SAFE_RELEASE(efbcopycbuf[k]);
|
SAFE_RELEASE(efbcopycbuf[k]);
|
||||||
|
|
||||||
g_encoder->Shutdown();
|
g_encoder->Shutdown();
|
||||||
delete g_encoder;
|
g_encoder.reset();
|
||||||
g_encoder = nullptr;
|
|
||||||
|
|
||||||
SAFE_RELEASE(palette_buf);
|
SAFE_RELEASE(palette_buf);
|
||||||
SAFE_RELEASE(palette_buf_srv);
|
SAFE_RELEASE(palette_buf_srv);
|
||||||
|
|
|
@ -129,11 +129,11 @@ void VertexManager::Draw(u32 stride)
|
||||||
{
|
{
|
||||||
case PRIMITIVE_POINTS:
|
case PRIMITIVE_POINTS:
|
||||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
|
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
|
||||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
|
static_cast<Renderer*>(g_renderer.get())->ApplyCullDisable();
|
||||||
break;
|
break;
|
||||||
case PRIMITIVE_LINES:
|
case PRIMITIVE_LINES:
|
||||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
|
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
|
||||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
|
static_cast<Renderer*>(g_renderer.get())->ApplyCullDisable();
|
||||||
break;
|
break;
|
||||||
case PRIMITIVE_TRIANGLES:
|
case PRIMITIVE_TRIANGLES:
|
||||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||||
|
@ -146,7 +146,7 @@ void VertexManager::Draw(u32 stride)
|
||||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||||
|
|
||||||
if (current_primitive_type != PRIMITIVE_TRIANGLES)
|
if (current_primitive_type != PRIMITIVE_TRIANGLES)
|
||||||
((DX11::Renderer*)g_renderer)->RestoreCull();
|
static_cast<Renderer*>(g_renderer.get())->RestoreCull();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManager::vFlush(bool useDstAlpha)
|
void VertexManager::vFlush(bool useDstAlpha)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
@ -176,10 +177,10 @@ bool VideoBackend::Initialize(void *window_handle)
|
||||||
void VideoBackend::Video_Prepare()
|
void VideoBackend::Video_Prepare()
|
||||||
{
|
{
|
||||||
// internal interfaces
|
// internal interfaces
|
||||||
g_renderer = new Renderer(m_window_handle);
|
g_renderer = std::make_unique<Renderer>(m_window_handle);
|
||||||
g_texture_cache = new TextureCache;
|
g_texture_cache = std::make_unique<TextureCache>();
|
||||||
g_vertex_manager = new VertexManager;
|
g_vertex_manager = std::make_unique<VertexManager>();
|
||||||
g_perf_query = new PerfQuery;
|
g_perf_query = std::make_unique<PerfQuery>();
|
||||||
VertexShaderCache::Init();
|
VertexShaderCache::Init();
|
||||||
PixelShaderCache::Init();
|
PixelShaderCache::Init();
|
||||||
GeometryShaderCache::Init();
|
GeometryShaderCache::Init();
|
||||||
|
@ -225,14 +226,10 @@ void VideoBackend::Shutdown()
|
||||||
GeometryShaderCache::Shutdown();
|
GeometryShaderCache::Shutdown();
|
||||||
BBox::Shutdown();
|
BBox::Shutdown();
|
||||||
|
|
||||||
delete g_perf_query;
|
g_perf_query.reset();
|
||||||
delete g_vertex_manager;
|
g_vertex_manager.reset();
|
||||||
delete g_texture_cache;
|
g_texture_cache.reset();
|
||||||
delete g_renderer;
|
g_renderer.reset();
|
||||||
g_renderer = nullptr;
|
|
||||||
g_texture_cache = nullptr;
|
|
||||||
g_vertex_manager = nullptr;
|
|
||||||
g_perf_query = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& _vtx_decl)
|
||||||
if (vertex_stride & 3)
|
if (vertex_stride & 3)
|
||||||
PanicAlert("Uneven vertex stride: %i", vertex_stride);
|
PanicAlert("Uneven vertex stride: %i", vertex_stride);
|
||||||
|
|
||||||
VertexManager *vm = (OGL::VertexManager*)g_vertex_manager;
|
VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get());
|
||||||
|
|
||||||
glGenVertexArrays(1, &VAO);
|
glGenVertexArrays(1, &VAO);
|
||||||
glBindVertexArray(VAO);
|
glBindVertexArray(VAO);
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
#include "Common/GL/GLUtil.h"
|
#include "Common/GL/GLUtil.h"
|
||||||
|
|
||||||
|
@ -10,15 +12,16 @@
|
||||||
|
|
||||||
namespace OGL
|
namespace OGL
|
||||||
{
|
{
|
||||||
PerfQueryBase* GetPerfQuery()
|
std::unique_ptr<PerfQueryBase> GetPerfQuery()
|
||||||
{
|
{
|
||||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 &&
|
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 &&
|
||||||
GLExtensions::Supports("GL_NV_occlusion_query_samples"))
|
GLExtensions::Supports("GL_NV_occlusion_query_samples"))
|
||||||
return new PerfQueryGLESNV();
|
return std::make_unique<PerfQueryGLESNV>();
|
||||||
else if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
|
|
||||||
return new PerfQueryGL(GL_ANY_SAMPLES_PASSED);
|
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
|
||||||
else
|
return std::make_unique<PerfQueryGL>(GL_ANY_SAMPLES_PASSED);
|
||||||
return new PerfQueryGL(GL_SAMPLES_PASSED);
|
|
||||||
|
return std::make_unique<PerfQueryGL>(GL_SAMPLES_PASSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerfQuery::PerfQuery()
|
PerfQuery::PerfQuery()
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace OGL
|
namespace OGL
|
||||||
{
|
{
|
||||||
PerfQueryBase* GetPerfQuery();
|
std::unique_ptr<PerfQueryBase> GetPerfQuery();
|
||||||
|
|
||||||
class PerfQuery : public PerfQueryBase
|
class PerfQuery : public PerfQueryBase
|
||||||
{
|
{
|
||||||
|
|
|
@ -1599,7 +1599,7 @@ void Renderer::RestoreAPIState()
|
||||||
SetLogicOpMode();
|
SetLogicOpMode();
|
||||||
SetViewport();
|
SetViewport();
|
||||||
|
|
||||||
VertexManager *vm = (OGL::VertexManager*)g_vertex_manager;
|
const VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get());
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);
|
glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);
|
||||||
if (vm->m_last_vao)
|
if (vm->m_last_vao)
|
||||||
glBindVertexArray(vm->m_last_vao);
|
glBindVertexArray(vm->m_last_vao);
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
#include "VideoBackends/OGL/SamplerCache.h"
|
#include "VideoBackends/OGL/SamplerCache.h"
|
||||||
#include "VideoCommon/DriverDetails.h"
|
#include "VideoCommon/DriverDetails.h"
|
||||||
|
@ -10,7 +12,7 @@
|
||||||
namespace OGL
|
namespace OGL
|
||||||
{
|
{
|
||||||
|
|
||||||
SamplerCache *g_sampler_cache;
|
std::unique_ptr<SamplerCache> g_sampler_cache;
|
||||||
|
|
||||||
SamplerCache::SamplerCache()
|
SamplerCache::SamplerCache()
|
||||||
: m_last_max_anisotropy()
|
: m_last_max_anisotropy()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/NonCopyable.h"
|
#include "Common/NonCopyable.h"
|
||||||
|
@ -80,6 +81,6 @@ private:
|
||||||
u32 m_sampler_id[2];
|
u32 m_sampler_id[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SamplerCache *g_sampler_cache;
|
extern std::unique_ptr<SamplerCache> g_sampler_cache;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ class TextureCache : public TextureCacheBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextureCache();
|
TextureCache();
|
||||||
|
~TextureCache();
|
||||||
|
|
||||||
static void DisableStage(unsigned int stage);
|
static void DisableStage(unsigned int stage);
|
||||||
static void SetStage();
|
static void SetStage();
|
||||||
|
|
||||||
|
@ -49,8 +51,6 @@ private:
|
||||||
bool Save(const std::string& filename, unsigned int level) override;
|
bool Save(const std::string& filename, unsigned int level) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
~TextureCache();
|
|
||||||
|
|
||||||
TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) override;
|
TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) override;
|
||||||
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette, TlutFormat format) override;
|
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette, TlutFormat format) override;
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ void VertexManager::Draw(u32 stride)
|
||||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||||
|
|
||||||
if (current_primitive_type != PRIMITIVE_TRIANGLES)
|
if (current_primitive_type != PRIMITIVE_TRIANGLES)
|
||||||
((OGL::Renderer*)g_renderer)->SetGenerationMode();
|
static_cast<Renderer*>(g_renderer.get())->SetGenerationMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManager::vFlush(bool useDstAlpha)
|
void VertexManager::vFlush(bool useDstAlpha)
|
||||||
|
|
|
@ -38,6 +38,7 @@ Make AA apply instantly during gameplay if possible
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/Atomic.h"
|
#include "Common/Atomic.h"
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
|
@ -182,13 +183,13 @@ void VideoBackend::Video_Prepare()
|
||||||
{
|
{
|
||||||
GLInterface->MakeCurrent();
|
GLInterface->MakeCurrent();
|
||||||
|
|
||||||
g_renderer = new Renderer;
|
g_renderer = std::make_unique<Renderer>();
|
||||||
|
|
||||||
CommandProcessor::Init();
|
CommandProcessor::Init();
|
||||||
PixelEngine::Init();
|
PixelEngine::Init();
|
||||||
|
|
||||||
BPInit();
|
BPInit();
|
||||||
g_vertex_manager = new VertexManager;
|
g_vertex_manager = std::make_unique<VertexManager>();
|
||||||
g_perf_query = GetPerfQuery();
|
g_perf_query = GetPerfQuery();
|
||||||
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
||||||
OpcodeDecoder_Init();
|
OpcodeDecoder_Init();
|
||||||
|
@ -197,8 +198,8 @@ void VideoBackend::Video_Prepare()
|
||||||
PixelShaderManager::Init();
|
PixelShaderManager::Init();
|
||||||
GeometryShaderManager::Init();
|
GeometryShaderManager::Init();
|
||||||
ProgramShaderCache::Init();
|
ProgramShaderCache::Init();
|
||||||
g_texture_cache = new TextureCache();
|
g_texture_cache = std::make_unique<TextureCache>();
|
||||||
g_sampler_cache = new SamplerCache();
|
g_sampler_cache = std::make_unique<SamplerCache>();
|
||||||
Renderer::Init();
|
Renderer::Init();
|
||||||
VertexLoaderManager::Init();
|
VertexLoaderManager::Init();
|
||||||
TextureConverter::Init();
|
TextureConverter::Init();
|
||||||
|
@ -216,39 +217,35 @@ void VideoBackend::Shutdown()
|
||||||
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
|
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
|
||||||
|
|
||||||
GLInterface->Shutdown();
|
GLInterface->Shutdown();
|
||||||
delete GLInterface;
|
GLInterface.reset();
|
||||||
GLInterface = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBackend::Video_Cleanup()
|
void VideoBackend::Video_Cleanup()
|
||||||
{
|
{
|
||||||
if (g_renderer)
|
if (!g_renderer)
|
||||||
{
|
return;
|
||||||
Fifo_Shutdown();
|
|
||||||
|
|
||||||
// The following calls are NOT Thread Safe
|
Fifo_Shutdown();
|
||||||
// And need to be called from the video thread
|
|
||||||
Renderer::Shutdown();
|
// The following calls are NOT Thread Safe
|
||||||
BoundingBox::Shutdown();
|
// And need to be called from the video thread
|
||||||
TextureConverter::Shutdown();
|
Renderer::Shutdown();
|
||||||
VertexLoaderManager::Shutdown();
|
BoundingBox::Shutdown();
|
||||||
delete g_sampler_cache;
|
TextureConverter::Shutdown();
|
||||||
g_sampler_cache = nullptr;
|
VertexLoaderManager::Shutdown();
|
||||||
delete g_texture_cache;
|
g_sampler_cache.reset();
|
||||||
g_texture_cache = nullptr;
|
g_texture_cache.reset();
|
||||||
ProgramShaderCache::Shutdown();
|
ProgramShaderCache::Shutdown();
|
||||||
VertexShaderManager::Shutdown();
|
VertexShaderManager::Shutdown();
|
||||||
PixelShaderManager::Shutdown();
|
PixelShaderManager::Shutdown();
|
||||||
GeometryShaderManager::Shutdown();
|
GeometryShaderManager::Shutdown();
|
||||||
delete g_perf_query;
|
|
||||||
g_perf_query = nullptr;
|
g_perf_query.reset();
|
||||||
delete g_vertex_manager;
|
g_vertex_manager.reset();
|
||||||
g_vertex_manager = nullptr;
|
|
||||||
OpcodeDecoder_Shutdown();
|
OpcodeDecoder_Shutdown();
|
||||||
delete g_renderer;
|
g_renderer.reset();
|
||||||
g_renderer = nullptr;
|
GLInterface->ClearCurrent();
|
||||||
GLInterface->ClearCurrent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
#include "Common/GL/GLUtil.h"
|
#include "Common/GL/GLUtil.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
@ -25,10 +27,9 @@ void SWOGLWindow::Init(void *window_handle)
|
||||||
void SWOGLWindow::Shutdown()
|
void SWOGLWindow::Shutdown()
|
||||||
{
|
{
|
||||||
GLInterface->Shutdown();
|
GLInterface->Shutdown();
|
||||||
delete GLInterface;
|
GLInterface.reset();
|
||||||
GLInterface = nullptr;
|
|
||||||
|
|
||||||
SWOGLWindow::s_instance.release();
|
s_instance.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWOGLWindow::Prepare()
|
void SWOGLWindow::Prepare()
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include "VideoCommon/PerfQueryBase.h"
|
#include "VideoCommon/PerfQueryBase.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
PerfQueryBase* g_perf_query = nullptr;
|
std::unique_ptr<PerfQueryBase> g_perf_query;
|
||||||
|
|
||||||
bool PerfQueryBase::ShouldEmulate()
|
bool PerfQueryBase::ShouldEmulate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
enum PerfQueryType
|
enum PerfQueryType
|
||||||
|
@ -65,4 +66,4 @@ protected:
|
||||||
volatile u32 m_results[PQG_NUM_MEMBERS];
|
volatile u32 m_results[PQG_NUM_MEMBERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PerfQueryBase* g_perf_query;
|
extern std::unique_ptr<PerfQueryBase> g_perf_query;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/Atomic.h"
|
#include "Common/Atomic.h"
|
||||||
|
@ -51,7 +52,7 @@ int frameCount;
|
||||||
int OSDChoice;
|
int OSDChoice;
|
||||||
static int OSDTime;
|
static int OSDTime;
|
||||||
|
|
||||||
Renderer *g_renderer = nullptr;
|
std::unique_ptr<Renderer> g_renderer;
|
||||||
|
|
||||||
std::mutex Renderer::s_criticalScreenshot;
|
std::mutex Renderer::s_criticalScreenshot;
|
||||||
std::string Renderer::s_sScreenshotName;
|
std::string Renderer::s_sScreenshotName;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -182,5 +183,5 @@ private:
|
||||||
static unsigned int efb_scale_denominatorY;
|
static unsigned int efb_scale_denominatorY;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Renderer *g_renderer;
|
extern std::unique_ptr<Renderer> g_renderer;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
@ -28,7 +29,7 @@ static const int TEXTURE_KILL_THRESHOLD = 64; // Sonic the Fighters (inside Soni
|
||||||
static const int TEXTURE_POOL_KILL_THRESHOLD = 3;
|
static const int TEXTURE_POOL_KILL_THRESHOLD = 3;
|
||||||
static const int FRAMECOUNT_INVALID = 0;
|
static const int FRAMECOUNT_INVALID = 0;
|
||||||
|
|
||||||
TextureCacheBase* g_texture_cache;
|
std::unique_ptr<TextureCacheBase> g_texture_cache;
|
||||||
|
|
||||||
alignas(16) u8* TextureCacheBase::temp = nullptr;
|
alignas(16) u8* TextureCacheBase::temp = nullptr;
|
||||||
size_t TextureCacheBase::temp_size;
|
size_t TextureCacheBase::temp_size;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
@ -179,4 +180,4 @@ private:
|
||||||
} backup_config;
|
} backup_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TextureCacheBase* g_texture_cache;
|
extern std::unique_ptr<TextureCacheBase> g_texture_cache;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
#include "VideoCommon/BPStructs.h"
|
#include "VideoCommon/BPStructs.h"
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
#include "VideoCommon/XFMemory.h"
|
#include "VideoCommon/XFMemory.h"
|
||||||
|
|
||||||
VertexManagerBase* g_vertex_manager;
|
std::unique_ptr<VertexManagerBase> g_vertex_manager;
|
||||||
|
|
||||||
u8* VertexManagerBase::s_pCurBufferPointer;
|
u8* VertexManagerBase::s_pCurBufferPointer;
|
||||||
u8* VertexManagerBase::s_pBaseBufferPointer;
|
u8* VertexManagerBase::s_pBaseBufferPointer;
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/CommonFuncs.h"
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/DataReader.h"
|
#include "VideoCommon/DataReader.h"
|
||||||
|
@ -82,4 +84,4 @@ private:
|
||||||
virtual void DestroyDeviceObjects() {}
|
virtual void DestroyDeviceObjects() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern VertexManagerBase* g_vertex_manager;
|
extern std::unique_ptr<VertexManagerBase> g_vertex_manager;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// Stub implementation of the Host_* callbacks for tests. These implementations
|
// Stub implementation of the Host_* callbacks for tests. These implementations
|
||||||
// do nothing except return default values when required.
|
// do nothing except return default values when required.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
|
@ -26,4 +27,4 @@ bool Host_RendererIsFullscreen() { return false; }
|
||||||
void Host_ConnectWiimote(int, bool) {}
|
void Host_ConnectWiimote(int, bool) {}
|
||||||
void Host_SetWiiMoteConnectionState(int) {}
|
void Host_SetWiiMoteConnectionState(int) {}
|
||||||
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
|
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
|
||||||
cInterfaceBase* HostGL_CreateGLInterface() { return nullptr; }
|
std::unique_ptr<cInterfaceBase> HostGL_CreateGLInterface() { return nullptr; }
|
||||||
|
|
Loading…
Reference in New Issue