taylus/gbdotnet

PPU: Improve sprite rendering performance

taylus opened this issue · 0 comments

Performance when calling PPU.RenderSprites() is OK, but that's just for debugging. When sprites are drawn in PPU.RenderScanline() it slows things down drastically because all 40 sprites are checked every scanline. Need to optimize this:

Sprites disabled (by the ROM clearing LCDC bit 1)
sprites_disabled

Forcing sprite display on (in the emulator code)

if (/*Registers.LCDControl.SpriteDisplayEnabled*/true)
{
    DrawSpritesOntoScanline(x);
}

sprites_force_enabled