taylus / gbdotnet

An incomplete Game Boy emulator written in .NET Core
4 stars 0 forks source link

PPU: Improve sprite rendering performance #25

Closed taylus closed 4 years ago

taylus commented 4 years ago

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