diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index ac009a1c3..ecbbac0b7 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -48,6 +48,7 @@ #include "gl/renderer/gl_quaddrawer.h" FDrawInfo * gl_drawinfo; +FDrawInfoList di_list; //========================================================================== // @@ -987,8 +988,6 @@ void FDrawInfoList::Release(FDrawInfo * di) mList.Push(di); } -static FDrawInfoList di_list; - //========================================================================== // // diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 09aba32e1..130fb263a 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -87,6 +87,8 @@ UniqueList UniqueHorizons; UniqueList UniquePlaneMirrors; UniqueList UniqueLineToLines; +int skyboxrecursion = 0; + //========================================================================== // // @@ -460,7 +462,7 @@ void GLPortal::StartFrame() //----------------------------------------------------------------------------- // -// Portal info +// printing portal info // //----------------------------------------------------------------------------- @@ -471,7 +473,7 @@ CCMD(gl_portalinfo) gl_portalinfo = true; } -FString indent; +static FString indent; //----------------------------------------------------------------------------- // @@ -610,7 +612,7 @@ void GLPortal::RestoreMapSection() // GLSkyboxPortal::DrawContents // //----------------------------------------------------------------------------- -static int skyboxrecursion=0; + void GLSkyboxPortal::DrawContents() { int old_pm = PlaneMirrorMode; diff --git a/src/gl/scene/gl_renderhacks.cpp b/src/gl/scene/gl_renderhacks.cpp index d1e50ee92..fff839c5e 100644 --- a/src/gl/scene/gl_renderhacks.cpp +++ b/src/gl/scene/gl_renderhacks.cpp @@ -44,9 +44,16 @@ // profiling data static int totalupper, totallower; static int lowershcount, uppershcount; -static glcycle_t totalms, showtotalms; -static glcycle_t totalssms; -static sector_t fakesec; +static glcycle_t totalms, showtotalms, totalssms; + + +static sector_t fakesec; // this is static because it gets used in recursively called functions. + +// Having this static doesn't really matter here because the hack code is not multithreading-capable anyway. +static bool inview; +static subsector_t * viewsubsector; +static TArray lowersegs; + void FDrawInfo::ClearBuffers() { @@ -760,9 +767,6 @@ bool FDrawInfo::CheckAnchorFloor(subsector_t * sub) // Collect connected subsectors that have to be rendered with the same plane // //========================================================================== -static bool inview; -static subsector_t * viewsubsector; -static TArray lowersegs; bool FDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor) { @@ -1117,12 +1121,11 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor) void FDrawInfo::ProcessSectorStacks() { unsigned int i; - sector_t fake; validcount++; for (i=0;iin_area, false); + sector_t *sec = gl_FakeFlat(CeilingStacks[i], &fakesec, mDrawer->in_area, false); auto portal = sec->GetPortalGroup(sector_t::ceiling); if (portal != NULL) for(int k=0;ksubsectorcount;k++) { @@ -1147,7 +1150,7 @@ void FDrawInfo::ProcessSectorStacks() if (sub->portalcoverage[sector_t::ceiling].subsectors == NULL) { - BuildPortalCoverage(&sub->portalcoverage[sector_t::ceiling], sub, portal->mDisplacement); + BuildPortalCoverage(&sub->portalcoverage[sector_t::ceiling], sub, portal->mDisplacement); } portal->GetRenderState()->AddSubsector(sub); @@ -1166,7 +1169,7 @@ void FDrawInfo::ProcessSectorStacks() validcount++; for (i=0;iin_area, false); + sector_t *sec = gl_FakeFlat(FloorStacks[i], &fakesec, mDrawer->in_area, false); auto portal = sec->GetPortalGroup(sector_t::floor); if (portal != NULL) for(int k=0;ksubsectorcount;k++) { diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 7437816d2..8c5d9f7ad 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -86,8 +86,7 @@ EXTERN_CVAR (Bool, r_drawvoxels) extern bool NoInterpolateView; -area_t in_area; -int camtexcount; +int camtexcount; // used to decide how VSync is done. It just counts the number of camera textures per frame. //----------------------------------------------------------------------------- // @@ -273,7 +272,9 @@ void GLSceneDrawer::CreateScene() if (GLRenderer->mCurrentPortal != NULL) GLRenderer->mCurrentPortal->RenderAttached(); Bsp.Unclock(); - // And now the crappy hacks that have to be done to avoid rendering anomalies: + // And now the crappy hacks that have to be done to avoid rendering anomalies. + // These cannot be multithreaded when the time comes because all these depend + // on the global 'validcount' variable. gl_drawinfo->HandleMissingTextures(); // Missing upper/lower textures gl_drawinfo->HandleHackedSubsectors(); // open sector hacks for deep water diff --git a/src/gl/scene/gl_scenedrawer.h b/src/gl/scene/gl_scenedrawer.h index 4f59120ac..c926d0aae 100644 --- a/src/gl/scene/gl_scenedrawer.h +++ b/src/gl/scene/gl_scenedrawer.h @@ -56,6 +56,7 @@ public: int FixedColormap; area_t in_area; BitArray CurrentMapSections; // this cannot be a single number, because a group of portals with the same displacement may link different sections. + FDrawInfo * gl_drawinfo; angle_t FrustumAngle(); void SetViewMatrix(float vx, float vy, float vz, bool mirror, bool planemirror);