From 955812bd8d0a1824dc7abb9cd47cddc0a6195653 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 6 Oct 2025 22:09:27 +0200 Subject: [PATCH] template the flush functions --- src/r_draw_column.cpp | 7 +- src/r_draw_flush.cpp | 574 ++++++++++++++---------------------------- 2 files changed, 188 insertions(+), 393 deletions(-) diff --git a/src/r_draw_column.cpp b/src/r_draw_column.cpp index a24318a35..c2275fbd4 100644 --- a/src/r_draw_column.cpp +++ b/src/r_draw_column.cpp @@ -204,11 +204,12 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc) const UINT8 * restrict source = dc->source; const lighttable_t * restrict colormap = dc->colormap; - UINT8 * restrict dest; - // Framebuffer destination address. // SoM: MAGIC - if constexpr ((Type & (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP)) == (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP)) + UINT8 * restrict dest; + + if constexpr ((Type & (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP)) + == (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP)) dest = R_GetBufferColormapTrans(dc); else if constexpr (Type & DrawColumnType::DC_TRANSMAP) dest = R_GetBufferTrans(dc); diff --git a/src/r_draw_flush.cpp b/src/r_draw_flush.cpp index b1bbb464f..23fd4beb3 100644 --- a/src/r_draw_flush.cpp +++ b/src/r_draw_flush.cpp @@ -19,10 +19,11 @@ // Flushes the entire columns in the buffer, one at a time. // This is used when a quad flush isn't possible. // -static void R_FlushWholeOpaque(void) +template +static void R_FlushWhole(void) { - UINT8 *source; - UINT8 *dest; + UINT8 * restrict source; + UINT8 * restrict dest; INT32 count, yl; const restrict INT32 stride = vid.width; @@ -35,81 +36,40 @@ static void R_FlushWholeOpaque(void) while (--count >= 0) { - *dest = *source; + if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE) + { + *dest = *source; + } + else if constexpr (Type & ColumnFlushType::FLUSH_TRANS) + { + *dest = temp_dc.tranmap[(*dest << 8) + *source]; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP) + { + *dest = temp_dc.translation[*source]; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP_TRANS) + { + *dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]]; + } + source += 4; dest += stride; } } } -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; - } +#define DEFINE_GETFLUSHWHOLE_FUNC(name, flags) \ + static inline void name(void) \ + { \ + constexpr ColumnFlushType opt = static_cast(flags); \ + R_FlushWhole(); \ } -} -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; - } - } -} +DEFINE_GETFLUSHWHOLE_FUNC(R_FlushWholeOpague, FLUSH_OPAQUE) +DEFINE_GETFLUSHWHOLE_FUNC(R_FlushWholeTrans, FLUSH_TRANS) +DEFINE_GETFLUSHWHOLE_FUNC(R_FlushWholeColormap, FLUSH_COLORMAP) +DEFINE_GETFLUSHWHOLE_FUNC(R_FlushWholeColormapTrans, FLUSH_COLORMAP_TRANS) // // R_FlushHT @@ -117,56 +77,11 @@ static void R_FlushWholeColormapTrans(void) // Flushes the head and tail of columns in the buffer in // preparation for a quad flush. // -static void R_FlushHTOpaque(void) +template +static void R_FlushHT(void) { - UINT8 *source; - UINT8 *dest; - INT32 count, colnum = 0; - INT32 yl, yh; - const restrict INT32 stride = vid.width; - - while (colnum < 4) - { - yl = temp_dc.yl[colnum]; - yh = temp_dc.yh[colnum]; - - // flush column head - if (yl < temp_dc.commontop) - { - source = &temp_dc.buf[colnum + (yl << 2)]; - dest = R_Address(temp_dc.startx + colnum, yl); - count = temp_dc.commontop - yl; - - while (--count >= 0) - { - *dest = *source; - source += 4; - dest += stride; - } - } - - // flush column tail - if (yh > temp_dc.commonbot) - { - source = &temp_dc.buf[colnum + ((temp_dc.commonbot + 1) << 2)]; - dest = R_Address(temp_dc.startx + colnum, temp_dc.commonbot + 1); - count = yh - temp_dc.commonbot; - - while (--count >= 0) - { - *dest = *source; - source += 4; - dest += stride; - } - } - ++colnum; - } -} - -static void R_FlushHTTrans(void) -{ - UINT8 *source; - UINT8 *dest; + UINT8 * restrict source; + UINT8 * restrict dest; INT32 count; INT32 colnum = 0, yl, yh; const restrict INT32 stride = vid.width; @@ -185,7 +100,23 @@ static void R_FlushHTTrans(void) while (--count >= 0) { - *dest = temp_dc.tranmap[(*dest << 8) + *source]; + if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE) + { + *dest = *source; + } + else if constexpr (Type & ColumnFlushType::FLUSH_TRANS) + { + *dest = temp_dc.tranmap[(*dest << 8) + *source]; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP) + { + *dest = temp_dc.translation[*source]; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP_TRANS) + { + *dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]]; + } + source += 4; dest += stride; } @@ -200,7 +131,23 @@ static void R_FlushHTTrans(void) while (--count >= 0) { - *dest = temp_dc.tranmap[(*dest << 8) + *source]; + if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE) + { + *dest = *source; + } + else if constexpr (Type & ColumnFlushType::FLUSH_TRANS) + { + *dest = temp_dc.tranmap[(*dest << 8) + *source]; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP) + { + *dest = temp_dc.translation[*source]; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP_TRANS) + { + *dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]]; + } + source += 4; dest += stride; } @@ -210,206 +157,107 @@ static void R_FlushHTTrans(void) } } -static void R_FlushHTColormap(void) -{ - UINT8 *source; - UINT8 *dest; - INT32 count; - INT32 colnum = 0, yl, yh; - const restrict INT32 stride = vid.width; - - while (colnum < 4) - { - yl = temp_dc.yl[colnum]; - yh = temp_dc.yh[colnum]; - - // flush column head - if (yl < temp_dc.commontop) - { - source = &temp_dc.buf[colnum + (yl << 2)]; - dest = R_Address(temp_dc.startx + colnum, yl); - count = temp_dc.commontop - yl; - - while (--count >= 0) - { - *dest = temp_dc.translation[*source]; - source += 4; - dest += stride; - } - } - - // flush column tail - if (yh > temp_dc.commonbot) - { - source = &temp_dc.buf[colnum + ((temp_dc.commonbot + 1) << 2)]; - dest = R_Address(temp_dc.startx + colnum, temp_dc.commonbot + 1); - count = yh - temp_dc.commonbot; - - while (--count >= 0) - { - *dest = temp_dc.translation[*source]; - source += 4; - dest += stride; - } - } - - ++colnum; +#define DEFINE_GETFLUSHHT_FUNC(name, flags) \ + static inline void name(void) \ + { \ + constexpr ColumnFlushType opt = static_cast(flags); \ + R_FlushHT(); \ } -} -static void R_FlushHTColormapTrans(void) +DEFINE_GETFLUSHHT_FUNC(R_FlushHTOpague, FLUSH_OPAQUE) +DEFINE_GETFLUSHHT_FUNC(R_FlushHTTrans, FLUSH_TRANS) +DEFINE_GETFLUSHHT_FUNC(R_FlushHTColormap, FLUSH_COLORMAP) +DEFINE_GETFLUSHHT_FUNC(R_FlushHTColormapTrans, FLUSH_COLORMAP_TRANS) + +template +static void R_FlushQuad(void) { - UINT8 *source; - UINT8 *dest; - INT32 count; - INT32 colnum = 0, yl, yh; - const restrict INT32 stride = vid.width; - - while (colnum < 4) - { - yl = temp_dc.yl[colnum]; - yh = temp_dc.yh[colnum]; - - // flush column head - if (yl < temp_dc.commontop) - { - source = &temp_dc.buf[colnum + (yl << 2)]; - dest = R_Address(temp_dc.startx + colnum, yl); - count = temp_dc.commontop - yl; - - while (--count >= 0) - { - *dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]]; - source += 4; - dest += stride; - } - } - - // flush column tail - if (yh > temp_dc.commonbot) - { - source = &temp_dc.buf[colnum + ((temp_dc.commonbot + 1) << 2)]; - dest = R_Address(temp_dc.startx + colnum, temp_dc.commonbot + 1); - count = yh - temp_dc.commonbot; - - while (--count >= 0) - { - *dest = temp_dc.tranmap[(*dest << 8) + temp_dc.translation[*source]]; - source += 4; - dest += stride; - } - } - - ++colnum; - } -} - -static void R_FlushQuadOpaque(void) -{ - UINT8 *source = &temp_dc.buf[temp_dc.commontop << 2]; - UINT8 *dest = R_Address(temp_dc.startx, temp_dc.commontop); + UINT8 * restrict source = &temp_dc.buf[temp_dc.commontop << 2]; + UINT8 * restrict 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)) + if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE) { - while(--count >= 0) + if ((sizeof(int) == 4) && (((intptr_t)source % 4) == 0) && (((intptr_t)dest % 4) == 0)) { - *(int *)dest = *(int *)source; - source += 4 * sizeof(UINT8); - dest += stride * sizeof(UINT8); + 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); + } } } - else + else if constexpr (Type & ColumnFlushType::FLUSH_TRANS) { - while(--count >= 0) + 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); + 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; } } - - while(--count >= 0) + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP) { - 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] = 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; + } + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP_TRANS) + { + while (--count >= 0) + { + dest[0] = temp_dc.tranmap[(dest[0] << 8) + temp_dc.translation[source[0]]]; + dest[1] = temp_dc.tranmap[(dest[1] << 8) + temp_dc.translation[source[1]]]; + dest[2] = temp_dc.tranmap[(dest[2] << 8) + temp_dc.translation[source[2]]]; + dest[3] = temp_dc.tranmap[(dest[3] << 8) + temp_dc.translation[source[3]]]; + source += 4; + dest += stride; + } } } -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; +#define DEFINE_GETFLUSHQUAD_FUNC(name, flags) \ + static inline void name(void) \ + { \ + constexpr ColumnFlushType opt = static_cast(flags); \ + R_FlushQuad(); \ } -} -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; +DEFINE_GETFLUSHQUAD_FUNC(R_FlushQuadOpague, FLUSH_OPAQUE) +DEFINE_GETFLUSHQUAD_FUNC(R_FlushQuadTrans, FLUSH_TRANS) +DEFINE_GETFLUSHQUAD_FUNC(R_FlushQuadColormap, FLUSH_COLORMAP) +DEFINE_GETFLUSHQUAD_FUNC(R_FlushQuadColormapTrans, FLUSH_COLORMAP_TRANS) - 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]; - 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) + temp_dc.translation[source[0]]]; - dest[1] = temp_dc.tranmap[(dest[1] << 8) + temp_dc.translation[source[1]]]; - dest[2] = temp_dc.tranmap[(dest[2] << 8) + temp_dc.translation[source[2]]]; - dest[3] = temp_dc.tranmap[(dest[3] << 8) + temp_dc.translation[source[3]]]; - source += 4; - dest += stride; - } -} - -static UINT8 *R_GetBufferOpaque(drawcolumndata_t *dc) +template +static UINT8 *R_GetBuffer(drawcolumndata_t *dc) { if (temp_dc.x == 4 || - (temp_dc.x && (temp_dc.type != FLUSH_OPAQUE || temp_dc.x + temp_dc.startx != dc->x))) + (temp_dc.x && (temp_dc.type != Type || temp_dc.x + temp_dc.startx != dc->x))) R_FlushColumns(); if (!temp_dc.x) @@ -417,10 +265,37 @@ static UINT8 *R_GetBufferOpaque(drawcolumndata_t *dc) temp_dc.startx = dc->x; temp_dc.yl[0] = temp_dc.commontop = dc->yl; temp_dc.yh[0] = temp_dc.commonbot = dc->yh; - temp_dc.type = FLUSH_OPAQUE; - R_FlushWholeColumns = R_FlushWholeOpaque; - R_FlushHTColumns = R_FlushHTOpaque; - R_FlushQuadColumn = R_FlushQuadOpaque; + temp_dc.type = Type; + + if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE) + { + R_FlushWholeColumns = R_FlushWholeOpague; + R_FlushHTColumns = R_FlushHTOpague; + R_FlushQuadColumn = R_FlushQuadOpague; + } + else if constexpr (Type & ColumnFlushType::FLUSH_TRANS) + { + temp_dc.tranmap = dc->transmap; + R_FlushWholeColumns = R_FlushWholeTrans; + R_FlushHTColumns = R_FlushHTTrans; + R_FlushQuadColumn = R_FlushQuadTrans; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP) + { + temp_dc.translation = dc->translation; + R_FlushWholeColumns = R_FlushWholeColormap; + R_FlushHTColumns = R_FlushHTColormap; + R_FlushQuadColumn = R_FlushQuadColormap; + } + else if constexpr (Type & ColumnFlushType::FLUSH_COLORMAP_TRANS) + { + temp_dc.tranmap = dc->transmap; + temp_dc.translation = dc->translation; + R_FlushWholeColumns = R_FlushWholeColormapTrans; + R_FlushHTColumns = R_FlushHTColormapTrans; + R_FlushQuadColumn = R_FlushQuadColormapTrans; + } + temp_dc.x += 1; return &temp_dc.buf[dc->yl << 2]; } @@ -436,96 +311,15 @@ static UINT8 *R_GetBufferOpaque(drawcolumndata_t *dc) return &temp_dc.buf[(dc->yl << 2) + temp_dc.x++]; } -static UINT8 *R_GetBufferTrans(drawcolumndata_t *dc) -{ - if (temp_dc.x == 4 || - (temp_dc.x && (temp_dc.type != FLUSH_TRANS || temp_dc.x + temp_dc.startx != dc->x))) - R_FlushColumns(); - - if (!temp_dc.x) - { - temp_dc.startx = dc->x; - temp_dc.yl[0] = temp_dc.commontop = dc->yl; - temp_dc.yh[0] = temp_dc.commonbot = dc->yh; - temp_dc.type = FLUSH_TRANS; - temp_dc.tranmap = dc->transmap; - R_FlushWholeColumns = R_FlushWholeTrans; - R_FlushHTColumns = R_FlushHTTrans; - R_FlushQuadColumn = R_FlushQuadTrans; - temp_dc.x += 1; - return &temp_dc.buf[dc->yl << 2]; +#define DEFINE_GETBUF_FUNC(name, flags) \ + static UINT8 *name(drawcolumndata_t *dc) \ + { \ + constexpr ColumnFlushType opt = static_cast(flags); \ + return R_GetBuffer(dc); \ } - temp_dc.yl[temp_dc.x] = dc->yl; - temp_dc.yh[temp_dc.x] = dc->yh; +DEFINE_GETBUF_FUNC(R_GetBufferOpaque, FLUSH_OPAQUE) +DEFINE_GETBUF_FUNC(R_GetBufferTrans, FLUSH_TRANS) +DEFINE_GETBUF_FUNC(R_GetBufferColormap, FLUSH_COLORMAP) +DEFINE_GETBUF_FUNC(R_GetBufferColormapTrans, FLUSH_COLORMAP_TRANS) - if (dc->yl > temp_dc.commontop) - temp_dc.commontop = dc->yl; - if (dc->yh < temp_dc.commonbot) - temp_dc.commonbot = dc->yh; - - return &temp_dc.buf[(dc->yl << 2) + temp_dc.x++]; -} - -static UINT8 *R_GetBufferColormap(drawcolumndata_t *dc) -{ - if (temp_dc.x == 4 || - (temp_dc.x && (temp_dc.type != FLUSH_COLORMAP || temp_dc.x + temp_dc.startx != dc->x))) - R_FlushColumns(); - - if (!temp_dc.x) - { - temp_dc.startx = dc->x; - temp_dc.yl[0] = temp_dc.commontop = dc->yl; - temp_dc.yh[0] = temp_dc.commonbot = dc->yh; - temp_dc.type = FLUSH_COLORMAP; - temp_dc.translation = dc->translation; - R_FlushWholeColumns = R_FlushWholeColormap; - R_FlushHTColumns = R_FlushHTColormap; - R_FlushQuadColumn = R_FlushQuadColormap; - temp_dc.x += 1; - return &temp_dc.buf[dc->yl << 2]; - } - - temp_dc.yl[temp_dc.x] = dc->yl; - temp_dc.yh[temp_dc.x] = dc->yh; - - if (dc->yl > temp_dc.commontop) - temp_dc.commontop = dc->yl; - if (dc->yh < temp_dc.commonbot) - temp_dc.commonbot = dc->yh; - - return &temp_dc.buf[(dc->yl << 2) + temp_dc.x++]; -} - -static UINT8 *R_GetBufferColormapTrans(drawcolumndata_t *dc) -{ - if (temp_dc.x == 4 || - (temp_dc.x && (temp_dc.type != FLUSH_COLORMAP_TRANS || temp_dc.x + temp_dc.startx != dc->x))) - R_FlushColumns(); - - if (!temp_dc.x) - { - temp_dc.startx = dc->x; - temp_dc.yl[0] = temp_dc.commontop = dc->yl; - temp_dc.yh[0] = temp_dc.commonbot = dc->yh; - temp_dc.type = FLUSH_COLORMAP_TRANS; - temp_dc.translation = dc->translation; - temp_dc.tranmap = dc->transmap; - R_FlushWholeColumns = R_FlushWholeColormapTrans; - R_FlushHTColumns = R_FlushHTColormapTrans; - R_FlushQuadColumn = R_FlushQuadColormapTrans; - temp_dc.x += 1; - return &temp_dc.buf[dc->yl << 2]; - } - - temp_dc.yl[temp_dc.x] = dc->yl; - temp_dc.yh[temp_dc.x] = dc->yh; - - if (dc->yl > temp_dc.commontop) - temp_dc.commontop = dc->yl; - if (dc->yh < temp_dc.commonbot) - temp_dc.commonbot = dc->yh; - - return &temp_dc.buf[(dc->yl << 2) + temp_dc.x++]; -}