fix(ppu): Discard SCX mod 8 pixels from fifo

As of right now, the implementation of this is rudimentary. There are
currently some visual bugs that still need to get worked out
This commit is contained in:
Rekai Nyangadzayi Musuka 2021-06-12 13:41:51 -05:00
parent daeb02f7c9
commit 8149352e63
1 changed files with 9 additions and 0 deletions

View File

@ -381,6 +381,15 @@ impl Ppu {
if self.fifo.is_enabled() { if self.fifo.is_enabled() {
use RenderPriority::*; use RenderPriority::*;
if self.x_pos == 0 {
// Start of a Scanline
let discarded_count = self.pos.scroll_x % 8;
for _ in 0..discarded_count {
let _ = self.fifo.back.pop_back();
}
}
// Handle Background Pixel and Sprite FIFO // Handle Background Pixel and Sprite FIFO
let bg_enabled = self.ctrl.bg_win_enabled(); let bg_enabled = self.ctrl.bg_win_enabled();
let obj_enabled = self.ctrl.obj_enabled(); let obj_enabled = self.ctrl.obj_enabled();