fix column drawers clamping stuff

This commit is contained in:
Alug committed 2025-01-13 08:28:58 +01:00
1 parent 47a3de8fe1
commit 5db7f5f2e7
3 files changed
+30 -89

No files matched your search

+25 -85
View File
@@ -60,25 +60,13 @@ void R_DrawColumn_8(void)
register const UINT8 *source = dc_source;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
register INT32 heightmask = dc_sourcelength-1;
npow2min = -1;
npow2max = dc_sourcelength;
if (dc_texheight & heightmask) // not a power of 2 -- killough
if (dc_sourcelength & heightmask) // not a power of 2 -- killough
{
heightmask++;
heightmask <<= FRACBITS;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
heightmask = dc_texheight << FRACBITS;
if (frac < 0)
{
@@ -192,26 +180,14 @@ void R_Draw2sMultiPatchColumn_8(void)
// This is as fast as it gets.
register const UINT8 *source = dc_source;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
register INT32 heightmask = dc_sourcelength-1;
register UINT8 val;
npow2min = -1;
npow2max = dc_sourcelength;
if (dc_texheight & heightmask) // not a power of 2 -- killough
if (dc_sourcelength & heightmask) // not a power of 2 -- killough
{
heightmask++;
heightmask <<= FRACBITS;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
heightmask = dc_texheight << FRACBITS;
if (frac < 0)
{
@@ -343,26 +319,14 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
register const UINT8 *source = dc_source;
register const UINT8 *transmap = dc_transmap;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
register INT32 heightmask = dc_sourcelength-1;
register UINT8 val;
npow2min = -1;
npow2max = dc_sourcelength;
if (dc_texheight & heightmask) // not a power of 2 -- killough
if (dc_sourcelength & heightmask) // not a power of 2 -- killough
{
heightmask++;
heightmask <<= FRACBITS;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
heightmask = dc_texheight << FRACBITS;
if (frac < 0)
{
@@ -535,25 +499,13 @@ void R_DrawTranslucentColumn_8(void)
register const UINT8 *source = dc_source;
register const UINT8 *transmap = dc_transmap;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight - 1;
register INT32 heightmask = dc_sourcelength - 1;
npow2min = -1;
npow2max = dc_sourcelength;
if (dc_texheight & heightmask)
if (dc_sourcelength & heightmask)
{
heightmask++;
heightmask <<= FRACBITS;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
heightmask = dc_texheight << FRACBITS;
if (frac < 0)
{
@@ -653,25 +605,13 @@ void R_DrawTranslatedTranslucentColumn_8(void)
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
register INT32 heightmask = dc_texheight - 1;
register INT32 heightmask = dc_sourcelength - 1;
npow2min = -1;
npow2max = dc_sourcelength;
if (dc_texheight & heightmask)
if (dc_sourcelength & heightmask)
{
heightmask++;
heightmask <<= FRACBITS;
if (dc_sourcelength <= 0)
{
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
// This is to just render it effectively the identity function.
npow2min = INT32_MIN;
npow2max = INT32_MAX;
}
else
{
npow2min = -1;
npow2max = dc_sourcelength;
}
heightmask = dc_texheight << FRACBITS;
if (frac < 0)
{
+1
View File
@@ -654,6 +654,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
dc_texturemid = skytexturemid;
dc_texheight = textureheight[skytexture] >>FRACBITS;
dc_sourcelength = dc_texheight;
for (x = pl->minx; x <= pl->maxx; x++)
{
+4 -4
View File
@@ -276,7 +276,7 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
if (dc_yl <= dc_yh && dc_yh < vid.height && dc_yh > 0)
{
dc_source = (UINT8 *)column + 3;
dc_sourcelength = 0;
dc_sourcelength = column2s_length;
if (colfunc == wallcolfunc)
twosmultipatchfunc();
@@ -1449,7 +1449,7 @@ static void R_RenderSegLoop (void)
dc_texturemid = rw_midtexturemid;
dc_source = R_GetColumn(midtexture,texturecolumn);
dc_texheight = textureheight[midtexture]>>FRACBITS;
dc_sourcelength = 0;
dc_sourcelength = dc_texheight;
colfunc();
// dont draw anything more for this column, since
@@ -1497,7 +1497,7 @@ static void R_RenderSegLoop (void)
dc_texturemid = rw_toptexturemid;
dc_source = R_GetColumn(toptexture,texturecolumn);
dc_texheight = textureheight[toptexture]>>FRACBITS;
dc_sourcelength = 0;
dc_sourcelength = dc_texheight;
colfunc();
ceilingclip[rw_x] = (INT16)mid;
}
@@ -1535,7 +1535,7 @@ static void R_RenderSegLoop (void)
dc_source = R_GetColumn(bottomtexture,
texturecolumn);
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
dc_sourcelength = 0;
dc_sourcelength = dc_texheight;
colfunc();
floorclip[rw_x] = (INT16)mid;
}