From 044c8a2034539d7fe68076f98ac7f3a430b5b295 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 May 2018 08:43:52 +0200 Subject: [PATCH] - removed gl_render_subsectors test CVAR and disabled vertex buffer generation for legacy mode To reduce the performance impact, legacy mode will now always create flat vertex data on the fly instead of relying on the vertex buffer. This makes the CVAR mostly redundant as on anything more modern rendering per subsector will always be slower. --- src/gl/data/gl_vertexbuffer.cpp | 5 ++++- src/gl/scene/gl_flats.cpp | 22 ++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/gl/data/gl_vertexbuffer.cpp b/src/gl/data/gl_vertexbuffer.cpp index cd7549aa8..bf867f13e 100644 --- a/src/gl/data/gl_vertexbuffer.cpp +++ b/src/gl/data/gl_vertexbuffer.cpp @@ -249,7 +249,10 @@ void FFlatVertexBuffer::Unmap() void FFlatVertexBuffer::CreateVBO() { vbo_shadowdata.Resize(mNumReserved); - FFlatVertexGenerator::CreateVertices(); + if (!gl.legacyMode) + { + FFlatVertexGenerator::CreateVertices(); + } mCurIndex = mIndex = vbo_shadowdata.Size(); Map(); memcpy(map, &vbo_shadowdata[0], vbo_shadowdata.Size() * sizeof(FFlatVertex)); diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 0aa9c88fc..1faa44901 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -48,8 +48,6 @@ #include "gl/scene/gl_scenedrawer.h" #include "gl/renderer/gl_quaddrawer.h" -CVAR(Bool, gl_render_subsectors, false, 0) - //========================================================================== // // Flats @@ -166,24 +164,24 @@ void FDrawInfo::DrawSubsector(GLFlat *flat, subsector_t * sub) void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans) { flat->dynlightindex = GLRenderer->mLights->GetIndexPtr(); - - if (flat->sector->ibocount > 0 && !gl_render_subsectors && !gl_RenderState.GetClipLineShouldBeActive()) + + if (flat->sector->ibocount > 0 && !gl_RenderState.GetClipLineShouldBeActive()) { SetupSectorLights(flat, GLPASS_LIGHTSONLY, nullptr); } else { - // Draw the subsectors belonging to this sector + // Draw the subsectors belonging to this sector for (int i = 0; i < flat->sector->subsectorcount; i++) - { - subsector_t * sub = flat->sector->subsectors[i]; - if (ss_renderflags[sub->Index()] & flat->renderflags || istrans) { - SetupSubsectorLights(flat, GLPASS_LIGHTSONLY, sub, nullptr); + subsector_t * sub = flat->sector->subsectors[i]; + if (ss_renderflags[sub->Index()] & flat->renderflags || istrans) + { + SetupSubsectorLights(flat, GLPASS_LIGHTSONLY, sub, nullptr); + } } } - } - + // Draw the subsectors assigned to it due to missing textures if (!(flat->renderflags&SSRF_RENDER3DPLANES)) { @@ -214,7 +212,7 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool if (gl.legacyMode) processlights = false; auto vcount = flat->sector->ibocount; - if (vcount > 0 && !gl_render_subsectors && !gl_RenderState.GetClipLineShouldBeActive()) + if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive()) { if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli); drawcalls.Clock();