2010-09-01 13:20:05 +00:00
|
|
|
class Background {
|
2015-12-06 21:11:41 +00:00
|
|
|
struct ID { enum : uint { BG1, BG2, BG3, BG4 }; };
|
|
|
|
struct Mode { enum : uint { BPP2, BPP4, BPP8, Mode7, Inactive }; };
|
|
|
|
struct ScreenSize { enum : uint { Size32x32, Size32x64, Size64x32, Size64x64 }; };
|
|
|
|
struct TileSize { enum : uint { Size8x8, Size16x16 }; };
|
|
|
|
|
|
|
|
Background(PPU& self, uint id);
|
|
|
|
~Background();
|
|
|
|
|
|
|
|
alwaysinline auto get_tile(uint hoffset, uint voffset) -> uint;
|
|
|
|
auto offset_per_tile(uint x, uint y, uint& hoffset, uint& voffset) -> void;
|
|
|
|
auto scanline() -> void;
|
|
|
|
auto render() -> void;
|
|
|
|
auto render_mode7() -> void;
|
|
|
|
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
|
|
|
PPU& self;
|
2010-09-01 13:20:05 +00:00
|
|
|
|
2010-09-06 11:13:51 +00:00
|
|
|
bool priority0_enable;
|
|
|
|
bool priority1_enable;
|
|
|
|
|
2010-09-01 13:20:05 +00:00
|
|
|
struct Regs {
|
2015-12-06 21:11:41 +00:00
|
|
|
uint mode;
|
|
|
|
uint priority0;
|
|
|
|
uint priority1;
|
2010-09-01 13:20:05 +00:00
|
|
|
|
|
|
|
bool tile_size;
|
2015-12-06 21:11:41 +00:00
|
|
|
uint mosaic;
|
2010-09-01 13:20:05 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint screen_addr;
|
|
|
|
uint screen_size;
|
|
|
|
uint tiledata_addr;
|
2010-09-01 13:20:05 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint hoffset;
|
|
|
|
uint voffset;
|
2010-09-01 13:20:05 +00:00
|
|
|
|
|
|
|
bool main_enable;
|
|
|
|
bool sub_enable;
|
|
|
|
} regs;
|
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint16** mosaic_table;
|
Update to v068r10 release.
(there was no r09 release posted to the WIP thread)
byuu says:
It is feature-complete, but horizontal mosaic is less accurate. I have
an idea for a mosaic color ring buffer to get it equally accurate, but
I haven't implemented it yet. For now it's just a simple x & ~(mosaic >>
1) trick that is passable.
Hires blending was left out, as it's more processor intensive and
blargg's NTSC does a better job with that anyway.
There's some OPT vertical positioning issues in the SNES Test Program's
character test; Goodbye, Anthrox has some sort of fast CPU DMA issue;
etc.
Total speedup is a mere 13.5%. Not quite the 50% I wanted in the best
case, but I'll take what I can get.
254->289fps in Zelda 3 on my E8400 now. There's another 15% hiding with
blargg's SMP and 5-10% with blargg's fast DSP, but they lose too much
accuracy. It'd put me at or below Snes9X accuracy, while still being 50%
slower.
SSE2 was performing worse this time, both on x86 and amd64, so I left
that optimization off.
So, barring a miracle, this is about the best it's going to get.
2010-09-03 11:37:36 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
const uint id;
|
|
|
|
uint opt_valid_bit;
|
Update to v068r10 release.
(there was no r09 release posted to the WIP thread)
byuu says:
It is feature-complete, but horizontal mosaic is less accurate. I have
an idea for a mosaic color ring buffer to get it equally accurate, but
I haven't implemented it yet. For now it's just a simple x & ~(mosaic >>
1) trick that is passable.
Hires blending was left out, as it's more processor intensive and
blargg's NTSC does a better job with that anyway.
There's some OPT vertical positioning issues in the SNES Test Program's
character test; Goodbye, Anthrox has some sort of fast CPU DMA issue;
etc.
Total speedup is a mere 13.5%. Not quite the 50% I wanted in the best
case, but I'll take what I can get.
254->289fps in Zelda 3 on my E8400 now. There's another 15% hiding with
blargg's SMP and 5-10% with blargg's fast DSP, but they lose too much
accuracy. It'd put me at or below Snes9X accuracy, while still being 50%
slower.
SSE2 was performing worse this time, both on x86 and amd64, so I left
that optimization off.
So, barring a miracle, this is about the best it's going to get.
2010-09-03 11:37:36 +00:00
|
|
|
|
|
|
|
bool hires;
|
|
|
|
signed width;
|
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint tile_width;
|
|
|
|
uint tile_height;
|
Update to v068r10 release.
(there was no r09 release posted to the WIP thread)
byuu says:
It is feature-complete, but horizontal mosaic is less accurate. I have
an idea for a mosaic color ring buffer to get it equally accurate, but
I haven't implemented it yet. For now it's just a simple x & ~(mosaic >>
1) trick that is passable.
Hires blending was left out, as it's more processor intensive and
blargg's NTSC does a better job with that anyway.
There's some OPT vertical positioning issues in the SNES Test Program's
character test; Goodbye, Anthrox has some sort of fast CPU DMA issue;
etc.
Total speedup is a mere 13.5%. Not quite the 50% I wanted in the best
case, but I'll take what I can get.
254->289fps in Zelda 3 on my E8400 now. There's another 15% hiding with
blargg's SMP and 5-10% with blargg's fast DSP, but they lose too much
accuracy. It'd put me at or below Snes9X accuracy, while still being 50%
slower.
SSE2 was performing worse this time, both on x86 and amd64, so I left
that optimization off.
So, barring a miracle, this is about the best it's going to get.
2010-09-03 11:37:36 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint mask_x;
|
|
|
|
uint mask_y;
|
Update to v068r10 release.
(there was no r09 release posted to the WIP thread)
byuu says:
It is feature-complete, but horizontal mosaic is less accurate. I have
an idea for a mosaic color ring buffer to get it equally accurate, but
I haven't implemented it yet. For now it's just a simple x & ~(mosaic >>
1) trick that is passable.
Hires blending was left out, as it's more processor intensive and
blargg's NTSC does a better job with that anyway.
There's some OPT vertical positioning issues in the SNES Test Program's
character test; Goodbye, Anthrox has some sort of fast CPU DMA issue;
etc.
Total speedup is a mere 13.5%. Not quite the 50% I wanted in the best
case, but I'll take what I can get.
254->289fps in Zelda 3 on my E8400 now. There's another 15% hiding with
blargg's SMP and 5-10% with blargg's fast DSP, but they lose too much
accuracy. It'd put me at or below Snes9X accuracy, while still being 50%
slower.
SSE2 was performing worse this time, both on x86 and amd64, so I left
that optimization off.
So, barring a miracle, this is about the best it's going to get.
2010-09-03 11:37:36 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint scx;
|
|
|
|
uint scy;
|
Update to v068r10 release.
(there was no r09 release posted to the WIP thread)
byuu says:
It is feature-complete, but horizontal mosaic is less accurate. I have
an idea for a mosaic color ring buffer to get it equally accurate, but
I haven't implemented it yet. For now it's just a simple x & ~(mosaic >>
1) trick that is passable.
Hires blending was left out, as it's more processor intensive and
blargg's NTSC does a better job with that anyway.
There's some OPT vertical positioning issues in the SNES Test Program's
character test; Goodbye, Anthrox has some sort of fast CPU DMA issue;
etc.
Total speedup is a mere 13.5%. Not quite the 50% I wanted in the best
case, but I'll take what I can get.
254->289fps in Zelda 3 on my E8400 now. There's another 15% hiding with
blargg's SMP and 5-10% with blargg's fast DSP, but they lose too much
accuracy. It'd put me at or below Snes9X accuracy, while still being 50%
slower.
SSE2 was performing worse this time, both on x86 and amd64, so I left
that optimization off.
So, barring a miracle, this is about the best it's going to get.
2010-09-03 11:37:36 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint hscroll;
|
|
|
|
uint vscroll;
|
Update to v068r10 release.
(there was no r09 release posted to the WIP thread)
byuu says:
It is feature-complete, but horizontal mosaic is less accurate. I have
an idea for a mosaic color ring buffer to get it equally accurate, but
I haven't implemented it yet. For now it's just a simple x & ~(mosaic >>
1) trick that is passable.
Hires blending was left out, as it's more processor intensive and
blargg's NTSC does a better job with that anyway.
There's some OPT vertical positioning issues in the SNES Test Program's
character test; Goodbye, Anthrox has some sort of fast CPU DMA issue;
etc.
Total speedup is a mere 13.5%. Not quite the 50% I wanted in the best
case, but I'll take what I can get.
254->289fps in Zelda 3 on my E8400 now. There's another 15% hiding with
blargg's SMP and 5-10% with blargg's fast DSP, but they lose too much
accuracy. It'd put me at or below Snes9X accuracy, while still being 50%
slower.
SSE2 was performing worse this time, both on x86 and amd64, so I left
that optimization off.
So, barring a miracle, this is about the best it's going to get.
2010-09-03 11:37:36 +00:00
|
|
|
|
2015-12-06 21:11:41 +00:00
|
|
|
uint mosaic_vcounter;
|
|
|
|
uint mosaic_voffset;
|
Update to v068r13 release.
byuu says:
Bug-fix night for the new PPUs.
Accuracy:
Fixed BG palette clamping, which fixes Taz-Mania.
Added blocking for CGRAM writes during active display, to match the
compatibility core. It really should override to the last fetched
palette color, I'll probably try that out soon enough.
Performance:
Mosaic should match the other renderers. Unfortunately, as suspected, it
murders speed. 290->275fps. It's now only 11fps faster, hardly worth it
at all. But the old rendering code is really awful, so maybe it's for
the best it gets refreshed.
It's really tough to understand why this is such a performance hit, it's
just a decrement+compare check four times per pixel. But yeah, it hits
it really, really hard.
Fixed a missing check in Mode4 offset-per-tile, fixes vertical alignment
of a test image in the SNES Test Program.
2010-09-05 13:22:26 +00:00
|
|
|
|
2010-09-01 13:22:05 +00:00
|
|
|
LayerWindow window;
|
|
|
|
|
2010-09-01 13:20:05 +00:00
|
|
|
friend class PPU;
|
|
|
|
};
|