pub struct PixelProvenance {Show 19 fields
pub scanline: i16,
pub dot: u16,
pub layer: PixelLayer,
pub palette_addr: u16,
pub palette_index: u8,
pub color: u8,
pub color_mask: u8,
pub nt_addr: u16,
pub at_addr: u16,
pub pattern_addr: u16,
pub bg_idx: u8,
pub bg_pal: u8,
pub spr_idx: u8,
pub spr_pal: u8,
pub sprite_slot: u8,
pub sprite_front: bool,
pub sprite_zero: bool,
pub fine_x: u8,
pub fine_y: u8,
}Expand description
The causal record for one emitted pixel.
Recorded in Ppu::emit_pixel from state already computed there plus the
per-tile address cascade described on Ppu::prov_bg_cur. Everything here is
an address or a decision the hardware actually made; nothing is reconstructed
after the fact, because a reconstruction would silently disagree with the
emulator in exactly the corner cases a provenance panel exists to explain.
§Reading it
Self::palette_index indexes straight into
WriteAttribution::palette, and Self::nt_addr resolves (through the
mapper’s mirroring) to the CIRAM offset for WriteAttribution::ciram — so
the two halves of this module compose into “this pixel is this color because
instruction X wrote this palette entry and instruction Y wrote this nametable
byte”.
Fields§
§scanline: i16PPU scanline the pixel was emitted on.
dot: u16PPU dot the pixel was emitted at. Screen X is dot - 1.
layer: PixelLayerWhich layer won.
palette_addr: u16The exact palette-RAM address read for the final color, pre-mirroring —
so $3F10 is reported as $3F10 even though it reads $3F00.
palette_index: u8Post-mirroring palette-RAM index of the final color. Indexes
WriteAttribution::palette directly.
color: u8The 6-bit NES color the palette entry held, before emphasis.
color_mask: u8$2001 grayscale + emphasis bits in effect at this pixel
(mask & 0xE1), which is what turns Self::color into the RGBA
actually written.
nt_addr: u16Nametable address of the background tile being displayed at this
pixel — not the address v currently holds, which has already advanced
two tiles ahead. See Ppu::prov_bg_cur.
at_addr: u16Attribute address of the displayed background tile. Carried rather than
derived from Self::nt_addr, because an MMC5 vertical split supplies
its own attribute address that the standard arithmetic cannot produce.
pattern_addr: u16CHR address of the pattern row feeding this pixel — the displayed
background tile’s row, or the winning sprite’s row.
PATTERN_ADDR_NONE for a backdrop pixel.
bg_idx: u8Background pattern bits (0..=3) at this pixel. 0 is transparent.
bg_pal: u8Background attribute / palette group (0..=3).
spr_idx: u8Sprite pattern bits (0..=3) at this pixel. 0 is transparent.
spr_pal: u8Sprite palette group (0..=3).
sprite_slot: u8Sprite slot (0..=7) of the winning sprite, or SPRITE_SLOT_NONE.
This is the secondary-OAM slot for the scanline, not the primary OAM sprite number: sprite evaluation copies bytes from primary to secondary OAM without retaining the source index, so the primary index is not available at emit time. The panel matches the slot’s Y/tile/attribute against OAM rather than being handed an index the PPU never kept.
sprite_front: booltrue when the winning sprite had front priority over the background.
sprite_zero: booltrue when sprite 0 contributed an opaque pixel here — the condition the
sprite-0 hit flag is derived from.
fine_x: u8Fine-X scroll in effect (0..=7): which texel column of the displayed background tile this pixel samples.
fine_y: u8Fine-Y (0..=7): which texel row of the displayed background tile.
Implementations§
Source§impl PixelProvenance
impl PixelProvenance
Sourcepub const fn is_recorded(&self) -> bool
pub const fn is_recorded(&self) -> bool
Whether this record was actually emitted, as opposed to being the cleared
Default.
Ppu::emit_pixel stamps Self::dot on every pixel it records, and the
visible dots are 1..=256 — so dot 0 is unreachable for a real record and
is exactly what clear leaves behind. Without this a caller cannot tell a
cleared record from a genuine backdrop pixel, and reads a confident
“scanline 0, dot 0, backdrop, palette $0000” as fact. That is precisely how
the v2.3.2 inspector reported a wiped frame (v2.3.6 workstream 0).
Trait Implementations§
Source§impl Clone for PixelProvenance
impl Clone for PixelProvenance
Source§fn clone(&self) -> PixelProvenance
fn clone(&self) -> PixelProvenance
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more