- moved the SectorMarker handling into the level itself.
This commit is contained in:
parent
ea849e5aca
commit
68fe5534a4
3 changed files with 117 additions and 103 deletions
106
src/dobjgc.cpp
106
src/dobjgc.cpp
|
|
@ -96,9 +96,6 @@
|
|||
#define DEFAULT_GCMUL 400 // GC runs 'quadruple the speed' of memory allocation
|
||||
|
||||
// Number of sectors to mark for each step.
|
||||
#define SECTORSTEPSIZE 32
|
||||
#define POLYSTEPSIZE 120
|
||||
#define SIDEDEFSTEPSIZE 240
|
||||
|
||||
#define GCSTEPSIZE 1024u
|
||||
#define GCSWEEPMAX 40
|
||||
|
|
@ -107,22 +104,6 @@
|
|||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
// This object is responsible for marking sectors during the propagate
|
||||
// stage. In case there are many, many sectors, it lets us break them
|
||||
// up instead of marking them all at once.
|
||||
class DSectorMarker : public DObject
|
||||
{
|
||||
DECLARE_CLASS(DSectorMarker, DObject)
|
||||
public:
|
||||
DSectorMarker() : SecNum(0),PolyNum(0),SideNum(0) {}
|
||||
size_t PropagateMark();
|
||||
int SecNum;
|
||||
int PolyNum;
|
||||
int SideNum;
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DSectorMarker, false, false)
|
||||
|
||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||
|
||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||
|
|
@ -154,8 +135,6 @@ bool FinalGC;
|
|||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static DSectorMarker *SectorMarker;
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -316,19 +295,11 @@ static void MarkRoot()
|
|||
players[i].PropagateMark();
|
||||
}
|
||||
// Mark sectors.
|
||||
if (SectorMarker == nullptr && level.sectors.Size() > 0)
|
||||
|
||||
for auto Level : AllLevels())
|
||||
{
|
||||
SectorMarker = Create<DSectorMarker>();
|
||||
Level->Mark();
|
||||
}
|
||||
else if (level.sectors.Size() == 0)
|
||||
{
|
||||
SectorMarker = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
SectorMarker->SecNum = 0;
|
||||
}
|
||||
Mark(SectorMarker);
|
||||
// Mark bot stuff.
|
||||
Mark(bglobal.firstthing);
|
||||
Mark(bglobal.body1);
|
||||
|
|
@ -615,77 +586,6 @@ void DelSoftRoot(DObject *obj)
|
|||
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DSectorMarker :: PropagateMark
|
||||
//
|
||||
// Propagates marks across a few sectors and reinserts itself into the
|
||||
// gray list if it didn't do them all.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
size_t DSectorMarker::PropagateMark()
|
||||
{
|
||||
int i;
|
||||
int marked = 0;
|
||||
bool moretodo = false;
|
||||
int numsectors = level.sectors.Size();
|
||||
|
||||
for (i = 0; i < SECTORSTEPSIZE && SecNum + i < numsectors; ++i)
|
||||
{
|
||||
sector_t *sec = &level.sectors[SecNum + i];
|
||||
GC::Mark(sec->SoundTarget);
|
||||
GC::Mark(sec->SecActTarget);
|
||||
GC::Mark(sec->floordata);
|
||||
GC::Mark(sec->ceilingdata);
|
||||
GC::Mark(sec->lightingdata);
|
||||
for(int j=0;j<4;j++) GC::Mark(sec->interpolations[j]);
|
||||
}
|
||||
marked += i * sizeof(sector_t);
|
||||
if (SecNum + i < numsectors)
|
||||
{
|
||||
SecNum += i;
|
||||
moretodo = true;
|
||||
}
|
||||
|
||||
if (!moretodo && level.Polyobjects.Size() > 0)
|
||||
{
|
||||
for (i = 0; i < POLYSTEPSIZE && PolyNum + i < (int)level.Polyobjects.Size(); ++i)
|
||||
{
|
||||
GC::Mark(level.Polyobjects[PolyNum + i].interpolation);
|
||||
}
|
||||
marked += i * sizeof(FPolyObj);
|
||||
if (PolyNum + i < (int)level.Polyobjects.Size())
|
||||
{
|
||||
PolyNum += i;
|
||||
moretodo = true;
|
||||
}
|
||||
}
|
||||
if (!moretodo && level.sides.Size() > 0)
|
||||
{
|
||||
for (i = 0; i < SIDEDEFSTEPSIZE && SideNum + i < (int)level.sides.Size(); ++i)
|
||||
{
|
||||
side_t *side = &level.sides[SideNum + i];
|
||||
for (int j = 0; j < 3; j++) GC::Mark(side->textures[j].interpolation);
|
||||
}
|
||||
marked += i * sizeof(side_t);
|
||||
if (SideNum + i < (int)level.sides.Size())
|
||||
{
|
||||
SideNum += i;
|
||||
moretodo = true;
|
||||
}
|
||||
}
|
||||
// If there are more sectors to mark, put ourself back into the gray
|
||||
// list.
|
||||
if (moretodo)
|
||||
{
|
||||
Black2Gray();
|
||||
GCNext = GC::Gray;
|
||||
GC::Gray = this;
|
||||
}
|
||||
return marked;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// STAT gc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue