- remove all usage of std::make_unique to keep things C++11 compliant

This commit is contained in:
Magnus Norddahl 2017-04-11 01:25:44 +02:00
parent bdf02ea67c
commit f049e6145b
7 changed files with 33 additions and 33 deletions

View File

@ -38,7 +38,7 @@ void FLinearDepthShader::Bind()
if (!mShader)
{
mShader = std::make_unique<FShaderProgram>();
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<FShaderProgram>();
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<FShaderProgram>();
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");

View File

@ -316,7 +316,7 @@ OpenGLSWFrameBuffer::HWPixelShader::~HWPixelShader()
bool OpenGLSWFrameBuffer::CreateFrameBuffer(const FString &name, int width, int height, HWFrameBuffer **outFramebuffer)
{
auto fb = std::make_unique<HWFrameBuffer>();
std::unique_ptr<HWFrameBuffer> 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<HWPixelShader>();
std::unique_ptr<HWPixelShader> 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<HWVertexBuffer>();
std::unique_ptr<HWVertexBuffer> 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<HWIndexBuffer>();
std::unique_ptr<HWIndexBuffer> 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<HWTexture>();
std::unique_ptr<HWTexture> 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<HWTexture>();
std::unique_ptr<HWTexture> 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<HWVertexBuffer>();
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<HWVertexBuffer>();
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<HWVertexBuffer>();
StreamVertexBuffer.reset(new HWVertexBuffer());
glGenVertexArrays(1, (GLuint*)&StreamVertexBuffer->VertexArray);
glGenBuffers(1, (GLuint*)&StreamVertexBuffer->Buffer);
glBindVertexArray(StreamVertexBuffer->VertexArray);

View File

@ -249,7 +249,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const PolyClipPlane &
}
if (!polyportal)
{
sectorPortals.push_back(std::make_unique<PolyDrawSectorPortal>(portal, ceiling));
sectorPortals.push_back(std::unique_ptr<PolyDrawSectorPortal>(new PolyDrawSectorPortal(portal, ceiling)));
polyportal = sectorPortals.back().get();
}

View File

@ -44,7 +44,7 @@ bool RenderPolyWall::RenderLine(const TriMatrix &worldToClip, const PolyClipPlan
{
if (PolyRenderer::Instance()->InsertSeenMirror(line->linedef))
{
linePortals.push_back(std::make_unique<PolyDrawLinePortal>(line->linedef));
linePortals.push_back(std::unique_ptr<PolyDrawLinePortal>(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<PolyDrawLinePortal>(portal));
linePortals.push_back(std::unique_ptr<PolyDrawLinePortal>(new PolyDrawLinePortal(portal)));
polyportal = linePortals.back().get();
}
}

View File

@ -46,7 +46,7 @@ void *RenderMemory::AllocBytes(int size)
}
else
{
UsedBlocks.push_back(std::make_unique<MemoryBlock>());
UsedBlocks.push_back(std::unique_ptr<MemoryBlock>(new MemoryBlock()));
}
}

View File

@ -60,21 +60,21 @@ namespace swrenderer
{
Scene = scene;
MainThread = mainThread;
FrameMemory = std::make_unique<RenderMemory>();
Viewport = std::make_unique<RenderViewport>();
Light = std::make_unique<LightVisibility>();
DrawQueue = std::make_shared<DrawerCommandQueue>(FrameMemory.get());
OpaquePass = std::make_unique<RenderOpaquePass>(this);
TranslucentPass = std::make_unique<RenderTranslucentPass>(this);
SpriteList = std::make_unique<VisibleSpriteList>();
Portal = std::make_unique<RenderPortal>(this);
Clip3D = std::make_unique<Clip3DFloors>(this);
PlayerSprites = std::make_unique<RenderPlayerSprites>(this);
PlaneList = std::make_unique<VisiblePlaneList>(this);
DrawSegments = std::make_unique<DrawSegmentList>(this);
ClipSegments = std::make_unique<RenderClipSegment>();
tc_drawers = std::make_unique<SWTruecolorDrawers>(DrawQueue);
pal_drawers = std::make_unique<SWPalDrawers>(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()

View File

@ -61,7 +61,7 @@ namespace swrenderer
RenderScene::RenderScene()
{
Threads.push_back(std::make_unique<RenderThread>(this));
Threads.push_back(std::unique_ptr<RenderThread>(new RenderThread(this)));
}
RenderScene::~RenderScene()
@ -289,7 +289,7 @@ namespace swrenderer
{
while (Threads.size() < (size_t)numThreads)
{
auto thread = std::make_unique<RenderThread>(this, false);
std::unique_ptr<RenderThread> thread(new RenderThread(this, false));
auto renderthread = thread.get();
int start_run_id = run_id;
thread->thread = std::thread([=]()