From f049e6145b70dde9620679b9d8991fae559d607d Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 11 Apr 2017 01:25:44 +0200 Subject: [PATCH] - remove all usage of std::make_unique to keep things C++11 compliant --- src/gl/shaders/gl_ambientshader.cpp | 6 +++--- src/gl/system/gl_swframebuffer.cpp | 18 ++++++++-------- src/polyrenderer/scene/poly_plane.cpp | 2 +- src/polyrenderer/scene/poly_wall.cpp | 4 ++-- src/swrenderer/r_memory.cpp | 2 +- src/swrenderer/r_renderthread.cpp | 30 +++++++++++++-------------- src/swrenderer/scene/r_scene.cpp | 4 ++-- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/gl/shaders/gl_ambientshader.cpp b/src/gl/shaders/gl_ambientshader.cpp index 02090cf61c..3d0af2dabd 100644 --- a/src/gl/shaders/gl_ambientshader.cpp +++ b/src/gl/shaders/gl_ambientshader.cpp @@ -38,7 +38,7 @@ void FLinearDepthShader::Bind() if (!mShader) { - mShader = std::make_unique(); + mShader.reset(new FShaderProgram()); mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330); mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/lineardepth.fp", multisample ? "#define MULTISAMPLE\n" : "", 330); mShader->SetFragDataLocation(0, "FragColor"); @@ -66,7 +66,7 @@ void FSSAOShader::Bind() if (!mShader) { - mShader = std::make_unique(); + mShader.reset(new FShaderProgram()); mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330); mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/ssao.fp", GetDefines(gl_ssao, multisample), 330); mShader->SetFragDataLocation(0, "FragColor"); @@ -142,7 +142,7 @@ void FSSAOCombineShader::Bind() if (!mShader) { - mShader = std::make_unique(); + mShader.reset(new FShaderProgram()); mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330); mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/ssaocombine.fp", multisample ? "#define MULTISAMPLE\n" : "", 330); mShader->SetFragDataLocation(0, "FragColor"); diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 29c38a4a68..4a97eb95be 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -316,7 +316,7 @@ OpenGLSWFrameBuffer::HWPixelShader::~HWPixelShader() bool OpenGLSWFrameBuffer::CreateFrameBuffer(const FString &name, int width, int height, HWFrameBuffer **outFramebuffer) { - auto fb = std::make_unique(); + std::unique_ptr fb(new HWFrameBuffer()); GLint format = GL_RGBA16F; if (gl.es) format = GL_RGB; @@ -357,7 +357,7 @@ bool OpenGLSWFrameBuffer::CreateFrameBuffer(const FString &name, int width, int bool OpenGLSWFrameBuffer::CreatePixelShader(FString vertexsrc, FString fragmentsrc, const FString &defines, HWPixelShader **outShader) { - auto shader = std::make_unique(); + std::unique_ptr shader(new HWPixelShader()); shader->Program = glCreateProgram(); if (shader->Program == 0) { Printf("glCreateProgram failed. Disabling OpenGL hardware acceleration.\n"); return false; } @@ -443,7 +443,7 @@ bool OpenGLSWFrameBuffer::CreatePixelShader(FString vertexsrc, FString fragments bool OpenGLSWFrameBuffer::CreateVertexBuffer(int size, HWVertexBuffer **outVertexBuffer) { - auto obj = std::make_unique(); + std::unique_ptr obj(new HWVertexBuffer()); obj->Size = size; @@ -474,7 +474,7 @@ bool OpenGLSWFrameBuffer::CreateVertexBuffer(int size, HWVertexBuffer **outVerte bool OpenGLSWFrameBuffer::CreateIndexBuffer(int size, HWIndexBuffer **outIndexBuffer) { - auto obj = std::make_unique(); + std::unique_ptr obj(new HWIndexBuffer()); obj->Size = size; @@ -494,7 +494,7 @@ bool OpenGLSWFrameBuffer::CreateIndexBuffer(int size, HWIndexBuffer **outIndexBu bool OpenGLSWFrameBuffer::CreateTexture(const FString &name, int width, int height, int levels, int format, HWTexture **outTexture) { - auto obj = std::make_unique(); + std::unique_ptr obj(new HWTexture()); obj->Format = format; @@ -532,7 +532,7 @@ bool OpenGLSWFrameBuffer::CreateTexture(const FString &name, int width, int heig OpenGLSWFrameBuffer::HWTexture *OpenGLSWFrameBuffer::CopyCurrentScreen() { - auto obj = std::make_unique(); + std::unique_ptr obj(new HWTexture()); obj->Format = GL_RGBA16F; GLint oldBinding = 0; @@ -611,7 +611,7 @@ void OpenGLSWFrameBuffer::DrawTriangleFans(int count, const FBVERTEX *vertices) if (!StreamVertexBuffer) { - StreamVertexBuffer = std::make_unique(); + StreamVertexBuffer.reset(new HWVertexBuffer()); glGenVertexArrays(1, (GLuint*)&StreamVertexBuffer->VertexArray); glGenBuffers(1, (GLuint*)&StreamVertexBuffer->Buffer); glBindVertexArray(StreamVertexBuffer->VertexArray); @@ -648,7 +648,7 @@ void OpenGLSWFrameBuffer::DrawTriangleFans(int count, const BURNVERTEX *vertices if (!StreamVertexBufferBurn) { - StreamVertexBufferBurn = std::make_unique(); + StreamVertexBufferBurn.reset(new HWVertexBuffer()); glGenVertexArrays(1, (GLuint*)&StreamVertexBufferBurn->VertexArray); glGenBuffers(1, (GLuint*)&StreamVertexBufferBurn->Buffer); glBindVertexArray(StreamVertexBufferBurn->VertexArray); @@ -679,7 +679,7 @@ void OpenGLSWFrameBuffer::DrawPoints(int count, const FBVERTEX *vertices) if (!StreamVertexBuffer) { - StreamVertexBuffer = std::make_unique(); + StreamVertexBuffer.reset(new HWVertexBuffer()); glGenVertexArrays(1, (GLuint*)&StreamVertexBuffer->VertexArray); glGenBuffers(1, (GLuint*)&StreamVertexBuffer->Buffer); glBindVertexArray(StreamVertexBuffer->VertexArray); diff --git a/src/polyrenderer/scene/poly_plane.cpp b/src/polyrenderer/scene/poly_plane.cpp index d4cd0fb024..88ae14e10e 100644 --- a/src/polyrenderer/scene/poly_plane.cpp +++ b/src/polyrenderer/scene/poly_plane.cpp @@ -249,7 +249,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const PolyClipPlane & } if (!polyportal) { - sectorPortals.push_back(std::make_unique(portal, ceiling)); + sectorPortals.push_back(std::unique_ptr(new PolyDrawSectorPortal(portal, ceiling))); polyportal = sectorPortals.back().get(); } diff --git a/src/polyrenderer/scene/poly_wall.cpp b/src/polyrenderer/scene/poly_wall.cpp index ae11577e42..5d2ad6cab5 100644 --- a/src/polyrenderer/scene/poly_wall.cpp +++ b/src/polyrenderer/scene/poly_wall.cpp @@ -44,7 +44,7 @@ bool RenderPolyWall::RenderLine(const TriMatrix &worldToClip, const PolyClipPlan { if (PolyRenderer::Instance()->InsertSeenMirror(line->linedef)) { - linePortals.push_back(std::make_unique(line->linedef)); + linePortals.push_back(std::unique_ptr(new PolyDrawLinePortal(line->linedef))); polyportal = linePortals.back().get(); } } @@ -63,7 +63,7 @@ bool RenderPolyWall::RenderLine(const TriMatrix &worldToClip, const PolyClipPlan } if (!polyportal) { - linePortals.push_back(std::make_unique(portal)); + linePortals.push_back(std::unique_ptr(new PolyDrawLinePortal(portal))); polyportal = linePortals.back().get(); } } diff --git a/src/swrenderer/r_memory.cpp b/src/swrenderer/r_memory.cpp index 07c85723d7..4cbfb91ef7 100644 --- a/src/swrenderer/r_memory.cpp +++ b/src/swrenderer/r_memory.cpp @@ -46,7 +46,7 @@ void *RenderMemory::AllocBytes(int size) } else { - UsedBlocks.push_back(std::make_unique()); + UsedBlocks.push_back(std::unique_ptr(new MemoryBlock())); } } diff --git a/src/swrenderer/r_renderthread.cpp b/src/swrenderer/r_renderthread.cpp index 09a4e70091..fa20da4566 100644 --- a/src/swrenderer/r_renderthread.cpp +++ b/src/swrenderer/r_renderthread.cpp @@ -60,21 +60,21 @@ namespace swrenderer { Scene = scene; MainThread = mainThread; - FrameMemory = std::make_unique(); - Viewport = std::make_unique(); - Light = std::make_unique(); - DrawQueue = std::make_shared(FrameMemory.get()); - OpaquePass = std::make_unique(this); - TranslucentPass = std::make_unique(this); - SpriteList = std::make_unique(); - Portal = std::make_unique(this); - Clip3D = std::make_unique(this); - PlayerSprites = std::make_unique(this); - PlaneList = std::make_unique(this); - DrawSegments = std::make_unique(this); - ClipSegments = std::make_unique(); - tc_drawers = std::make_unique(DrawQueue); - pal_drawers = std::make_unique(DrawQueue); + FrameMemory.reset(new RenderMemory()); + Viewport.reset(new RenderViewport()); + Light.reset(new LightVisibility()); + DrawQueue.reset(new DrawerCommandQueue(FrameMemory.get())); + OpaquePass.reset(new RenderOpaquePass(this)); + TranslucentPass.reset(new RenderTranslucentPass(this)); + SpriteList.reset(new VisibleSpriteList()); + Portal.reset(new RenderPortal(this)); + Clip3D.reset(new Clip3DFloors(this)); + PlayerSprites.reset(new RenderPlayerSprites(this)); + PlaneList.reset(new VisiblePlaneList(this)); + DrawSegments.reset(new DrawSegmentList(this)); + ClipSegments.reset(new RenderClipSegment()); + tc_drawers.reset(new SWTruecolorDrawers(DrawQueue)); + pal_drawers.reset(new SWPalDrawers(DrawQueue)); } RenderThread::~RenderThread() diff --git a/src/swrenderer/scene/r_scene.cpp b/src/swrenderer/scene/r_scene.cpp index 609f2f7533..401517cf6c 100644 --- a/src/swrenderer/scene/r_scene.cpp +++ b/src/swrenderer/scene/r_scene.cpp @@ -61,7 +61,7 @@ namespace swrenderer RenderScene::RenderScene() { - Threads.push_back(std::make_unique(this)); + Threads.push_back(std::unique_ptr(new RenderThread(this))); } RenderScene::~RenderScene() @@ -289,7 +289,7 @@ namespace swrenderer { while (Threads.size() < (size_t)numThreads) { - auto thread = std::make_unique(this, false); + std::unique_ptr thread(new RenderThread(this, false)); auto renderthread = thread.get(); int start_run_id = run_id; thread->thread = std::thread([=]()