Some cherrypicks from SRB2 Classic's 'Faster software drawing'

-Textures with 0 height are not checked for wraps, this helps speed up multipatch columns.
-A useless call to R_FakeFlat has been removed.
-Slopes now use floats rather than doubles to calculate UV coordinates.
This commit is contained in:
NepDisk 2025-07-02 21:38:06 -04:00
parent d502c04698
commit 0bf360a82e
2 changed files with 25 additions and 11 deletions

View file

@ -225,7 +225,21 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
npow2min = -1; npow2min = -1;
npow2max = dc->sourcelength; npow2max = dc->sourcelength;
if (dc->sourcelength & heightmask) // not a power of 2 -- killough if (heightmask == -1)
{
if (frac < 0)
// adjust in case we underread
frac += FRACUNIT;
// texture has no height, so just go
while (--count > 0)
{
INT32 n = frac >> FRACBITS;
dest += vid.width;
*dest = R_DrawColumnPixel<Type>(dc, dest, n);
}
}
else if (dc->texheight & heightmask) // not a power of 2 -- killough
{ {
heightmask = dc->texheight << FRACBITS; heightmask = dc->texheight << FRACBITS;

View file

@ -255,7 +255,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
{ {
// x1, x2 = ds_x1, ds_x2 // x1, x2 = ds_x1, ds_x2
int width = ds->x2 - ds->x1; int width = ds->x2 - ds->x1;
double iz, uz, vz; float iz, uz, vz;
UINT32 u, v; UINT32 u, v;
int i; int i;
@ -263,9 +263,9 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
UINT8 *dest; UINT8 *dest;
UINT8 *dsrc; UINT8 *dsrc;
double startz, startu, startv; float startz, startu, startv;
double izstep, uzstep, vzstep; float izstep, uzstep, vzstep;
double endz, endu, endv; float endz, endu, endv;
UINT32 stepu, stepv; UINT32 stepu, stepv;
UINT32 bit; UINT32 bit;
INT32 tiltlighting[MAXVIDWIDTH]; INT32 tiltlighting[MAXVIDWIDTH];
@ -390,7 +390,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
} }
else else
{ {
double left = width; float left = width;
iz += ds->szp.x * left; iz += ds->szp.x * left;
uz += ds->sup.x * left; uz += ds->sup.x * left;
vz += ds->svp.x * left; vz += ds->svp.x * left;
@ -514,7 +514,7 @@ static void R_DrawTiltedNPO2SpanTemplate(drawspandata_t* ds)
{ {
// x1, x2 = ds_x1, ds_x2 // x1, x2 = ds_x1, ds_x2
int width = ds->x2 - ds->x1; int width = ds->x2 - ds->x1;
double iz, uz, vz; float iz, uz, vz;
UINT32 u, v; UINT32 u, v;
int i; int i;
@ -522,9 +522,9 @@ static void R_DrawTiltedNPO2SpanTemplate(drawspandata_t* ds)
UINT8 *dest; UINT8 *dest;
UINT8 *dsrc; UINT8 *dsrc;
double startz, startu, startv; float startz, startu, startv;
double izstep, uzstep, vzstep; float izstep, uzstep, vzstep;
double endz, endu, endv; float endz, endu, endv;
UINT32 stepu, stepv; UINT32 stepu, stepv;
INT32 tiltlighting[MAXVIDWIDTH]; INT32 tiltlighting[MAXVIDWIDTH];
@ -689,7 +689,7 @@ static void R_DrawTiltedNPO2SpanTemplate(drawspandata_t* ds)
} }
else else
{ {
double left = width; float left = width;
iz += ds->szp.x * left; iz += ds->szp.x * left;
uz += ds->sup.x * left; uz += ds->sup.x * left;
vz += ds->svp.x * left; vz += ds->svp.x * left;