- some code cleanup.

This commit is contained in:
Christoph Oelckers 2014-08-23 18:54:24 +02:00
parent bf6079af46
commit 904cc2e158
5 changed files with 9 additions and 305 deletions

View file

@ -52,7 +52,6 @@
#include "gl/system/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
#include "gl/system/gl_threads.h"
#include "gl/system/gl_cvars.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/renderer/gl_lightdata.h"
@ -76,8 +75,6 @@
//
//===========================================================================
EXTERN_CVAR(Bool, gl_render_segs)
//-----------------------------------------------------------------------------
//
// Initialize
@ -117,14 +114,12 @@ void FGLRenderer::Initialize()
SetupLevel();
mShaderManager = new FShaderManager;
mSamplerManager = new FSamplerManager;
//mThreadManager = new FGLThreadManager;
}
FGLRenderer::~FGLRenderer()
{
gl_DeleteAllAttachedLights();
FMaterial::FlushAll();
//if (mThreadManager != NULL) delete mThreadManager;
if (mShaderManager != NULL) delete mShaderManager;
if (mSamplerManager != NULL) delete mSamplerManager;
if (mVBO != NULL) delete mVBO;

View file

@ -16,7 +16,6 @@ struct FDrawInfo;
struct pspdef_t;
class FShaderManager;
class GLPortal;
class FGLThreadManager;
class FLightBuffer;
class FSamplerManager;
@ -58,7 +57,6 @@ public:
AActor *mViewActor;
FShaderManager *mShaderManager;
FSamplerManager *mSamplerManager;
FGLThreadManager *mThreadManager;
int gl_spriteindex;
unsigned int mFBID;

View file

@ -186,20 +186,9 @@ static void AddLine (seg_t *seg)
{
SetupWall.Clock();
//if (!gl_multithreading)
{
GLWall wall;
wall.sub = currentsubsector;
wall.Process(seg, currentsector, backsector);
}
/*
else
{
FJob *job = new FGLJobProcessWall(currentsubsector, seg,
currentsector->sectornum, backsector != NULL? backsector->sectornum : -1);
GLRenderer->mThreadManager->AddJob(job);
}
*/
rendered_lines++;
SetupWall.Unclock();
@ -340,8 +329,6 @@ static inline void RenderThings(subsector_t * sub, sector_t * sector)
SetupSprite.Clock();
sector_t * sec=sub->sector;
if (sec->thinglist != NULL)
{
//if (!gl_multithreading)
{
// Handle all things in sector.
for (AActor * thing = sec->thinglist; thing; thing = thing->snext)
@ -349,14 +336,6 @@ static inline void RenderThings(subsector_t * sub, sector_t * sector)
GLRenderer->ProcessSprite(thing, sector);
}
}
/*
else if (sec->thinglist != NULL)
{
FJob *job = new FGLJobProcessSprites(sector);
GLRenderer->mThreadManager->AddJob(job);
}
*/
}
SetupSprite.Unclock();
}
@ -416,20 +395,10 @@ static void DoSubsector(subsector_t * sub)
{
SetupSprite.Clock();
//if (!gl_multithreading)
{
for (i = ParticlesInSubsec[DWORD(sub-subsectors)]; i != NO_PARTICLE; i = Particles[i].snext)
{
GLRenderer->ProcessParticle(&Particles[i], fakesector);
}
}
/*
else if (ParticlesInSubsec[DWORD(sub-subsectors)] != NO_PARTICLE)
{
FJob job = new FGLJobProcessParticles(sub);
GLRenderer->mThreadManager->AddJob(job);
}
*/
SetupSprite.Unclock();
}
@ -476,17 +445,7 @@ static void DoSubsector(subsector_t * sub)
srf |= SSRF_PROCESSED;
SetupFlat.Clock();
//if (!gl_multithreading)
{
GLRenderer->ProcessSector(fakesector);
}
/*
else
{
FJob *job = new FGLJobProcessFlats(sub);
GLRenderer->mThreadManager->AddJob(job);
}
*/
SetupFlat.Unclock();
}
// mark subsector as processed - but mark for rendering only if it has an actual area.

View file

@ -36,7 +36,6 @@ EXTERN_CVAR(Bool,gl_mirror_envmap)
EXTERN_CVAR(Bool,gl_mirrors)
EXTERN_CVAR(Bool,gl_mirror_envmap)
EXTERN_CVAR(Bool, gl_render_segs)
EXTERN_CVAR(Bool, gl_seamless)
EXTERN_CVAR(Float, gl_mask_threshold)

View file

@ -1,247 +0,0 @@
#if 0 //ndef __GL_THREADS_H
#define __GL_THREADS_H
#ifdef WIN32
#include <process.h>
#endif
#include "critsec.h"
// system specific Base classes - should be externalized to a separate header later.
#ifdef WIN32
class FEvent
{
HANDLE mEvent;
public:
FEvent(bool manual = true, bool initial = false)
{
mEvent = CreateEvent(NULL, manual, initial, NULL);
}
~FEvent()
{
CloseHandle(mEvent);
}
void Set()
{
SetEvent(mEvent);
}
void Reset()
{
ResetEvent(mEvent);
}
};
class FThread
{
protected:
uintptr_t hThread;
bool mTerminateRequest;
public:
FThread(int stacksize)
{
hThread = _beginthreadex(NULL, stacksize, StaticRun, this, 0, NULL);
}
virtual ~FThread()
{
CloseHandle((HANDLE)hThread);
}
void SignalTerminate()
{
mTerminateRequest = true;
}
virtual void Run() = 0;
private:
static unsigned __stdcall StaticRun(void *param)
{
FThread *thread = (FThread*)param;
thread->Run();
return 0;
}
};
#else
class FEvent
{
public:
FEvent(bool manual = true, bool initial = false)
{
}
~FEvent()
{
}
void Set()
{
}
void Reset()
{
}
};
class FThread
{
protected:
bool mTerminateRequest;
public:
FThread(int stacksize)
{
}
virtual ~FThread()
{
}
void SignalTerminate()
{
mTerminateRequest = true;
}
virtual void Run() = 0;
};
#endif
enum
{
CS_ValidateTexture,
CS_Hacks,
CS_Drawlist,
CS_Portals,
MAX_GL_CRITICAL_SECTIONS
};
class FJob
{
friend class FJobQueue;
FJob *pNext;
FJob *pPrev;
public:
FJob() { pNext = pPrev = NULL; }
virtual ~FJob();
virtual void Run() = 0;
};
class FJobQueue
{
FCriticalSection mCritSec; // for limiting access
FEvent mEvent; // signals that the queue is emoty or not
FJob *pFirst;
FJob *pLast;
public:
FJobQueue();
~FJobQueue();
void AddJob(FJob *job);
FJob *GetJob();
};
class FJobThread : public FThread
{
FJobQueue *mQueue;
public:
FJobThread(FJobQueue *queue);
~FJobThread();
void Run();
};
class FGLJobProcessWall : public FJob
{
seg_t *mSeg;
subsector_t *mSub;
int mFrontsector, mBacksector;
public:
FGLJobProcessWall(seg_t *seg, subsector_t *sub, int frontsector, int backsector)
{
mSeg = seg;
mSub = sub;
mFrontsector = frontsector;
mBacksector = backsector;
}
void Run();
};
class FGLJobProcessSprites : public FJob
{
sector_t *mSector;
public:
FGLJobProcessSprites(sector_t *sector);
void Run();
};
class FGLJobProcessParticles : public FJob
{
subsector_t *mSubsector;
public:
FGLJobProcessParticles(subsector_t *subsector);
void Run();
};
class FGLJobProcessFlats : public FJob
{
subsector_t *mSubsector;
public:
FGLJobProcessFlats(subsector_t *subsector);
void Run();
};
class FGLThreadManager
{
#if 0
FCriticalSection mCritSecs[MAX_GL_CRITICAL_SECTIONS];
FJobQueue mJobs;
FJobThread *mThreads[2];
public:
FGLThreadManager() {}
~FGLThreadManager() {}
void StartJobs();
void PauseJobs();
void EnterCS(int index)
{
mCritSecs[index].Enter();
}
void LeaveCS(int index)
{
mCritSecs[index].Leave();
}
void AddJob(FJob *job)
{
mJobs.AddJob(job);
}
FJob *GetJob()
{
return mJobs.GetJob();
}
#endif
};
#endif