Add support for gl_multithread while gl_meshcache is active

Stop building geometry for lines that have a portal (when gl_meshcache is active)
This commit is contained in:
Magnus Norddahl 2023-07-04 02:23:07 +02:00 committed by Christoph Oelckers
parent 256dd8fa3d
commit f8f9cf707b
2 changed files with 35 additions and 18 deletions

View file

@ -142,10 +142,6 @@ void HWDrawInfo::WorkerThread()
case RenderJob::WallJob: case RenderJob::WallJob:
{ {
HWWall wall;
SetupWall.Clock();
wall.sub = job->sub;
front = hw_FakeFlat(drawctx, job->sub->sector, in_area, false); front = hw_FakeFlat(drawctx, job->sub->sector, in_area, false);
auto seg = job->seg; auto seg = job->seg;
auto backsector = seg->backsector; auto backsector = seg->backsector;
@ -173,9 +169,23 @@ void HWDrawInfo::WorkerThread()
} }
else back = nullptr; else back = nullptr;
wall.Process(this, state, job->seg, front, back); if (MeshBSP)
rendered_lines++; {
SetupWall.Unclock(); SetupWall.Clock();
HWPortalWall portalwall;
portalwall.Process(this, state, job->seg, front, back);
rendered_lines++;
SetupWall.Unclock();
}
else
{
HWWall wall;
SetupWall.Clock();
wall.sub = job->sub;
wall.Process(this, state, job->seg, front, back);
rendered_lines++;
SetupWall.Unclock();
}
break; break;
} }
@ -743,17 +753,20 @@ void HWDrawInfo::DoSubsector(subsector_t * sub, FRenderState& state)
{ {
srf |= SSRF_PROCESSED; srf |= SSRF_PROCESSED;
if (multithread) if (!MeshBSP)
{ {
jobQueue.AddJob(RenderJob::FlatJob, sub); if (multithread)
} {
else if (!MeshBSP) jobQueue.AddJob(RenderJob::FlatJob, sub);
{ }
HWFlat flat; else
flat.section = sub->section; {
SetupFlat.Clock(); HWFlat flat;
flat.ProcessSector(this, state, fakesector); flat.section = sub->section;
SetupFlat.Unclock(); SetupFlat.Clock();
flat.ProcessSector(this, state, fakesector);
SetupFlat.Unclock();
}
} }
} }
// mark subsector as processed - but mark for rendering only if it has an actual area. // mark subsector as processed - but mark for rendering only if it has an actual area.
@ -854,7 +867,7 @@ void HWDrawInfo::RenderBSP(void *node, bool drawpsprites, FRenderState& state)
validcount++; // used for processing sidedefs only once by the renderer. validcount++; // used for processing sidedefs only once by the renderer.
MeshBSP = gl_meshcache; MeshBSP = gl_meshcache;
multithread = gl_multithread && !MeshBSP; multithread = gl_multithread;
if (multithread) if (multithread)
{ {
jobQueue.ReleaseAll(); jobQueue.ReleaseAll();

View file

@ -44,6 +44,7 @@
#include "hw_renderstate.h" #include "hw_renderstate.h"
#include "hw_skydome.h" #include "hw_skydome.h"
EXTERN_CVAR(Bool, gl_meshcache);
void SetGlowPlanes(FRenderState &state, const secplane_t& top, const secplane_t& bottom) void SetGlowPlanes(FRenderState &state, const secplane_t& top, const secplane_t& bottom)
{ {
@ -492,6 +493,9 @@ const char HWWall::passflag[] = {
//========================================================================== //==========================================================================
void HWWall::PutWall(HWDrawInfo *di, FRenderState& state, bool translucent) void HWWall::PutWall(HWDrawInfo *di, FRenderState& state, bool translucent)
{ {
if (gl_meshcache && !di->MeshBuilding) // Don't draw walls when only collecting portals
return;
if (texture && texture->GetTranslucency() && passflag[type] == 2) if (texture && texture->GetTranslucency() && passflag[type] == 2)
{ {
translucent = true; translucent = true;