2018-05-26 03:29:14 +00:00
|
|
|
auto PPU::Line::render() -> void {
|
2018-05-29 11:26:48 +00:00
|
|
|
bool hires = io.pseudoHires || io.bgMode == 5 || io.bgMode == 6;
|
|
|
|
|
|
|
|
if(!io.displayDisable) {
|
2018-05-28 01:51:38 +00:00
|
|
|
auto aboveColor = cgram[0];
|
2018-05-29 11:26:48 +00:00
|
|
|
auto belowColor = hires ? cgram[0] : io.col.fixedColor;
|
2018-05-28 01:51:38 +00:00
|
|
|
for(uint x : range(256)) {
|
2018-05-29 11:26:48 +00:00
|
|
|
above[x] = {Source::COL, 0, aboveColor};
|
|
|
|
below[x] = {Source::COL, 0, belowColor};
|
2018-05-28 01:51:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
renderBackground(io.bg1, Source::BG1);
|
|
|
|
renderBackground(io.bg2, Source::BG2);
|
|
|
|
renderBackground(io.bg3, Source::BG3);
|
|
|
|
renderBackground(io.bg4, Source::BG4);
|
2018-05-26 23:04:43 +00:00
|
|
|
renderObject(io.obj);
|
|
|
|
|
Update to v106r33 release.
byuu says:
Changelog:
- nall/GNUmakefile: added `openmp=(true,false)` option; can be toggled
when building higan/bsnes
- defaults to disabled on macOS, because Xcode doesn't stupidly
doesn't ship with support for it
- higan/GNUmakefile: forgot to switch target,profile back from
bsnes,fast to higan,accurate
- this is just gonna happen from time to time, sorry
- sfc/dsp: when using the fast profile, the DSP syncs per sample
instead of per clock
- should only negatively impact Koushien 2, but is a fairly
significant speedup otherwise
- sfc/ppc,ppu-fast: optimized the code a bit (ppu 130fps to 133fps)
- sfc/ppu-fast: basic vertical mosaic support (not accurate, but
should look okay hopefully)
- sfc/ppu-fast: added missing mode7 hflip support
- sfc/ppu-fast: added support to render at 256-width and/or 240-height
- gives a decent speed boost, and also allows all of the older
quark shaders to work nicely again
- it does violate the contract of Emulator::Interface, but oh
well, it works fine in the bsnes GUI
- sfc/ppu-fast: use cached CGRAM values for mode7 and sprites
- sfc/ppu-fast: use global range/time over flags in object rendering
- may not actually work as we intended since it's a race condition
even if it's only ORing the flags
- really don't want to have to make those variables atomic if I
don't have to
- sfc/ppu-fast: should fully support interlace and overscan modes now
- hiro/cocoa: updated macOS Gatekeeper disable support to work on
10.13+
- ruby: forgot to fix macOS input driver, sorry
- nall/GNUmakefile: if uname is present, then just default to rm
instead of del (fixes Msys)
Note: blur emulation option will break pretty badly in 256x240 output
mode. I'll fix it later.
2018-05-31 07:06:55 +00:00
|
|
|
auto output = !ppu.interlace() || !ppu.field() ? outputLo : outputHi;
|
|
|
|
auto width = !ppu.hires() ? 256 : 512;
|
|
|
|
auto luma = io.displayBrightness << 15;
|
|
|
|
|
2018-05-29 11:26:48 +00:00
|
|
|
if(io.displayDisable) {
|
Update to v106r33 release.
byuu says:
Changelog:
- nall/GNUmakefile: added `openmp=(true,false)` option; can be toggled
when building higan/bsnes
- defaults to disabled on macOS, because Xcode doesn't stupidly
doesn't ship with support for it
- higan/GNUmakefile: forgot to switch target,profile back from
bsnes,fast to higan,accurate
- this is just gonna happen from time to time, sorry
- sfc/dsp: when using the fast profile, the DSP syncs per sample
instead of per clock
- should only negatively impact Koushien 2, but is a fairly
significant speedup otherwise
- sfc/ppc,ppu-fast: optimized the code a bit (ppu 130fps to 133fps)
- sfc/ppu-fast: basic vertical mosaic support (not accurate, but
should look okay hopefully)
- sfc/ppu-fast: added missing mode7 hflip support
- sfc/ppu-fast: added support to render at 256-width and/or 240-height
- gives a decent speed boost, and also allows all of the older
quark shaders to work nicely again
- it does violate the contract of Emulator::Interface, but oh
well, it works fine in the bsnes GUI
- sfc/ppu-fast: use cached CGRAM values for mode7 and sprites
- sfc/ppu-fast: use global range/time over flags in object rendering
- may not actually work as we intended since it's a race condition
even if it's only ORing the flags
- really don't want to have to make those variables atomic if I
don't have to
- sfc/ppu-fast: should fully support interlace and overscan modes now
- hiro/cocoa: updated macOS Gatekeeper disable support to work on
10.13+
- ruby: forgot to fix macOS input driver, sorry
- nall/GNUmakefile: if uname is present, then just default to rm
instead of del (fixes Msys)
Note: blur emulation option will break pretty badly in 256x240 output
mode. I'll fix it later.
2018-05-31 07:06:55 +00:00
|
|
|
for(uint x : range(width)) output[x] = 0;
|
2018-05-29 11:26:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
renderWindow(io.col.window, io.col.window.aboveMask, windowAbove);
|
|
|
|
renderWindow(io.col.window, io.col.window.belowMask, windowBelow);
|
|
|
|
|
Update to v106r33 release.
byuu says:
Changelog:
- nall/GNUmakefile: added `openmp=(true,false)` option; can be toggled
when building higan/bsnes
- defaults to disabled on macOS, because Xcode doesn't stupidly
doesn't ship with support for it
- higan/GNUmakefile: forgot to switch target,profile back from
bsnes,fast to higan,accurate
- this is just gonna happen from time to time, sorry
- sfc/dsp: when using the fast profile, the DSP syncs per sample
instead of per clock
- should only negatively impact Koushien 2, but is a fairly
significant speedup otherwise
- sfc/ppc,ppu-fast: optimized the code a bit (ppu 130fps to 133fps)
- sfc/ppu-fast: basic vertical mosaic support (not accurate, but
should look okay hopefully)
- sfc/ppu-fast: added missing mode7 hflip support
- sfc/ppu-fast: added support to render at 256-width and/or 240-height
- gives a decent speed boost, and also allows all of the older
quark shaders to work nicely again
- it does violate the contract of Emulator::Interface, but oh
well, it works fine in the bsnes GUI
- sfc/ppu-fast: use cached CGRAM values for mode7 and sprites
- sfc/ppu-fast: use global range/time over flags in object rendering
- may not actually work as we intended since it's a race condition
even if it's only ORing the flags
- really don't want to have to make those variables atomic if I
don't have to
- sfc/ppu-fast: should fully support interlace and overscan modes now
- hiro/cocoa: updated macOS Gatekeeper disable support to work on
10.13+
- ruby: forgot to fix macOS input driver, sorry
- nall/GNUmakefile: if uname is present, then just default to rm
instead of del (fixes Msys)
Note: blur emulation option will break pretty badly in 256x240 output
mode. I'll fix it later.
2018-05-31 07:06:55 +00:00
|
|
|
if(width == 256) for(uint x : range(width)) {
|
|
|
|
output[x] = luma | pixel(x, above[x], below[x]);
|
|
|
|
} else if(!hires) for(uint x : range(256)) {
|
|
|
|
output[x << 1 | 0] =
|
|
|
|
output[x << 1 | 1] = luma | pixel(x, above[x], below[x]);
|
2018-05-29 11:26:48 +00:00
|
|
|
} else for(uint x : range(256)) {
|
Update to v106r33 release.
byuu says:
Changelog:
- nall/GNUmakefile: added `openmp=(true,false)` option; can be toggled
when building higan/bsnes
- defaults to disabled on macOS, because Xcode doesn't stupidly
doesn't ship with support for it
- higan/GNUmakefile: forgot to switch target,profile back from
bsnes,fast to higan,accurate
- this is just gonna happen from time to time, sorry
- sfc/dsp: when using the fast profile, the DSP syncs per sample
instead of per clock
- should only negatively impact Koushien 2, but is a fairly
significant speedup otherwise
- sfc/ppc,ppu-fast: optimized the code a bit (ppu 130fps to 133fps)
- sfc/ppu-fast: basic vertical mosaic support (not accurate, but
should look okay hopefully)
- sfc/ppu-fast: added missing mode7 hflip support
- sfc/ppu-fast: added support to render at 256-width and/or 240-height
- gives a decent speed boost, and also allows all of the older
quark shaders to work nicely again
- it does violate the contract of Emulator::Interface, but oh
well, it works fine in the bsnes GUI
- sfc/ppu-fast: use cached CGRAM values for mode7 and sprites
- sfc/ppu-fast: use global range/time over flags in object rendering
- may not actually work as we intended since it's a race condition
even if it's only ORing the flags
- really don't want to have to make those variables atomic if I
don't have to
- sfc/ppu-fast: should fully support interlace and overscan modes now
- hiro/cocoa: updated macOS Gatekeeper disable support to work on
10.13+
- ruby: forgot to fix macOS input driver, sorry
- nall/GNUmakefile: if uname is present, then just default to rm
instead of del (fixes Msys)
Note: blur emulation option will break pretty badly in 256x240 output
mode. I'll fix it later.
2018-05-31 07:06:55 +00:00
|
|
|
output[x << 1 | 0] = luma | pixel(x, below[x], above[x]);
|
|
|
|
output[x << 1 | 1] = luma | pixel(x, above[x], below[x]);
|
2018-05-28 01:51:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-29 11:26:48 +00:00
|
|
|
auto PPU::Line::pixel(uint x, Pixel above, Pixel below) const -> uint15 {
|
|
|
|
if(!windowAbove[x]) above.color = 0x0000;
|
|
|
|
if(!windowBelow[x]) return above.color;
|
|
|
|
if(!io.col.enable[above.source]) return above.color;
|
|
|
|
if(!io.col.blendMode) return blend(above.color, io.col.fixedColor, io.col.halve && windowAbove[x]);
|
|
|
|
return blend(above.color, below.color, io.col.halve && windowAbove[x] && below.source != Source::COL);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto PPU::Line::blend(uint x, uint y, bool halve) const -> uint15 {
|
|
|
|
if(!io.col.mathMode) { //add
|
|
|
|
if(!halve) {
|
|
|
|
uint sum = x + y;
|
|
|
|
uint carry = (sum - ((x ^ y) & 0x0421)) & 0x8420;
|
|
|
|
return (sum - carry) | (carry - (carry >> 5));
|
|
|
|
} else {
|
|
|
|
return (x + y - ((x ^ y) & 0x0421)) >> 1;
|
|
|
|
}
|
|
|
|
} else { //sub
|
|
|
|
uint diff = x - y + 0x8420;
|
|
|
|
uint borrow = (diff - ((x ^ y) & 0x8420)) & 0x8420;
|
|
|
|
if(!halve) {
|
|
|
|
return (diff - borrow) & (borrow - (borrow >> 5));
|
|
|
|
} else {
|
|
|
|
return (((diff - borrow) & (borrow - (borrow >> 5))) & 0x7bde) >> 1;
|
|
|
|
}
|
2018-05-28 01:51:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-29 11:26:48 +00:00
|
|
|
auto PPU::Line::directColor(uint palette, uint tile) const -> uint15 {
|
|
|
|
return (palette << 7 & 0x6000) + (tile >> 0 & 0x1000)
|
|
|
|
+ (palette << 4 & 0x0380) + (tile >> 5 & 0x0040)
|
|
|
|
+ (palette << 2 & 0x001c) + (tile >> 9 & 0x0002);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto PPU::Line::plotAbove(uint x, uint source, uint priority, uint color) -> void {
|
|
|
|
if(priority >= above[x].priority) above[x] = {source, priority, color};
|
|
|
|
}
|
|
|
|
|
2018-05-28 01:51:38 +00:00
|
|
|
auto PPU::Line::plotBelow(uint x, uint source, uint priority, uint color) -> void {
|
2018-05-29 11:26:48 +00:00
|
|
|
if(priority >= below[x].priority) below[x] = {source, priority, color};
|
2018-05-26 03:29:14 +00:00
|
|
|
}
|