- Moved all static variables in hw_renderhacks into HWDrawInfo

- removed the profiling code from hw_renderhacks because it was broken in its current state and if still needed needs to be redone differently.
This commit is contained in:
Christoph Oelckers 2018-04-25 13:59:14 +02:00
parent 1648fc6a07
commit 81341ac6c5
3 changed files with 9 additions and 66 deletions

View file

@ -140,9 +140,6 @@ ADD_STAT(lightstats)
return out; return out;
} }
void AppendMissingTextureStats(FString &out);
static int printstats; static int printstats;
static bool switchfps; static bool switchfps;
static uint64_t waitstart; static uint64_t waitstart;
@ -164,7 +161,7 @@ void CheckBench()
AppendRenderStats(compose); AppendRenderStats(compose);
AppendRenderTimes(compose); AppendRenderTimes(compose);
AppendLightStats(compose); AppendLightStats(compose);
AppendMissingTextureStats(compose); //AppendMissingTextureStats(compose);
compose.AppendFormat("%llu fps\n\n", screen->GetLastFPS()); compose.AppendFormat("%llu fps\n\n", screen->GetLastFPS());
FILE *f = fopen("benchmarks.txt", "at"); FILE *f = fopen("benchmarks.txt", "at");

View file

@ -78,6 +78,14 @@ struct HWDrawInfo
TArray<uint8_t> ss_renderflags; TArray<uint8_t> ss_renderflags;
TArray<uint8_t> no_renderflags; TArray<uint8_t> no_renderflags;
private:
// For ProcessLowerMiniseg
bool inview;
subsector_t * viewsubsector;
TArray<seg_t *> lowersegs;
sector_t fakesec; // this is a struct member because it gets used in recursively called functions so it cannot be pu on the stack.
public:
void ClearBuffers(); void ClearBuffers();

View file

@ -35,23 +35,6 @@
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back); sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
// This is for debugging maps.
// profiling data
static int totalupper, totallower;
static int lowershcount, uppershcount;
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<seg_t *> lowersegs;
void HWDrawInfo::ClearBuffers() void HWDrawInfo::ClearBuffers()
{ {
for(unsigned int i=0;i< otherfloorplanes.Size();i++) for(unsigned int i=0;i< otherfloorplanes.Size();i++)
@ -131,7 +114,6 @@ void HWDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float B
{ {
if (!side->segs[0]->backsector) return; if (!side->segs[0]->backsector) return;
totalms.Clock();
for (int i = 0; i < side->numsegs; i++) for (int i = 0; i < side->numsegs; i++)
{ {
seg_t *seg = side->segs[i]; seg_t *seg = side->segs[i];
@ -145,7 +127,6 @@ void HWDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float B
if (sub->render_sector != sub->sector || seg->frontsector != sub->sector) if (sub->render_sector != sub->sector || seg->frontsector != sub->sector)
{ {
totalms.Unclock();
return; return;
} }
@ -163,7 +144,6 @@ void HWDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float B
msi.MTI_Index = i; msi.MTI_Index = i;
msi.seg = seg; msi.seg = seg;
MissingUpperSegs.Push(msi); MissingUpperSegs.Push(msi);
totalms.Unclock();
return; return;
} }
} }
@ -175,7 +155,6 @@ void HWDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float B
MissingUpperSegs.Push(msi); MissingUpperSegs.Push(msi);
} }
} }
totalms.Unclock();
} }
//========================================================================== //==========================================================================
@ -194,7 +173,6 @@ void HWDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float B
if (backsec->transdoorheight == backsec->GetPlaneTexZ(sector_t::floor)) return; if (backsec->transdoorheight == backsec->GetPlaneTexZ(sector_t::floor)) return;
} }
totalms.Clock();
// we need to check all segs of this sidedef // we need to check all segs of this sidedef
for (int i = 0; i < side->numsegs; i++) for (int i = 0; i < side->numsegs; i++)
{ {
@ -210,14 +188,12 @@ void HWDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float B
if (sub->render_sector != sub->sector || seg->frontsector != sub->sector) if (sub->render_sector != sub->sector || seg->frontsector != sub->sector)
{ {
totalms.Unclock();
return; return;
} }
// Ignore FF_FIX's because they are designed to abuse missing textures // Ignore FF_FIX's because they are designed to abuse missing textures
if (seg->backsector->e->XFloor.ffloors.Size() && (seg->backsector->e->XFloor.ffloors[0]->flags&(FF_FIX | FF_SEETHROUGH)) == FF_FIX) if (seg->backsector->e->XFloor.ffloors.Size() && (seg->backsector->e->XFloor.ffloors[0]->flags&(FF_FIX | FF_SEETHROUGH)) == FF_FIX)
{ {
totalms.Unclock();
return; return;
} }
@ -235,7 +211,6 @@ void HWDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float B
msi.MTI_Index = i; msi.MTI_Index = i;
msi.seg = seg; msi.seg = seg;
MissingLowerSegs.Push(msi); MissingLowerSegs.Push(msi);
totalms.Unclock();
return; return;
} }
} }
@ -247,7 +222,6 @@ void HWDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float B
MissingLowerSegs.Push(msi); MissingLowerSegs.Push(msi);
} }
} }
totalms.Unclock();
} }
@ -483,9 +457,6 @@ bool HWDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez, area_t
void HWDrawInfo::HandleMissingTextures(area_t in_area) void HWDrawInfo::HandleMissingTextures(area_t in_area)
{ {
sector_t fake; sector_t fake;
totalms.Clock();
totalupper = MissingUpperTextures.Size();
totallower = MissingLowerTextures.Size();
for (unsigned int i = 0; i < MissingUpperTextures.Size(); i++) for (unsigned int i = 0; i < MissingUpperTextures.Size(); i++)
{ {
@ -629,10 +600,6 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
continue; continue;
} }
} }
totalms.Unclock();
showtotalms = totalms;
totalms.Reset();
} }
@ -691,20 +658,6 @@ void HWDrawInfo::DrawUnhandledMissingTextures()
} }
void AppendMissingTextureStats(FString &out)
{
out.AppendFormat("Missing textures: %d upper, %d lower, %.3f ms\n",
totalupper, totallower, showtotalms.TimeMS());
}
ADD_STAT(missingtextures)
{
FString out;
AppendMissingTextureStats(out);
return out;
}
//========================================================================== //==========================================================================
// //
// Multi-sector deep water hacks // Multi-sector deep water hacks
@ -930,10 +883,6 @@ bool HWDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
void HWDrawInfo::HandleHackedSubsectors() void HWDrawInfo::HandleHackedSubsectors()
{ {
lowershcount=uppershcount=0;
totalssms.Reset();
totalssms.Clock();
viewsubsector = R_PointInSubsector(r_viewpoint.Pos); viewsubsector = R_PointInSubsector(r_viewpoint.Pos);
// Each subsector may only be processed once in this loop! // Each subsector may only be processed once in this loop!
@ -957,7 +906,6 @@ void HWDrawInfo::HandleHackedSubsectors()
AddOtherFloorPlane(sub->render_sector->sectornum, node); AddOtherFloorPlane(sub->render_sector->sectornum, node);
} }
if (inview) ProcessLowerMinisegs(lowersegs); if (inview) ProcessLowerMinisegs(lowersegs);
lowershcount+=HandledSubsectors.Size();
} }
} }
} }
@ -980,24 +928,14 @@ void HWDrawInfo::HandleHackedSubsectors()
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherCeilingPlane(sub->render_sector->sectornum, node); AddOtherCeilingPlane(sub->render_sector->sectornum, node);
} }
uppershcount+=HandledSubsectors.Size();
} }
} }
} }
SubsectorHacks.Clear(); SubsectorHacks.Clear();
totalssms.Unclock();
} }
ADD_STAT(sectorhacks)
{
FString out;
out.Format("sectorhacks = %.3f ms, %d upper, %d lower\n", totalssms.TimeMS(), uppershcount, lowershcount);
return out;
}
//========================================================================== //==========================================================================
// //
// This merges visplanes that lie inside a sector stack together // This merges visplanes that lie inside a sector stack together