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 win=0, edge=0, hvwind=0, lflags;
|
||||||
int maxw, maxcells;
|
int maxw, maxcells;
|
||||||
|
|
||||||
est->rendstatus &= ~(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);
|
|
||||||
est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO);
|
est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO);
|
||||||
|
|
||||||
if (pvid->reg[12]&1) {
|
if (pvid->reg[12]&1) {
|
||||||
|
@ -1713,6 +1712,7 @@ PICO_INTERNAL void PicoFrameStart(void)
|
||||||
{
|
{
|
||||||
int offs = 8, lines = 224;
|
int offs = 8, lines = 224;
|
||||||
int dirty = ((Pico.est.rendstatus & PDRAW_SONIC_MODE) || Pico.m.dirtyPal);
|
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
|
// prepare to do this frame
|
||||||
Pico.est.rendstatus = 0;
|
Pico.est.rendstatus = 0;
|
||||||
|
@ -1732,6 +1732,8 @@ PICO_INTERNAL void PicoFrameStart(void)
|
||||||
lines, (Pico.video.reg[12] & 1) ? 0 : 1);
|
lines, (Pico.video.reg[12] & 1) ? 0 : 1);
|
||||||
rendstatus_old = Pico.est.rendstatus;
|
rendstatus_old = Pico.est.rendstatus;
|
||||||
}
|
}
|
||||||
|
if (sprep)
|
||||||
|
Pico.est.rendstatus |= PDRAW_PARSE_SPRITES;
|
||||||
|
|
||||||
Pico.est.HighCol = HighColBase + offs * HighColIncrement;
|
Pico.est.HighCol = HighColBase + offs * HighColIncrement;
|
||||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
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)
|
void PicoDrawSync(int to, int blank_last_line)
|
||||||
{
|
{
|
||||||
|
struct PicoEState *est = &Pico.est;
|
||||||
int line, offs = 0;
|
int line, offs = 0;
|
||||||
int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?
|
int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?
|
||||||
int bgc = Pico.video.reg[7];
|
int bgc = Pico.video.reg[7];
|
||||||
|
@ -1815,10 +1818,11 @@ void PicoDrawSync(int to, int blank_last_line)
|
||||||
if (to > 223)
|
if (to > 223)
|
||||||
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);
|
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);
|
PicoLine(line, offs, sh, bgc);
|
||||||
|
|
||||||
// last line
|
// last line
|
||||||
|
@ -1829,7 +1833,7 @@ void PicoDrawSync(int to, int blank_last_line)
|
||||||
else PicoLine(line, offs, sh, bgc);
|
else PicoLine(line, offs, sh, bgc);
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
Pico.est.DrawScanline = line;
|
est->DrawScanline = line;
|
||||||
|
|
||||||
pprof_end(draw);
|
pprof_end(draw);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
.equ PDRAW_SPRITES_MOVED, (1<<0)
|
.equ PDRAW_SPRITES_MOVED, (1<<0)
|
||||||
.equ PDRAW_WND_DIFF_PRIO, (1<<1)
|
.equ PDRAW_WND_DIFF_PRIO, (1<<1)
|
||||||
.equ PDRAW_ACC_SPRITES, (1<<2)
|
.equ PDRAW_PARSE_SPRITES, (1<<2)
|
||||||
.equ PDRAW_DIRTY_SPRITES, (1<<4)
|
.equ PDRAW_DIRTY_SPRITES, (1<<4)
|
||||||
.equ PDRAW_PLANE_HI_PRIO, (1<<6)
|
.equ PDRAW_PLANE_HI_PRIO, (1<<6)
|
||||||
.equ PDRAW_SHHI_DONE, (1<<7)
|
.equ PDRAW_SHHI_DONE, (1<<7)
|
||||||
|
|
|
@ -196,10 +196,11 @@ void vidConvCpyRGB565(void *to, void *from, int pixels);
|
||||||
#endif
|
#endif
|
||||||
void PicoDoHighPal555(int sh, int line, struct PicoEState *est);
|
void PicoDoHighPal555(int sh, int line, struct PicoEState *est);
|
||||||
// internals
|
// internals
|
||||||
#define PDRAW_SPRITES_MOVED (1<<0) // (asm)
|
#define PDRAW_SPRITES_MOVED (1<<0) // SAT address modified
|
||||||
#define PDRAW_WND_DIFF_PRIO (1<<1) // not all window tiles use same priority
|
#define PDRAW_WND_DIFF_PRIO (1<<1) // not all window tiles use same priority
|
||||||
|
#define PDRAW_PARSE_SPRITES (1<<2) // SAT needs parsing
|
||||||
#define PDRAW_INTERLACE (1<<3)
|
#define PDRAW_INTERLACE (1<<3)
|
||||||
#define PDRAW_DIRTY_SPRITES (1<<4) // (asm)
|
#define PDRAW_DIRTY_SPRITES (1<<4) // SAT modified
|
||||||
#define PDRAW_SONIC_MODE (1<<5) // mid-frame palette changes for 8bit renderer
|
#define PDRAW_SONIC_MODE (1<<5) // mid-frame palette changes for 8bit renderer
|
||||||
#define PDRAW_PLANE_HI_PRIO (1<<6) // have layer with all hi prio tiles (mk3)
|
#define PDRAW_PLANE_HI_PRIO (1<<6) // have layer with all hi prio tiles (mk3)
|
||||||
#define PDRAW_SHHI_DONE (1<<7) // layer sh/hi already processed
|
#define PDRAW_SHHI_DONE (1<<7) // layer sh/hi already processed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue