chore(ppu): rename PixelFetcher properties

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-05-08 15:13:26 -05:00
parent 5917ca203f
commit 705194eced
1 changed files with 25 additions and 23 deletions

View File

@ -259,7 +259,7 @@ impl Ppu {
ObjectPaletteId::One => self.monochrome.obj_palette_1, ObjectPaletteId::One => self.monochrome.obj_palette_1,
}; };
let end = Pixels::PIXEL_COUNT - self.fifo.object.len(); let end = Pixels::PIXEL_COUNT - self.fifo.obj.len();
let start = Pixels::PIXEL_COUNT - end; let start = Pixels::PIXEL_COUNT - end;
let x_flip = attr.flags.x_flip(); let x_flip = attr.flags.x_flip();
@ -276,7 +276,7 @@ impl Ppu {
priority, priority,
}; };
self.fifo.object.push_back(fifo_info); self.fifo.obj.push_back(fifo_info);
} }
self.fetch.back.resume(); self.fetch.back.resume();
@ -352,8 +352,11 @@ impl Ppu {
// FIXME: Is this the correct behaviour // FIXME: Is this the correct behaviour
let bg_zero_colour = self.monochrome.bg_palette.i0_colour(); let bg_zero_colour = self.monochrome.bg_palette.i0_colour();
let maybe_rgba = self.fifo.background.pop_front().map(|bg_info| { let maybe_rgba =
match self.fifo.object.pop_front() { self.fifo
.back
.pop_front()
.map(|bg_info| match self.fifo.obj.pop_front() {
Some(obj_info) => match obj_info.shade { Some(obj_info) => match obj_info.shade {
Some(obj_shade) => match obj_info.priority { Some(obj_shade) => match obj_info.priority {
RenderPriority::BackgroundAndWindow => match bg_info.shade { RenderPriority::BackgroundAndWindow => match bg_info.shade {
@ -368,7 +371,6 @@ impl Ppu {
}, },
None if bg_enabled => bg_info.shade.into_rgba(), None if bg_enabled => bg_info.shade.into_rgba(),
None => bg_zero_colour.into_rgba(), None => bg_zero_colour.into_rgba(),
}
}); });
if let Some(rgba) = maybe_rgba.as_ref() { if let Some(rgba) = maybe_rgba.as_ref() {
@ -400,7 +402,7 @@ impl Ppu {
self.window_stat.set_should_draw(true); self.window_stat.set_should_draw(true);
self.fetch.back.reset(); self.fetch.back.reset();
self.fetch.x_pos = 0; self.fetch.x_pos = 0;
self.fifo.background.clear(); self.fifo.back.clear();
} }
} else { } else {
self.window_stat.set_should_draw(false); self.window_stat.set_should_draw(false);
@ -711,12 +713,12 @@ impl PixelFetcher {
let tbpp = Pixels::from_bytes(high, low); let tbpp = Pixels::from_bytes(high, low);
if fifo.background.is_empty() { if fifo.back.is_empty() {
for x in 0..Pixels::PIXEL_COUNT { for x in 0..Pixels::PIXEL_COUNT {
let shade = palette.shade(tbpp.shade_id(x)); let shade = palette.shade(tbpp.shade_id(x));
let fifo_info = BackgroundFifoInfo { shade }; let fifo_info = BackgroundFifoInfo { shade };
fifo.background.push_back(fifo_info); fifo.back.push_back(fifo_info);
} }
} }
} }
@ -885,8 +887,8 @@ struct ObjectFifoInfo {
// really necessary here? // really necessary here?
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct FifoRenderer { struct FifoRenderer {
background: VecDeque<BackgroundFifoInfo>, back: VecDeque<BackgroundFifoInfo>,
object: VecDeque<ObjectFifoInfo>, obj: VecDeque<ObjectFifoInfo>,
enabled: bool, enabled: bool,
} }
@ -907,8 +909,8 @@ impl FifoRenderer {
impl Default for FifoRenderer { impl Default for FifoRenderer {
fn default() -> Self { fn default() -> Self {
Self { Self {
background: VecDeque::with_capacity(8), back: VecDeque::with_capacity(8),
object: VecDeque::with_capacity(8), obj: VecDeque::with_capacity(8),
enabled: true, enabled: true,
} }
} }