diff options
| author | Peter Fors <peter.fors@mindkiller.com> | 2025-04-08 02:26:58 +0200 |
|---|---|---|
| committer | Peter Fors <peter.fors@mindkiller.com> | 2025-04-08 02:26:58 +0200 |
| commit | 205dc47111125aa2f7458be948cd9cd434d0344c (patch) | |
| tree | dc9c44d9bc431449b478a5a5bc72a6a4d7c36c37 /ppu.c | |
| parent | d45fbf8d2e1adcb35043dfc9e06eae3ccfdf596e (diff) | |
Back at 2618fps
Diffstat (limited to 'ppu.c')
| -rw-r--r-- | ppu.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -11,14 +11,14 @@ static uint8_t __attribute__((aligned(64))) ppu_bitreverse_lut[256] = { #undef R6 static void ppu_reset(struct nes_state *state) { - struct ppu_state *ppu = &state->ppu; + struct ppu_state *restrict ppu = &state->ppu; memset(ppu, 0, sizeof(struct ppu_state)); } __attribute__((always_inline, hot)) static inline void ppu_evaluate_sprites(struct nes_state *state) { - struct ppu_state *ppu = &state->ppu; + struct ppu_state *restrict ppu = &state->ppu; uint8_t sprite_height = (ppu->reg_ctrl & 0x20) ? 16 : 8; uint8_t n = 0; @@ -52,7 +52,7 @@ static inline void ppu_evaluate_sprites(struct nes_state *state) { __attribute__((always_inline, hot)) static inline void ppu_fetch_sprite_patterns(struct nes_state *state) { - struct ppu_state *ppu = &state->ppu; + struct ppu_state *restrict ppu = &state->ppu; uint32_t addr; uint32_t bank; @@ -87,6 +87,7 @@ static inline void ppu_fetch_sprite_patterns(struct nes_state *state) { ppu->sprite_shift_lo[i] = lsb; ppu->sprite_shift_hi[i] = msb; + ppu->sprite_positions[i] = x; ppu->sprite_priorities[i] = attr & 0x20; s += 4; @@ -95,7 +96,7 @@ static inline void ppu_fetch_sprite_patterns(struct nes_state *state) { __attribute__((always_inline, hot)) static inline void ppu_render_pixel(struct nes_state *state) { - struct ppu_state *ppu = &state->ppu; + struct ppu_state *restrict ppu = &state->ppu; uint32_t x = ppu->dot - 1; uint32_t y = ppu->scanline; @@ -160,7 +161,8 @@ static inline void ppu_render_pixel(struct nes_state *state) { __attribute__((hot, flatten)) static void ppu_tick(struct nes_state *state) { - struct ppu_state *ppu = &state->ppu; + struct ppu_state *restrict ppu = &state->ppu; + uint32_t dot = ppu->dot; uint32_t scanline = ppu->scanline; |
