From 4598c4138c98350d8059dc334105d9ed964df8f6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Aug 2016 23:13:49 +0200 Subject: [PATCH] - added vertex initialization for walls in the processing pass for core profile without persistent buffers. This is slower than doing it in the render pass so it's only active when actually needed - it's also slower than using a client array so this code only gets used when there is no choice but to work with a 3.x core profile context. --- src/gl/scene/gl_drawinfo.cpp | 2 ++ src/gl/scene/gl_scene.cpp | 2 +- src/gl/scene/gl_walls.cpp | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index 1d3936948..842423094 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -325,6 +325,7 @@ void GLDrawList::SortWallIntoPlane(SortNode * head,SortNode * sort) if (gl.glslversion < 1.3f) { GLWall * ws1; + ws->vertcount = 0; // invalidate current vertices. ws1=&walls[walls.Size()-1]; ws=&walls[drawitems[sort->itemindex].index]; // may have been reallocated! float newtexv = ws->tcs[GLWall::UPLFT].v + ((ws->tcs[GLWall::LOLFT].v - ws->tcs[GLWall::UPLFT].v) / (ws->zbottom[0] - ws->ztop[0])) * (fh->z - ws->ztop[0]); @@ -467,6 +468,7 @@ void GLDrawList::SortWallIntoWall(SortNode * head,SortNode * sort) float izt=(float)(ws->ztop[0]+r*(ws->ztop[1]-ws->ztop[0])); float izb=(float)(ws->zbottom[0]+r*(ws->zbottom[1]-ws->zbottom[0])); + ws->vertcount = 0; // invalidate current vertices. GLWall w=*ws; AddWall(&w); ws1=&walls[walls.Size()-1]; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 24fd9a678..ef82472e0 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -526,7 +526,7 @@ void gl_FillScreen() gl_RenderState.EnableTexture(false); gl_RenderState.Apply(); // The fullscreen quad is stored at index 4 in the main vertex buffer. - glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); + glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::FULLSCREEN_INDEX, 4); } //========================================================================== diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 54ba8c731..3afde063c 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -135,6 +135,7 @@ void GLWall::PutWall(bool translucent) if (translucent) // translucent walls { ViewDistance = (ViewPos - (seg->linedef->v1->fPos() + seg->linedef->Delta() / 2)).XY().LengthSquared(); + if (gl.buffermethod == BM_DEFERRED) MakeVertices(true); gl_drawinfo->drawlists[GLDL_TRANSLUCENT].AddWall(this); } else @@ -157,16 +158,19 @@ void GLWall::PutWall(bool translucent) { list = masked ? GLDL_MASKEDWALLS : GLDL_PLAINWALLS; } + if (gl.buffermethod == BM_DEFERRED) MakeVertices(false); gl_drawinfo->drawlists[list].AddWall(this); } lightlist = NULL; + vertcount = 0; // make sure that following parts of the same linedef do not get this one's vertex info. } void GLWall::PutPortal(int ptype) { GLPortal * portal; + if (gl.buffermethod == BM_DEFERRED) MakeVertices(false); switch (ptype) { // portals don't go into the draw list. @@ -237,6 +241,7 @@ void GLWall::PutPortal(int ptype) portal->AddLine(this); break; } + vertcount = 0; } //========================================================================== //