From 207e5ba0ee33cb452d7d46483528abf304e0568f Mon Sep 17 00:00:00 2001 From: kub Date: Sat, 12 Dec 2020 14:36:54 +0100 Subject: [PATCH] vdp, add handling of external buffers for fast renderer --- pico/draw.c | 12 +++++++----- pico/draw2.c | 10 +++++++++- pico/pico_int.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pico/draw.c b/pico/draw.c index e8a4723b..6318713f 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -1855,9 +1855,6 @@ PICO_INTERNAL void PicoFrameStart(void) Pico.m.dirtyPal = (dirty ? 2 : 0); // mark as dirty but already copied blockcpy(Pico.est.SonicPal, PicoMem.cram, 0x40*2); } - - if (PicoIn.opt & POPT_ALT_RENDERER) - return; } static void DrawBlankedLine(int line, int offs, int sh, int bgc) @@ -1974,10 +1971,12 @@ void PicoDrawUpdateHighPal(void) void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode) { PicoDrawSetInternalBuf(NULL, 0); + PicoDraw2SetOutBuf(NULL); switch (which) { case PDF_8BIT: FinalizeLine = FinalizeLine8bit; + PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328); break; case PDF_RGB555: @@ -1989,13 +1988,13 @@ void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode) default: FinalizeLine = NULL; - PicoDrawSetOutBufMD(Pico.est.Draw2FB+8, 328); break; } if (PicoIn.AHW & PAHW_32X) PicoDrawSetOutFormat32x(which, use_32x_line_mode); PicoDrawSetOutputMode4(which); rendstatus_old = -1; + Pico.m.dirtyPal = 1; } void PicoDrawSetOutBufMD(void *dest, int increment) @@ -2004,7 +2003,10 @@ void PicoDrawSetOutBufMD(void *dest, int increment) // kludge for no-copy mode PicoDrawSetInternalBuf(dest, increment); } - if (dest != NULL) { + + if (FinalizeLine == NULL) + PicoDraw2SetOutBuf(dest); + else if (dest != NULL) { DrawLineDestBase = dest; DrawLineDestIncrement = increment; Pico.est.DrawLineDest = (char *)DrawLineDestBase + Pico.est.DrawScanline * increment; diff --git a/pico/draw2.c b/pico/draw2.c index e2549526..ec1a12c7 100644 --- a/pico/draw2.c +++ b/pico/draw2.c @@ -692,7 +692,15 @@ PICO_INTERNAL void PicoFrameFull() pprof_end(draw); } +void PicoDraw2SetOutBuf(void *dest) +{ + if (dest) + Pico.est.Draw2FB = dest; + else + Pico.est.Draw2FB = PicoDraw2FB_; +} + void PicoDraw2Init(void) { - Pico.est.Draw2FB = PicoDraw2FB_; + PicoDraw2SetOutBuf(NULL); } diff --git a/pico/pico_int.h b/pico/pico_int.h index 1a2e408d..ae9f2e11 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -674,6 +674,7 @@ extern int DrawLineDestIncrement; extern unsigned int VdpSATCache[128]; // draw2.c +void PicoDraw2SetOutBuf(void *dest); void PicoDraw2Init(void); PICO_INTERNAL void PicoFrameFull(); -- 2.39.5