From f2951828335654d0993ead998b3c547f903501dd Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 20 Dec 2015 21:49:49 -0500 Subject: VideoBackends: Simplify initialization and deinitialization of resources Approximately three or four times now, the issue of pointers being in an inconsistent state been an issue in the video backend renderers with regards to tripping up other developers. Global (ugh) resources are put into a unique_ptr and will always have a well-defined state of being - null or not null --- Source/Core/Common/GL/GLInterface/GLInterface.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Source/Core/Common/GL/GLInterface/GLInterface.cpp') diff --git a/Source/Core/Common/GL/GLInterface/GLInterface.cpp b/Source/Core/Common/GL/GLInterface/GLInterface.cpp index 8abe67dc71..b9a05fd30a 100644 --- a/Source/Core/Common/GL/GLInterface/GLInterface.cpp +++ b/Source/Core/Common/GL/GLInterface/GLInterface.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include + #include "Common/GL/GLInterfaceBase.h" #ifdef ANDROID @@ -20,19 +22,19 @@ #error Platform doesnt have a GLInterface #endif -cInterfaceBase* HostGL_CreateGLInterface() +std::unique_ptr HostGL_CreateGLInterface() { #ifdef ANDROID - return new cInterfaceEGLAndroid; + return std::make_unique(); #elif defined(__APPLE__) - return new cInterfaceAGL; + return std::make_unique(); #elif defined(_WIN32) - return new cInterfaceWGL; + return std::make_unique(); #elif defined(HAVE_X11) && HAVE_X11 #if defined(USE_EGL) && USE_EGL - return new cInterfaceEGLX11; + return std::make_unique(); #else - return new cInterfaceGLX; + return std::make_unique(); #endif #else return nullptr; -- cgit v1.2.3