summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-12-21 10:15:17 -0500
committerLioncash <mathew1800@gmail.com>2015-12-21 10:21:38 -0500
commitd20ba76ab3a753f658533c502c72fcef86c34a1a (patch)
tree5f5a3de6f6575954c23d4613e91c6f9a3dbe03b7 /Source/Core/VideoBackends/OGL/StreamBuffer.cpp
parentec71452706347f6e2a0c06ed7b0d422a3df30978 (diff)
StreamBuffer: Make factory function return a std::unique_ptr
Diffstat (limited to 'Source/Core/VideoBackends/OGL/StreamBuffer.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/StreamBuffer.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
index 5107fe0b17..5268423d72 100644
--- a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
+++ b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
@@ -355,17 +355,17 @@ public:
u8* m_pointer;
};
-// choose best streaming library based on the supported extensions and known issues
-StreamBuffer* StreamBuffer::Create(u32 type, u32 size)
+// Chooses the best streaming method based on the supported extensions and known issues
+std::unique_ptr<StreamBuffer> StreamBuffer::Create(u32 type, u32 size)
{
// without basevertex support, only streaming methods whith uploads everything to zero works fine:
if (!g_ogl_config.bSupportsGLBaseVertex)
{
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
- return new BufferSubData(type, size);
+ return std::make_unique<BufferSubData>(type, size);
// BufferData is by far the worst way, only use it if needed
- return new BufferData(type, size);
+ return std::make_unique<BufferData>(type, size);
}
// Prefer the syncing buffers over the orphaning one
@@ -374,25 +374,25 @@ StreamBuffer* StreamBuffer::Create(u32 type, u32 size)
// pinned memory is much faster than buffer storage on AMD cards
if (g_ogl_config.bSupportsGLPinnedMemory &&
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER))
- return new PinnedMemory(type, size);
+ return std::make_unique<PinnedMemory>(type, size);
// buffer storage works well in most situations
if (g_ogl_config.bSupportsGLBufferStorage &&
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER) &&
!(DriverDetails::HasBug(DriverDetails::BUG_INTELBROKENBUFFERSTORAGE) && type == GL_ELEMENT_ARRAY_BUFFER))
- return new BufferStorage(type, size);
+ return std::make_unique<BufferStorage>(type, size);
// don't fall back to MapAnd* for Nvidia drivers
if (DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING))
- return new BufferSubData(type, size);
+ return std::make_unique<BufferSubData>(type, size);
// mapping fallback
if (g_ogl_config.bSupportsGLSync)
- return new MapAndSync(type, size);
+ return std::make_unique<MapAndSync>(type, size);
}
// default fallback, should work everywhere, but isn't the best way to do this job
- return new MapAndOrphan(type, size);
+ return std::make_unique<MapAndOrphan>(type, size);
}
}