dolphin-emulator/Source/Core
Techjar b267f54259 VideoCommon: Only include centered pixels in bounding box
At higher resolutions, our bounding box dimensions end up being
slightly larger than original hardware in some cases. This is not
necessarily wrong, it's just an artifact of rendering at a higher
resolution, due to bringing out detail that wouldn't have appeared on
original hardware. It causes a texel to fall partially on what would
have been a single pixel at native resolution, resulting in the
coordinates getting bumped up to the next valid value. In many cases,
these slightly larger bounding boxes are perfectly fine, as games don't
hard-code expected dimensions. It is problematic in Paper Mario TTYD
though, for a somewhat complicated reason.

Paper Mario TTYD frequently uses EFB copies to pre-render a bunch of
animation frames for a character sprite (especially in Chapter 2), so
that it can then render 100 or more of them without bringing the
GameCube to its knees. Based on my observation, the game seems to set
aside a region of memory to store these EFB copies. This region is
obviously fairly small, as the GameCube only has 24MB of RAM. There are
2 rooms in Chapter 2 where you fight a horde of as many as 100 Jabbies,
which are also rendered using EFB copies, so in this room the game ends
up making 130(!) EFB copies just for Puni and Jabbi sprites. This seems
to nearly fill the region of memory it set aside for them.
Unfortunately, our slightly larger bounding boxes at higher resolutions
results in overflowing this memory, causing very strange behavior. Some
EFB copies partially overlap game state, resulting in reading it as a
garbage RGB5A3 texture that constantly changes. Others apparently
somehow trigger a corner case in our persistent buffer mapping, causing
them to partially overwrite earlier EFB copies.

What this change does is only include the screen coordinates that align
with the equivalent native resolution pixel centers, which generally
results in the bounding boxes being more in line with original
hardware. It isn't perfect, but it's enough to fix Paper Mario TTYD's
Jabbi rooms by avoiding the buffer overflow. Notably, it is more
accurate at odd resolutions than at even resolutions. Native resolution
is completely unaffected by this change, as should be the case. This
change may also have a small positive impact on shader performance at
higher resolutions, as there will be less atomic operations performed.
2021-06-10 21:49:52 -04:00
..
AudioCommon Replace uses of cassert with Common/Assert.h 2021-04-02 10:18:18 -07:00
Common ControllerInterface: DInput Joystick fix non thread safe static variable 2021-06-07 11:07:06 +03:00
Core Merge pull request #9792 from sepalani/lint 2021-06-07 12:16:08 +02:00
DiscIO DiscIO: Use MathUtil::SaturatingCast 2021-04-06 23:27:23 +02:00
DolphinNoGUI Implement Cursor Locking and new input focus checks for it 2021-05-27 10:31:12 +03:00
DolphinQt Merge pull request #9794 from Filoppi/fix_input_focus_bug 2021-06-07 20:08:09 -04:00
InputCommon Merge pull request #9792 from sepalani/lint 2021-06-07 12:16:08 +02:00
MacUpdater Apple M1: Build, Analytics, and Memory Management 2021-05-22 15:25:17 -07:00
UICommon Updater: Escape HTML characters in commit descriptions 2021-06-01 17:22:19 -07:00
UpdaterCommon Updater: Add code documentation Markdown file 2021-04-13 15:37:31 -07:00
VideoBackends Merge pull request #9782 from Techjar/bbox-ogl-upsidedown-fix 2021-06-08 13:24:03 +10:00
VideoCommon VideoCommon: Only include centered pixels in bounding box 2021-06-10 21:49:52 -04:00
WinUpdater Updater: Add code documentation Markdown file 2021-04-13 15:37:31 -07:00
CMakeLists.txt
DolphinLib.ARM64.props Implement ArmFPURoundMode.cpp 2021-04-25 15:56:19 +02:00
DolphinLib.props Merge pull request #9707 from JosJuice/remove-atomic-header 2021-05-14 14:33:24 -04:00
DolphinLib.vcxproj JitCommon: Signed 32-bit division magic constants 2021-03-07 18:27:36 +01:00
DolphinLib.vcxproj.user msbuild: bundle all dolphin "core" code into single library 2021-01-27 14:29:49 -08:00
DolphinLib.x64.props msbuild: bundle all dolphin "core" code into single library 2021-01-27 14:29:49 -08:00