From 099057b14279b7ed89b30caee5286f3e1579d5f6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 5 May 2018 23:32:55 +0200 Subject: [PATCH] - moved the vertex and light data generation back to the render pass for modern OpenGL with persistently mapped buffers. Having this extra CPU time in there allows for better parallelization with the graphics driver and GPU. --- src/gl/scene/gl_walls_draw.cpp | 9 +++++++++ src/hwrenderer/scene/hw_walls.cpp | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index d3ab517f4..bd6087468 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -256,6 +256,15 @@ void FDrawInfo::RenderTranslucentWall(GLWall *wall) //========================================================================== void FDrawInfo::DrawWall(GLWall *wall, int pass) { + if (screen->hwcaps & RFL_BUFFER_STORAGE) + { + if (level.HasDynamicLights && FixedColormap == CM_DEFAULT && wall->gltexture != nullptr && !(screen->hwcaps & RFL_NO_SHADERS)) + { + wall->SetupLights(this, lightdata); + } + wall->MakeVertices(this, !!(wall->flags & GLWall::GLWF_TRANSLUCENT)); + } + gl_RenderState.SetNormal(wall->glseg.Normal()); switch (pass) { diff --git a/src/hwrenderer/scene/hw_walls.cpp b/src/hwrenderer/scene/hw_walls.cpp index de3a786e4..1ed41122a 100644 --- a/src/hwrenderer/scene/hw_walls.cpp +++ b/src/hwrenderer/scene/hw_walls.cpp @@ -183,11 +183,14 @@ void GLWall::PutWall(HWDrawInfo *di, bool translucent) if (di->FixedColormap != CM_DEFAULT || (Colormap.LightColor.isWhite() && lightlevel == 255)) flags &= ~GLWF_GLOW; - if (level.HasDynamicLights && di->FixedColormap == CM_DEFAULT && gltexture != nullptr && !(screen->hwcaps & RFL_NO_SHADERS)) + if (!(screen->hwcaps & RFL_BUFFER_STORAGE)) { - SetupLights(di, lightdata); + if (level.HasDynamicLights && di->FixedColormap == CM_DEFAULT && gltexture != nullptr && !(screen->hwcaps & RFL_NO_SHADERS)) + { + SetupLights(di, lightdata); + } + MakeVertices(di, translucent); } - MakeVertices(di, translucent); bool solid;