From b49a3e5875dbf5eb13ecace935fc4ed7eebd752a Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 9 Dec 2025 18:14:44 +0100 Subject: [PATCH] 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 --- src/hardware/hw_main.cpp | 104 +++++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 26 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 4a5589f51..e52f14e79 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -1891,6 +1891,7 @@ 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; @@ -1903,19 +1904,6 @@ 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; - const ffloortype_e roverflags = rover->flags; if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES)) @@ -1927,6 +1915,45 @@ 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->flags; + + if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES)) + continue; + + if (rover->flags & FF_EXTRA) + { + if (!(r2flags & FF_CUTEXTRA)) + continue; + + if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG))) + continue; + } + else + { + if (!(r2flags & FF_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; + side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector); boolean do_texture_skew; @@ -2063,19 +2090,6 @@ 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; - const ffloortype_e roverflags = rover->flags; if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES)) @@ -2087,6 +2101,44 @@ 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->flags; + + if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES)) + continue; + + if (rover->flags & FF_EXTRA) + { + if (!(r2flags & FF_CUTEXTRA)) + continue; + + if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG))) + continue; + } + else + { + if (!(r2flags & FF_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; + side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector); boolean do_texture_skew;