HWR_ProcessSeg: port softwares code to skip rendering inner sides that are "joined" to other fofs

This seems to improve performance on maps with moderate to lots of fofs quite a bit.
On maps with only a few fofs, this makes no difference or has very very little regression
Need to test and check if there are any visual errors, but so far everything seems good
This commit is contained in:
Alug 2026-01-17 01:40:18 -05:00 committed by NepDisk
parent 527fd2b0fb
commit 67d2a0ae90

View file

@ -1694,6 +1694,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// Used for height comparisons and etc across FOFs and slopes
fixed_t high1, highslope1, low1, lowslope1;
fixed_t high2, highslope2, low2, lowslope2;
INT32 texnum;
line_t * newline = NULL; // Multi-Property FOF
@ -1707,18 +1708,6 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
for (rover = gl_backsector->ffloors; rover; rover = rover->next)
{
boolean bothsides = false;
// Skip if it exists on both sectors.
ffloor_t * r2;
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
if (rover->master == r2->master)
{
bothsides = true;
break;
}
if (bothsides) continue;
if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERSIDES))
continue;
if (!(rover->fofflags & FOF_ALLSIDES) && rover->fofflags & FOF_INVERTSIDES)
@ -1730,6 +1719,45 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue;
ffloor_t * r2;
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
{
if (r2->master == rover->master) // Skip if same control line.
break;
const ffloortype_e r2flags = r2->fofflags;
if (!(r2flags & FOF_EXISTS) || !(r2flags & FOF_RENDERSIDES))
continue;
if (rover->fofflags & FOF_EXTRA)
{
if (!(r2flags & FOF_CUTEXTRA))
continue;
if (r2flags & FOF_EXTRA && (r2flags & (FOF_TRANSLUCENT|FOF_FOG)) != (rover->fofflags & (FOF_TRANSLUCENT|FOF_FOG)))
continue;
}
else
{
if (!(r2flags & FOF_CUTSOLIDS))
continue;
}
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
continue;
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
continue;
break;
}
if (r2)
continue;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
if (rover->master->flags & ML_TFERLINE)
@ -1867,18 +1895,6 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
{
boolean bothsides = false;
// Skip if it exists on both sectors.
ffloor_t * r2;
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
if (rover->master == r2->master)
{
bothsides = true;
break;
}
if (bothsides) continue;
if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERSIDES))
continue;
if (!(rover->fofflags & FOF_ALLSIDES || rover->fofflags & FOF_INVERTSIDES))
@ -1890,6 +1906,44 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue;
ffloor_t * r2;
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
{
if (r2->master == rover->master) // Skip if same control line.
break;
const ffloortype_e r2flags = r2->fofflags;
if (!(r2flags & FOF_EXISTS) || !(r2flags & FOF_RENDERSIDES))
continue;
if (rover->fofflags & FOF_EXTRA)
{
if (!(r2flags & FOF_CUTEXTRA))
continue;
if (r2flags & FOF_EXTRA && (r2flags & (FOF_TRANSLUCENT|FOF_FOG)) != (rover->fofflags & (FOF_TRANSLUCENT|FOF_FOG)))
continue;
}
else
{
if (!(r2flags & FOF_CUTSOLIDS))
continue;
}
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
continue;
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
continue;
break;
}
if (r2)
continue;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
if (rover->master->flags & ML_TFERLINE)