mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
vdp rendering, sprite caching optimization
This commit is contained in:
parent
e8204ab27b
commit
b061bc166c
3 changed files with 12 additions and 7 deletions
12
pico/draw.c
12
pico/draw.c
|
@ -1601,7 +1601,6 @@ static int DrawDisplay(int sh)
|
|||
int win=0, edge=0, hvwind=0, lflags;
|
||||
int maxw, maxcells;
|
||||
|
||||
est->rendstatus &= ~(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);
|
||||
est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO);
|
||||
|
||||
if (pvid->reg[12]&1) {
|
||||
|
@ -1713,6 +1712,7 @@ PICO_INTERNAL void PicoFrameStart(void)
|
|||
{
|
||||
int offs = 8, lines = 224;
|
||||
int dirty = ((Pico.est.rendstatus & PDRAW_SONIC_MODE) || Pico.m.dirtyPal);
|
||||
int sprep = Pico.est.rendstatus & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);
|
||||
|
||||
// prepare to do this frame
|
||||
Pico.est.rendstatus = 0;
|
||||
|
@ -1732,6 +1732,8 @@ PICO_INTERNAL void PicoFrameStart(void)
|
|||
lines, (Pico.video.reg[12] & 1) ? 0 : 1);
|
||||
rendstatus_old = Pico.est.rendstatus;
|
||||
}
|
||||
if (sprep)
|
||||
Pico.est.rendstatus |= PDRAW_PARSE_SPRITES;
|
||||
|
||||
Pico.est.HighCol = HighColBase + offs * HighColIncrement;
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||
|
@ -1804,6 +1806,7 @@ static void PicoLine(int line, int offs, int sh, int bgc)
|
|||
|
||||
void PicoDrawSync(int to, int blank_last_line)
|
||||
{
|
||||
struct PicoEState *est = &Pico.est;
|
||||
int line, offs = 0;
|
||||
int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?
|
||||
int bgc = Pico.video.reg[7];
|
||||
|
@ -1815,10 +1818,11 @@ void PicoDrawSync(int to, int blank_last_line)
|
|||
if (to > 223)
|
||||
to = 223;
|
||||
}
|
||||
if (Pico.est.DrawScanline <= to - blank_last_line)
|
||||
if (est->DrawScanline <= to - blank_last_line && (est->rendstatus &
|
||||
(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES|PDRAW_PARSE_SPRITES)))
|
||||
PrepareSprites(to - blank_last_line + 1);
|
||||
|
||||
for (line = Pico.est.DrawScanline; line < to; line++)
|
||||
for (line = est->DrawScanline; line < to; line++)
|
||||
PicoLine(line, offs, sh, bgc);
|
||||
|
||||
// last line
|
||||
|
@ -1829,7 +1833,7 @@ void PicoDrawSync(int to, int blank_last_line)
|
|||
else PicoLine(line, offs, sh, bgc);
|
||||
line++;
|
||||
}
|
||||
Pico.est.DrawScanline = line;
|
||||
est->DrawScanline = line;
|
||||
|
||||
pprof_end(draw);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue