mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 22:33:17 +00:00
- remove the GLWallLightEntry type. Everything it contains can be retrieved from the existing lightlist just as easily, and this approach avoids a lot of memory allocations.
- removed the SplitWall profiling timer because all it measures now is an almost empty function.
This commit is contained in:
parent
71da7406bd
commit
9305cd86a0
7 changed files with 20 additions and 44 deletions
|
@ -413,7 +413,6 @@ static void InitVertexData()
|
|||
TArray<int> * vt_sectorlists;
|
||||
|
||||
int i,j,k;
|
||||
unsigned int l;
|
||||
|
||||
vt_sectorlists = new TArray<int>[numvertexes];
|
||||
|
||||
|
|
|
@ -838,7 +838,6 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
|||
angle_t a1 = FrustumAngle();
|
||||
clipper.SafeAddClipRangeRealAngles(viewangle + a1, viewangle - a1);
|
||||
|
||||
GLWallLightEntryArena.FreeAll();
|
||||
ProcessScene(toscreen);
|
||||
if (mainview) EndDrawScene(retval); // do not call this for camera textures.
|
||||
eye->TearDown();
|
||||
|
|
|
@ -85,16 +85,6 @@ struct GLSectorPlane
|
|||
};
|
||||
|
||||
|
||||
struct GLWallLightEntry
|
||||
{
|
||||
secplane_t *cliptop;
|
||||
secplane_t *clipbottom;
|
||||
int lightlevel;
|
||||
FColormap colormap;
|
||||
};
|
||||
|
||||
extern FMemArena GLWallLightEntryArena;
|
||||
|
||||
class GLWall
|
||||
{
|
||||
public:
|
||||
|
@ -134,8 +124,7 @@ public:
|
|||
|
||||
fixed_t viewdistance;
|
||||
|
||||
GLWallLightEntry *lights;
|
||||
unsigned int lightsize;
|
||||
TArray<lightlist_t> *lightlist;
|
||||
int lightlevel;
|
||||
BYTE type;
|
||||
BYTE flags;
|
||||
|
|
|
@ -62,8 +62,6 @@
|
|||
#include "gl/shaders/gl_shader.h"
|
||||
|
||||
|
||||
FMemArena GLWallLightEntryArena;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Checks whether a wall should glow
|
||||
|
@ -228,28 +226,14 @@ void GLWall::PutWall(bool translucent)
|
|||
|
||||
void GLWall::SplitWall(sector_t * frontsector, bool translucent)
|
||||
{
|
||||
TArray<lightlist_t> & lightlist=frontsector->e->XFloor.lightlist;
|
||||
|
||||
if (glseg.x1==glseg.x2 && glseg.y1==glseg.y2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
::SplitWall.Clock();
|
||||
|
||||
lightsize = lightlist.Size();
|
||||
lights = (GLWallLightEntry*)GLWallLightEntryArena.Alloc(sizeof(GLWallLightEntry)*lightsize);
|
||||
secplane_t *upperplane = &topplane;
|
||||
for (unsigned i = 0; i < lightlist.Size(); i++)
|
||||
{
|
||||
lights[i].cliptop = &lightlist[i].plane;
|
||||
lights[i].clipbottom = i == lightlist.Size() - 1 ? (secplane_t*)NULL : &lightlist[i + 1].plane;
|
||||
lights[i].lightlevel = lightlist[i].caster != NULL? gl_ClampLight(*lightlist[i].p_lightlevel) : lightlevel;
|
||||
lights[i].colormap.FadeColor = Colormap.FadeColor;
|
||||
lights[i].colormap.CopyFrom3DLight(&lightlist[i]);
|
||||
}
|
||||
lightlist=&frontsector->e->XFloor.lightlist;
|
||||
PutWall(translucent);
|
||||
lights = NULL;
|
||||
lightsize = 0;
|
||||
lightlist = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1296,7 +1280,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
|||
Colormap = frontsector->ColorMap;
|
||||
flags = 0;
|
||||
dynlightindex = UINT_MAX;
|
||||
lights = NULL;
|
||||
lightlist = NULL;
|
||||
|
||||
int rel = 0;
|
||||
int orglightlevel = gl_ClampLight(frontsector->lightlevel);
|
||||
|
|
|
@ -330,7 +330,7 @@ void GLWall::RenderTextured(int rflags)
|
|||
}
|
||||
|
||||
float absalpha = fabsf(alpha);
|
||||
if (lights == NULL)
|
||||
if (lightlist == NULL)
|
||||
{
|
||||
gl_SetColor(lightlevel, rel, Colormap, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, RenderStyle == STYLE_Add);
|
||||
|
@ -341,13 +341,19 @@ void GLWall::RenderTextured(int rflags)
|
|||
gl_RenderState.EnableSplit(true);
|
||||
glEnable(GL_CLIP_DISTANCE3);
|
||||
glEnable(GL_CLIP_DISTANCE4);
|
||||
for (unsigned i = 0; i <lightsize; i++)
|
||||
|
||||
for (unsigned i = 0; i < lightlist->Size(); i++)
|
||||
{
|
||||
gl_SetColor(lights[i].lightlevel, rel, lights[i].colormap, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) gl_SetFog(lights[i].lightlevel, rel, &lights[i].colormap, RenderStyle == STYLE_Add);
|
||||
gl_RenderState.SetSplitPlanes(*lights[i].cliptop, lights[i].clipbottom? *lights[i].clipbottom : bottomplane);
|
||||
int thisll = (*lightlist)[i].caster != NULL? gl_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel;
|
||||
FColormap thiscm;
|
||||
thiscm.FadeColor = Colormap.FadeColor;
|
||||
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
|
||||
gl_SetColor(thisll, rel, thiscm, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) gl_SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
|
||||
gl_RenderState.SetSplitPlanes((*lightlist)[i].plane, i == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[i + 1].plane);
|
||||
RenderWall(rflags);
|
||||
}
|
||||
|
||||
glDisable(GL_CLIP_DISTANCE3);
|
||||
glDisable(GL_CLIP_DISTANCE4);
|
||||
gl_RenderState.EnableSplit(false);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "gl/utility/gl_convert.h"
|
||||
|
||||
|
||||
glcycle_t RenderWall,SetupWall,ClipWall,SplitWall;
|
||||
glcycle_t RenderWall,SetupWall,ClipWall;
|
||||
glcycle_t RenderFlat,SetupFlat;
|
||||
glcycle_t RenderSprite,SetupSprite;
|
||||
glcycle_t All, Finish, PortalAll, Bsp;
|
||||
|
@ -91,7 +91,6 @@ void ResetProfilingData()
|
|||
ProcessAll.Reset();
|
||||
RenderWall.Reset();
|
||||
SetupWall.Reset();
|
||||
SplitWall.Reset();
|
||||
ClipWall.Reset();
|
||||
RenderFlat.Reset();
|
||||
SetupFlat.Reset();
|
||||
|
@ -111,15 +110,15 @@ void ResetProfilingData()
|
|||
|
||||
static void AppendRenderTimes(FString &str)
|
||||
{
|
||||
double setupwall = SetupWall.TimeMS() - SplitWall.TimeMS();
|
||||
double setupwall = SetupWall.TimeMS();
|
||||
double clipwall = ClipWall.TimeMS() - SetupWall.TimeMS();
|
||||
double bsp = Bsp.TimeMS() - ClipWall.TimeMS() - SetupFlat.TimeMS() - SetupSprite.TimeMS();
|
||||
|
||||
str.AppendFormat("W: Render=%2.3f, Split = %2.3f, Setup=%2.3f, Clip=%2.3f\n"
|
||||
str.AppendFormat("W: Render=%2.3f, Setup=%2.3f, Clip=%2.3f\n"
|
||||
"F: Render=%2.3f, Setup=%2.3f\n"
|
||||
"S: Render=%2.3f, Setup=%2.3f\n"
|
||||
"All=%2.3f, Render=%2.3f, Setup=%2.3f, BSP = %2.3f, Portal=%2.3f, Drawcalls=%2.3f, Finish=%2.3f\n",
|
||||
RenderWall.TimeMS(), SplitWall.TimeMS(), setupwall, clipwall, RenderFlat.TimeMS(), SetupFlat.TimeMS(),
|
||||
RenderWall.TimeMS(), setupwall, clipwall, RenderFlat.TimeMS(), SetupFlat.TimeMS(),
|
||||
RenderSprite.TimeMS(), SetupSprite.TimeMS(), All.TimeMS() + Finish.TimeMS(), RenderAll.TimeMS(),
|
||||
ProcessAll.TimeMS(), bsp, PortalAll.TimeMS(), drawcalls.TimeMS(), Finish.TimeMS());
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
|
||||
#endif // __APPLE__
|
||||
|
||||
extern glcycle_t RenderWall,SetupWall,ClipWall,SplitWall;
|
||||
extern glcycle_t RenderWall,SetupWall,ClipWall;
|
||||
extern glcycle_t RenderFlat,SetupFlat;
|
||||
extern glcycle_t RenderSprite,SetupSprite;
|
||||
extern glcycle_t All, Finish, PortalAll, Bsp;
|
||||
|
|
Loading…
Reference in a new issue