mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
- move models into their own draw list to avoid frequent buffer changes.
- same for SKYHACK walls. Although rare, they would get in the way of optimizing the draw calls if not being separated out.
This commit is contained in:
parent
b8bcbe819b
commit
6b9d6787d9
6 changed files with 39 additions and 27 deletions
|
@ -15,8 +15,8 @@ enum DrawListType
|
||||||
{
|
{
|
||||||
GLDL_PLAIN,
|
GLDL_PLAIN,
|
||||||
GLDL_MASKED,
|
GLDL_MASKED,
|
||||||
GLDL_FOG,
|
GLDL_MASKEDOFS,
|
||||||
GLDL_FOGMASKED,
|
GLDL_MODELS,
|
||||||
|
|
||||||
GLDL_TRANSLUCENT,
|
GLDL_TRANSLUCENT,
|
||||||
GLDL_TRANSLUCENTBORDER,
|
GLDL_TRANSLUCENTBORDER,
|
||||||
|
@ -96,6 +96,11 @@ public:
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int Size()
|
||||||
|
{
|
||||||
|
return drawitems.Size();
|
||||||
|
}
|
||||||
|
|
||||||
void AddWall(GLWall * wall);
|
void AddWall(GLWall * wall);
|
||||||
void AddFlat(GLFlat * flat);
|
void AddFlat(GLFlat * flat);
|
||||||
void AddSprite(GLSprite * sprite);
|
void AddSprite(GLSprite * sprite);
|
||||||
|
|
|
@ -376,6 +376,18 @@ void FGLRenderer::RenderScene(int recursion)
|
||||||
gl_drawinfo->drawlists[GLDL_MASKED].Sort();
|
gl_drawinfo->drawlists[GLDL_MASKED].Sort();
|
||||||
gl_drawinfo->drawlists[GLDL_MASKED].Draw(pass);
|
gl_drawinfo->drawlists[GLDL_MASKED].Draw(pass);
|
||||||
|
|
||||||
|
// this list is empty most of the time so only waste time on it when in use.
|
||||||
|
if (gl_drawinfo->drawlists[GLDL_MASKEDOFS].Size() > 0)
|
||||||
|
{
|
||||||
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
glPolygonOffset(-1.0f, -128.0f);
|
||||||
|
gl_drawinfo->drawlists[GLDL_MASKEDOFS].Sort();
|
||||||
|
gl_drawinfo->drawlists[GLDL_MASKEDOFS].Draw(pass);
|
||||||
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
glPolygonOffset(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_drawinfo->drawlists[GLDL_MODELS].Draw(pass);
|
||||||
|
|
||||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
|
|
@ -315,13 +315,9 @@ inline void GLSprite::PutSprite(bool translucent)
|
||||||
{
|
{
|
||||||
list = GLDL_TRANSLUCENT;
|
list = GLDL_TRANSLUCENT;
|
||||||
}
|
}
|
||||||
else if ((!gl_isBlack (Colormap.FadeColor) || level.flags&LEVEL_HASFADETABLE))
|
|
||||||
{
|
|
||||||
list = GLDL_FOGMASKED;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list = GLDL_MASKED;
|
list = GLDL_MODELS;
|
||||||
}
|
}
|
||||||
gl_drawinfo->drawlists[list].AddSprite(this);
|
gl_drawinfo->drawlists[list].AddSprite(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,11 +97,9 @@ public:
|
||||||
//GLWF_CLAMPX=1, use GLT_* for these!
|
//GLWF_CLAMPX=1, use GLT_* for these!
|
||||||
//GLWF_CLAMPY=2,
|
//GLWF_CLAMPY=2,
|
||||||
GLWF_SKYHACK=4,
|
GLWF_SKYHACK=4,
|
||||||
GLWF_FOGGY=8,
|
GLWF_GLOW=8, // illuminated by glowing flats
|
||||||
GLWF_GLOW=16, // illuminated by glowing flats
|
GLWF_NOSPLITUPPER=16,
|
||||||
GLWF_NOSHADER=32, // cannot be drawn with shaders.
|
GLWF_NOSPLITLOWER=32,
|
||||||
GLWF_NOSPLITUPPER=64,
|
|
||||||
GLWF_NOSPLITLOWER=128,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -148,14 +148,22 @@ void GLWall::PutWall(bool translucent)
|
||||||
bool masked;
|
bool masked;
|
||||||
|
|
||||||
masked = passflag[type]==1? false : (gltexture && gltexture->isMasked());
|
masked = passflag[type]==1? false : (gltexture && gltexture->isMasked());
|
||||||
list = masked ? GLDL_MASKED : GLDL_PLAIN;
|
|
||||||
|
if ((flags&GLWF_SKYHACK && type == RENDERWALL_M2S))
|
||||||
|
{
|
||||||
|
list = GLDL_MASKEDOFS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list = masked ? GLDL_MASKED : GLDL_PLAIN;
|
||||||
|
}
|
||||||
gl_drawinfo->drawlists[list].AddWall(this);
|
gl_drawinfo->drawlists[list].AddWall(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
else switch (type)
|
else switch (type)
|
||||||
{
|
{
|
||||||
case RENDERWALL_COLORLAYER:
|
case RENDERWALL_COLORLAYER:
|
||||||
gl_drawinfo->drawlists[GLDL_TRANSLUCENT].AddWall(this);
|
gl_drawinfo->drawlists[GLDL_TRANSLUCENTBORDER].AddWall(this);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// portals don't go into the draw list.
|
// portals don't go into the draw list.
|
||||||
|
|
|
@ -369,14 +369,10 @@ void GLWall::Draw(int pass)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// This allows mid textures to be drawn on lines that might overlap a sky wall
|
if (type == RENDERWALL_COLORLAYER)
|
||||||
if ((flags&GLWF_SKYHACK && type==RENDERWALL_M2S) || type == RENDERWALL_COLORLAYER)
|
|
||||||
{
|
{
|
||||||
if (pass != GLPASS_DECALS)
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
{
|
glPolygonOffset(-1.0f, -128.0f);
|
||||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
|
||||||
glPolygonOffset(-1.0f, -128.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pass)
|
switch (pass)
|
||||||
|
@ -426,12 +422,9 @@ void GLWall::Draw(int pass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags&GLWF_SKYHACK && type==RENDERWALL_M2S) || type == RENDERWALL_COLORLAYER)
|
if (type == RENDERWALL_COLORLAYER)
|
||||||
{
|
{
|
||||||
if (pass!=GLPASS_DECALS)
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
{
|
glPolygonOffset(0, 0);
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
|
||||||
glPolygonOffset(0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue