summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/PerfQuery.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-12-20 21:49:49 -0500
committerLioncash <mathew1800@gmail.com>2015-12-20 22:40:37 -0500
commitf2951828335654d0993ead998b3c547f903501dd (patch)
treeacf56e852bc06711f07382821f9d115fea060b00 /Source/Core/VideoBackends/OGL/PerfQuery.cpp
parent1fbab188adafaf46e252837153cbfa3242a8d3c7 (diff)
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
Diffstat (limited to 'Source/Core/VideoBackends/OGL/PerfQuery.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/PerfQuery.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/OGL/PerfQuery.cpp b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
index a3e9fde0dc..770a082782 100644
--- a/Source/Core/VideoBackends/OGL/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
@@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
+#include <memory>
+
#include "Common/GL/GLInterfaceBase.h"
#include "Common/GL/GLUtil.h"
@@ -10,15 +12,16 @@
namespace OGL
{
-PerfQueryBase* GetPerfQuery()
+std::unique_ptr<PerfQueryBase> GetPerfQuery()
{
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 &&
GLExtensions::Supports("GL_NV_occlusion_query_samples"))
- return new PerfQueryGLESNV();
- else if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
- return new PerfQueryGL(GL_ANY_SAMPLES_PASSED);
- else
- return new PerfQueryGL(GL_SAMPLES_PASSED);
+ return std::make_unique<PerfQueryGLESNV>();
+
+ if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
+ return std::make_unique<PerfQueryGL>(GL_ANY_SAMPLES_PASSED);
+
+ return std::make_unique<PerfQueryGL>(GL_SAMPLES_PASSED);
}
PerfQuery::PerfQuery()