From: kub Date: Wed, 13 Jan 2021 22:27:11 +0000 (+0100) Subject: 32x renderer, fix for render buffers with pitch != line width, some speedup X-Git-Tag: v2.00~620 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa97a0a01fa2bc49497b745cc91a7cfb61264550;p=picodrive.git 32x renderer, fix for render buffers with pitch != line width, some speedup --- diff --git a/pico/32x/draw.c b/pico/32x/draw.c index 3ca858d6..915748c5 100644 --- a/pico/32x/draw.c +++ b/pico/32x/draw.c @@ -179,6 +179,7 @@ static void do_loop_dc##name(unsigned short *dst, \ p32x = dram + dram[l]; \ do_line_dc(dst, p32x, pmd, inv_bit, md_code); \ post_code; \ + dst += DrawLineDestIncrement32x/2 - 320; \ } \ } \ \ @@ -200,6 +201,7 @@ static void do_loop_pp##name(unsigned short *dst, \ p32x += (lines_sft_offs >> 8) & 1; \ do_line_pp(dst, p32x, pmd, md_code); \ post_code; \ + dst += DrawLineDestIncrement32x/2 - 320; \ } \ } \ \ @@ -220,6 +222,7 @@ static void do_loop_rl##name(unsigned short *dst, \ p32x = dram + dram[l]; \ do_line_rl(dst, p32x, pmd, md_code); \ post_code; \ + dst += DrawLineDestIncrement32x/2 - 320; \ } \ } @@ -337,7 +340,7 @@ void PicoDrawSetOutFormat32x(pdso_t which, int use_32x_line_mode) if (which == PDF_RGB555) { // need CLUT pixels in PicoDraw2FB for layer transparency PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328); - PicoDrawSetOutBufMD(DrawLineDestBase32x, DrawLineDestIncrement32x); + PicoDrawSetOutBufMD(NULL, 0); } else { // use the same layout as alt renderer PicoDrawSetInternalBuf(NULL, 0); diff --git a/pico/draw.c b/pico/draw.c index 3f397963..deb23f9b 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -1635,6 +1635,9 @@ void FinalizeLine555(int sh, int line, struct PicoEState *est) unsigned short *pal=est->HighPal; int len; + if (DrawLineDestIncrement == 0) + return; + PicoDrawUpdateHighPal(); if (Pico.video.reg[12]&1) { @@ -1693,7 +1696,7 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est) len = 256; } - if (DrawLineDestBase == HighColBase) { + if (DrawLineDestIncrement == 0) { if (!sh && (est->rendstatus & PDRAW_SONIC_MODE)) blockcpy_or(pd+8, est->HighCol+8, len, est->SonicPalCount*0x40); } else if (!sh && (est->rendstatus & PDRAW_SONIC_MODE)) { @@ -1980,6 +1983,7 @@ void PicoDrawUpdateHighPal(void) void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode) { PicoDrawSetInternalBuf(NULL, 0); + PicoDrawSetOutBufMD(NULL, 0); PicoDraw2SetOutBuf(NULL); switch (which) { @@ -2009,18 +2013,15 @@ void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode) void PicoDrawSetOutBufMD(void *dest, int increment) { if (FinalizeLine == FinalizeLine8bit && increment >= 328) { - // kludge for no-copy mode + // kludge for no-copy mode, using ALT_RENDERER layout PicoDrawSetInternalBuf(dest, increment); - } - - if (FinalizeLine == NULL) + } else if (FinalizeLine == NULL) { PicoDraw2SetOutBuf(dest); - else if (dest != NULL) { + } else if (dest != NULL) { DrawLineDestBase = dest; DrawLineDestIncrement = increment; Pico.est.DrawLineDest = (char *)DrawLineDestBase + Pico.est.DrawScanline * increment; - } - else { + } else { DrawLineDestBase = DefOutBuff; DrawLineDestIncrement = 0; Pico.est.DrawLineDest = DefOutBuff; diff --git a/pico/mode4.c b/pico/mode4.c index 9e853d47..9cbc1d40 100644 --- a/pico/mode4.c +++ b/pico/mode4.c @@ -366,7 +366,7 @@ static void FinalizeLine8bitM4(int line) { unsigned char *pd = Pico.est.DrawLineDest; - if (HighColBase != DrawLineDestBase) + if (DrawLineDestIncrement) memcpy(pd + line_offset, Pico.est.HighCol + line_offset + 8, 256); }