reorder column flush functions
also add some comments that used to be in drawcolumn X)
This commit is contained in:
1 parent
e68136de3e
commit
3c9292c137
3 files changed
+175
-158
No files matched your search
+11
-2
@@ -516,8 +516,10 @@ typedef struct drawcolumndata_temp_s
|
||||
|
||||
drawcolumndata_temp_t temp_dc = {};
|
||||
|
||||
static void R_FlushColumns(void);
|
||||
|
||||
//
|
||||
// Error functions that will abort if R_FlushColumns tries to flush
|
||||
// columns without a column type.
|
||||
//
|
||||
static void R_FlushWholeError(void)
|
||||
{
|
||||
I_Error("R_FlushWholeColumns called without being initialized.\n");
|
||||
@@ -553,10 +555,17 @@ static void R_FlushColumns(void)
|
||||
//
|
||||
// R_ResetColumnBuffer
|
||||
//
|
||||
// haleyjd 09/13/04: new function to call from main rendering loop
|
||||
// which gets rid of the unnecessary reset of various variables during
|
||||
// column drawing.
|
||||
//
|
||||
void R_ResetColumnBuffer(void)
|
||||
{
|
||||
// haleyjd 10/06/05: this must not be done if x == 0!
|
||||
if (temp_dc.x)
|
||||
{
|
||||
R_FlushColumns();
|
||||
}
|
||||
|
||||
temp_dc.type = FLUSH_NONE;
|
||||
R_FlushWholeColumns = R_FlushWholeError;
|
||||
|
||||
+11
-1
@@ -84,8 +84,18 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
{
|
||||
INT32 count;
|
||||
|
||||
// leban 1/17/99:
|
||||
// removed the + 1 here, adjusted the if test, and added an increment
|
||||
// later. this helps a compiler pipeline a bit better. the x86
|
||||
// assembler also does this.
|
||||
count = dc->yh - dc->yl;
|
||||
|
||||
// leban 1/17/99:
|
||||
// this case isn't executed too often. depending on how many instructions
|
||||
// there are between here and the second if test below, this case could
|
||||
// be moved down and might save instructions overall. since there are
|
||||
// probably different wads that favor one way or the other, i'll leave
|
||||
// this alone for now.
|
||||
if (count < 0) // Zero length, column does not exceed a pixel.
|
||||
{
|
||||
return;
|
||||
@@ -285,7 +295,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
{
|
||||
// Re-map color indices from wall texture column
|
||||
// using a lighting/special effects LUT.
|
||||
// heightmask is the Tutti-Frutti fix
|
||||
// heightmask is the Tutti-Frutti fix -- killough
|
||||
|
||||
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
|
||||
// and a few bytes after as well
|
||||
|
||||
+153
-155
@@ -14,11 +14,10 @@
|
||||
/// \note no includes because this is included as part of r_draw.cpp
|
||||
|
||||
//
|
||||
// R_FlushWholeOpaque
|
||||
// R_FlushWhole
|
||||
//
|
||||
// Flushes the entire columns in the buffer, one at a time.
|
||||
// This is used when a quad flush isn't possible.
|
||||
// Opaque version -- no remapping whatsoever.
|
||||
//
|
||||
static void R_FlushWholeOpaque(void)
|
||||
{
|
||||
@@ -43,12 +42,80 @@ static void R_FlushWholeOpaque(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushWholeTrans(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
UINT8 *dest;
|
||||
INT32 count, yl;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
while (--temp_dc.x >= 0)
|
||||
{
|
||||
yl = temp_dc.yl[temp_dc.x];
|
||||
source = &temp_dc.buf[temp_dc.x + (yl << 2)];
|
||||
dest = R_Address(temp_dc.startx + temp_dc.x, yl);
|
||||
count = temp_dc.yh[temp_dc.x] - yl + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = temp_dc.tranmap[(*dest << 8) + *source];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushWholeColormap(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
UINT8 *dest;
|
||||
INT32 count, yl;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
while (--temp_dc.x >= 0)
|
||||
{
|
||||
yl = temp_dc.yl[temp_dc.x];
|
||||
source = &temp_dc.buf[temp_dc.x + (yl << 2)];
|
||||
dest = R_Address(temp_dc.startx + temp_dc.x, yl);
|
||||
count = temp_dc.yh[temp_dc.x] - yl + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = temp_dc.translation[*source];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushWholeColormapTrans(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
UINT8 *dest;
|
||||
INT32 count, yl;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
while (--temp_dc.x >= 0)
|
||||
{
|
||||
yl = temp_dc.yl[temp_dc.x];
|
||||
source = &temp_dc.buf[temp_dc.x + (yl << 2)];
|
||||
dest = R_Address(temp_dc.startx + temp_dc.x, yl);
|
||||
count = temp_dc.yh[temp_dc.x] - yl + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// R_FlushHTOpaque
|
||||
// R_FlushHT
|
||||
//
|
||||
// Flushes the head and tail of columns in the buffer in
|
||||
// preparation for a quad flush.
|
||||
// Opaque version -- no remapping whatsoever.
|
||||
//
|
||||
static void R_FlushHTOpaque(void)
|
||||
{
|
||||
@@ -96,71 +163,6 @@ static void R_FlushHTOpaque(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadOpaque(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop);
|
||||
INT32 count;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
count = temp_dc.commonbot - temp_dc.commontop + 1;
|
||||
|
||||
if ((sizeof(int) == 4) && (((intptr_t)source % 4) == 0) && (((intptr_t)dest % 4) == 0))
|
||||
{
|
||||
while(--count >= 0)
|
||||
{
|
||||
*(int *)dest = *(int *)source;
|
||||
source += 4 * sizeof(UINT8);
|
||||
dest += stride * sizeof(UINT8);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(--count >= 0)
|
||||
{
|
||||
dest[0] = source[0];
|
||||
dest[1] = source[1];
|
||||
dest[2] = source[2];
|
||||
dest[3] = source[3];
|
||||
source += 4 * sizeof(UINT8);
|
||||
dest += stride * sizeof(UINT8);
|
||||
}
|
||||
}
|
||||
|
||||
while(--count >= 0)
|
||||
{
|
||||
dest[0] = source[0];
|
||||
dest[1] = source[1];
|
||||
dest[2] = source[2];
|
||||
dest[3] = source[3];
|
||||
source += 4 * sizeof(UINT8);
|
||||
dest += stride * sizeof(UINT8);
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushWholeTrans(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
UINT8 *dest;
|
||||
INT32 count, yl;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
while (--temp_dc.x >= 0)
|
||||
{
|
||||
yl = temp_dc.yl[temp_dc.x];
|
||||
source = &temp_dc.buf[temp_dc.x + (yl << 2)];
|
||||
dest = R_Address(temp_dc.startx + temp_dc.x, yl);
|
||||
count = temp_dc.yh[temp_dc.x] - yl + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = temp_dc.tranmap[(*dest << 8) + *source];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushHTTrans(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
@@ -208,49 +210,6 @@ static void R_FlushHTTrans(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadTrans(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop);
|
||||
INT32 count;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
count = temp_dc.commonbot - temp_dc.commontop + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
dest[0] = temp_dc.tranmap[(dest[0] << 8) + source[0]];
|
||||
dest[1] = temp_dc.tranmap[(dest[1] << 8) + source[1]];
|
||||
dest[2] = temp_dc.tranmap[(dest[2] << 8) + source[2]];
|
||||
dest[3] = temp_dc.tranmap[(dest[3] << 8) + source[3]];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushWholeColormap(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
UINT8 *dest;
|
||||
INT32 count, yl;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
while (--temp_dc.x >= 0)
|
||||
{
|
||||
yl = temp_dc.yl[temp_dc.x];
|
||||
source = &temp_dc.buf[temp_dc.x + (yl << 2)];
|
||||
dest = R_Address(temp_dc.startx + temp_dc.x, yl);
|
||||
count = temp_dc.yh[temp_dc.x] - yl + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = temp_dc.translation[*source];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushHTColormap(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
@@ -298,49 +257,6 @@ static void R_FlushHTColormap(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadColormap(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop);
|
||||
INT32 count;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
count = temp_dc.commonbot - temp_dc.commontop + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
dest[0] = temp_dc.translation[source[0]];
|
||||
dest[1] = temp_dc.translation[source[1]];
|
||||
dest[2] = temp_dc.translation[source[2]];
|
||||
dest[3] = temp_dc.translation[source[3]];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushWholeColormapTrans(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
UINT8 *dest;
|
||||
INT32 count, yl;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
while (--temp_dc.x >= 0)
|
||||
{
|
||||
yl = temp_dc.yl[temp_dc.x];
|
||||
source = &temp_dc.buf[temp_dc.x + (yl << 2)];
|
||||
dest = R_Address(temp_dc.startx + temp_dc.x, yl);
|
||||
count = temp_dc.yh[temp_dc.x] - yl + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushHTColormapTrans(void)
|
||||
{
|
||||
UINT8 *source;
|
||||
@@ -388,6 +304,88 @@ static void R_FlushHTColormapTrans(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadOpaque(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop);
|
||||
INT32 count;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
count = temp_dc.commonbot - temp_dc.commontop + 1;
|
||||
|
||||
if ((sizeof(int) == 4) && (((intptr_t)source % 4) == 0) && (((intptr_t)dest % 4) == 0))
|
||||
{
|
||||
while(--count >= 0)
|
||||
{
|
||||
*(int *)dest = *(int *)source;
|
||||
source += 4 * sizeof(UINT8);
|
||||
dest += stride * sizeof(UINT8);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(--count >= 0)
|
||||
{
|
||||
dest[0] = source[0];
|
||||
dest[1] = source[1];
|
||||
dest[2] = source[2];
|
||||
dest[3] = source[3];
|
||||
source += 4 * sizeof(UINT8);
|
||||
dest += stride * sizeof(UINT8);
|
||||
}
|
||||
}
|
||||
|
||||
while(--count >= 0)
|
||||
{
|
||||
dest[0] = source[0];
|
||||
dest[1] = source[1];
|
||||
dest[2] = source[2];
|
||||
dest[3] = source[3];
|
||||
source += 4 * sizeof(UINT8);
|
||||
dest += stride * sizeof(UINT8);
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadTrans(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop);
|
||||
INT32 count;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
count = temp_dc.commonbot - temp_dc.commontop + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
dest[0] = temp_dc.tranmap[(dest[0] << 8) + source[0]];
|
||||
dest[1] = temp_dc.tranmap[(dest[1] << 8) + source[1]];
|
||||
dest[2] = temp_dc.tranmap[(dest[2] << 8) + source[2]];
|
||||
dest[3] = temp_dc.tranmap[(dest[3] << 8) + source[3]];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadColormap(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop);
|
||||
INT32 count;
|
||||
const restrict INT32 stride = vid.width;
|
||||
|
||||
count = temp_dc.commonbot - temp_dc.commontop + 1;
|
||||
|
||||
while (--count >= 0)
|
||||
{
|
||||
dest[0] = temp_dc.translation[source[0]];
|
||||
dest[1] = temp_dc.translation[source[1]];
|
||||
dest[2] = temp_dc.translation[source[2]];
|
||||
dest[3] = temp_dc.translation[source[3]];
|
||||
source += 4;
|
||||
dest += stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_FlushQuadColormapTrans(void)
|
||||
{
|
||||
UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2];
|
||||
|
||||
Reference in new issue
Block a user