dolphin/Source/Core/VideoCommon
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
..
AbstractFramebuffer.cpp Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
AbstractFramebuffer.h Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
AbstractPipeline.h AbstractPipeline: Support returning "cache data" 2019-04-16 00:09:47 +10:00
AbstractShader.h AbstractPipeline: Support returning "cache data" 2019-04-16 00:09:47 +10:00
AbstractStagingTexture.cpp Assert: Uppercase assertion macros 2018-03-14 22:03:12 -04:00
AbstractStagingTexture.h Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
AbstractTexture.cpp Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings 2020-12-16 16:04:19 +01:00
AbstractTexture.h FramebufferManager: Correctly handle read back D24S8 textures 2019-07-31 15:33:28 +10:00
AsyncRequests.cpp Core: Skip duplicate frames when using frame advance 2020-04-09 11:39:29 +02:00
AsyncRequests.h Core: Skip duplicate frames when using frame advance 2020-04-09 11:39:29 +02:00
AsyncShaderCompiler.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
AsyncShaderCompiler.h ShaderCache: Implement compile priority 2018-03-17 01:53:11 +10:00
BoundingBox.cpp VideoCommon/BoundingBox: Move PixelShaderManager::SetBoundingBoxActive() calls into Enable()/Disable() 2019-12-05 11:57:58 -05:00
BoundingBox.h VideoCommon/BoundingBox: Make interface for querying bounding box data 2019-12-05 11:48:42 -05:00
BPFunctions.cpp Update zcompression format change TODO 2021-05-05 11:32:42 +12:00
BPFunctions.h VideoCommon: Remove unused MathUtil.h include from VideoCommon.h 2019-07-16 20:54:34 -04:00
BPMemory.cpp Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
BPMemory.h Split TevStageIndirect::mid into matrix_index and matrix_id 2021-05-07 16:27:52 -07:00
BPStructs.cpp VideoCommon: Add fallback handling for bounding box when disabled or unsupported 2021-05-31 19:56:24 -04:00
BPStructs.h VideoCommon: Header cleanup 2016-01-17 20:11:45 -05:00
CMakeLists.txt VideoCommon: move all texture calculations to a "TextureInfo" class. This ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache 2021-05-11 22:58:36 -05:00
CommandProcessor.cpp Lint: End of namespace 2021-06-07 12:55:52 +04:00
CommandProcessor.h Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
ConstantManager.h Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
CPMemory.cpp Add names and descriptions for CP registers to the FIFO analyzer 2021-03-06 19:27:14 -08:00
CPMemory.h Add descriptions for GX_LOAD_INDX_A/B/C/D 2021-05-07 15:42:26 -07:00
DataReader.h DataReader: Make use of if constexpr where applicable 2020-10-20 08:42:32 -04:00
DriverDetails.cpp VideoCommon: Fix bounding box on AMD/OpenGL/Windows 2021-05-31 16:22:50 -07:00
DriverDetails.h VideoCommon: Fix bounding box on AMD/OpenGL/Windows 2021-05-31 16:22:50 -07:00
Fifo.cpp Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
Fifo.h Fifo: Run/sync with the GPU on command processor register access 2021-04-18 03:24:01 +10:00
FPSCounter.cpp Fix FPS counter and Game Window speed % breaking on pause/unpause 2021-05-06 01:10:04 +03:00
FPSCounter.h Fix FPS counter and Game Window speed % breaking on pause/unpause 2021-05-06 01:10:04 +03:00
FramebufferManager.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
FramebufferManager.h FramebufferManager: Fix invalid readback of EFB D24S8 depth 2020-05-24 15:36:04 +10:00
FramebufferShaderGen.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
FramebufferShaderGen.h VideoCommon/FramebufferShaderGen: Remove unused Config struct 2019-12-04 23:54:15 -05:00
FrameDump.cpp Merge pull request #9275 from JosJuice/framedump-boot-time 2020-12-05 23:57:41 +01:00
FrameDump.h FrameDump: Start timing at 0 ticks when starting from boot 2020-11-27 17:54:08 +01:00
FreeLookCamera.cpp FreeLook: update camera and manager to use a delta time for movement (in case we decide to move this somewhere else in the future) 2021-03-18 17:54:12 -05:00
FreeLookCamera.h FreeLook: update camera and manager to use a delta time for movement (in case we decide to move this somewhere else in the future) 2021-03-18 17:54:12 -05:00
GeometryShaderGen.cpp ShaderGenCommon: Rename WriteFmt() to Write() 2020-11-09 02:31:49 -05:00
GeometryShaderGen.h VideoCommon: Remove unnecessary memset on ShaderUid instances. 2019-05-30 06:41:54 -04:00
GeometryShaderManager.cpp Convert XFMemory to BitField and enum class 2021-03-06 19:27:14 -08:00
GeometryShaderManager.h VideoBackends: Merge Initialize and Shutdown functions. 2016-06-26 12:34:59 +02:00
GXPipelineTypes.h PixelShaderGen: always run indirect stage logic 2021-05-07 16:37:47 -07:00
HiresTextures_DDSLoader.cpp rename Common/File to Common/IOFile 2021-01-27 14:29:48 -08:00
HiresTextures.cpp VideoCommon: move all texture calculations to a "TextureInfo" class. This ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache 2021-05-11 22:58:36 -05:00
HiresTextures.h VideoCommon: move all texture calculations to a "TextureInfo" class. This ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache 2021-05-11 22:58:36 -05:00
IndexGenerator.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
IndexGenerator.h VideoCommon/IndexGenerator: Eliminate static state 2019-12-05 10:49:32 -05:00
LightingShaderGen.cpp Convert XFMemory to BitField and enum class 2021-03-06 19:27:14 -08:00
LightingShaderGen.h LightingShaderGen: Always calculate lighting for both color channels 2020-11-20 15:54:04 -08:00
LookUpTables.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
NativeVertexFormat.h Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
NetPlayChatUI.cpp VideoCommon/NetPlayChatUI: Default destructor in the cpp file 2019-05-29 06:20:05 -04:00
NetPlayChatUI.h VideoCommon/NetPlayChatUI: Default destructor in the cpp file 2019-05-29 06:20:05 -04:00
NetPlayGolfUI.cpp VideoCommon: Make use of fmt outside of shader generators 2019-11-23 16:00:45 -05:00
NetPlayGolfUI.h VideoCommon/NetPlayGolfUI: Remove unused header 2019-05-29 06:20:57 -04:00
OnScreenDisplay.cpp OnScreenDisplay: a few fixes 2021-04-25 15:45:30 +03:00
OnScreenDisplay.h Android: Move OSD out of the way when menu is open 2020-09-16 18:36:15 +02:00
OpcodeDecoding.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
OpcodeDecoding.h VideoCommon/OpcodeDecoding: Move g_bRecordFifoData into namespace 2019-12-05 09:13:03 -05:00
PerfQueryBase.cpp Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
PerfQueryBase.h Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
PixelEngine.cpp Lint: End of namespace 2021-06-07 12:55:52 +04:00
PixelEngine.h Lint: End of namespace 2021-06-07 12:55:52 +04:00
PixelShaderGen.cpp VideoCommon: Only include centered pixels in bounding box 2021-06-10 21:49:52 -04:00
PixelShaderGen.h PixelShaderGen: always run indirect stage logic 2021-05-07 16:37:47 -07:00
PixelShaderManager.cpp UberShaderPixel: always run indirect stage logic 2021-05-07 16:37:47 -07:00
PixelShaderManager.h Ubershaders: Fix 6-bit color truncation not being applied 2017-08-01 00:01:09 +10:00
PostProcessing.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
PostProcessing.h VideoCommon: Remove unused MathUtil.h include from VideoCommon.h 2019-07-16 20:54:34 -04:00
RenderBase.cpp VideoCommon: Add fallback handling for bounding box when disabled or unsupported 2021-05-31 19:56:24 -04:00
RenderBase.h VideoCommon: Add fallback handling for bounding box when disabled or unsupported 2021-05-31 19:56:24 -04:00
RenderState.cpp Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
RenderState.h Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
SamplerCommon.h Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
sfont.inc Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
ShaderCache.cpp Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
ShaderCache.h rename Common/File to Common/IOFile 2021-01-27 14:29:48 -08:00
ShaderGenCommon.cpp ShaderGenCommon: Rename WriteFmt() to Write() 2020-11-09 02:31:49 -05:00
ShaderGenCommon.h LightingShaderGen: Always calculate lighting for both color channels 2020-11-20 15:54:04 -08:00
Statistics.cpp VideoCommon: Remove unused MathUtil.h include from VideoCommon.h 2019-07-16 20:54:34 -04:00
Statistics.h VideoCommon/Statistics: Remove unused DECSTAT macro 2019-07-10 23:40:13 -04:00
TextureCacheBase.cpp Merge pull request #9681 from iwubcode/texture-info 2021-05-13 06:44:08 -04:00
TextureCacheBase.h Merge pull request #9681 from iwubcode/texture-info 2021-05-13 06:44:08 -04:00
TextureConfig.cpp Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
TextureConfig.h Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
TextureConversionShader.cpp Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
TextureConversionShader.h VideoCommon/TextureConversionShader: Convert over to using ShaderCode 2020-01-23 14:19:36 -05:00
TextureConverterShaderGen.cpp Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
TextureConverterShaderGen.h Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
TextureDecoder_Common.cpp VideoCommon: Migrate over to fmt 2020-11-17 21:23:58 -05:00
TextureDecoder_Generic.cpp TextureDecoder: Move XFB decoding to Common 2019-04-21 12:41:15 +10:00
TextureDecoder_Util.h TextureDecoder: Deduplicate some utility code 2017-01-15 20:23:26 +11:00
TextureDecoder_x64.cpp Replace uses of cassert with Common/Assert.h 2021-04-02 10:18:18 -07:00
TextureDecoder.h Convert BPMemory to BitField and enum class 2021-03-06 19:27:19 -08:00
TextureInfo.cpp Fix -Wreorder warnings 2021-05-30 17:10:20 +01:00
TextureInfo.h VideoCommon/TextureInfo: Restore old mipmap detection logic 2021-05-22 00:35:43 -04:00
UberShaderCommon.cpp Change BitfieldExtract to use a pointer to the bitfield member 2021-05-07 15:11:17 -07:00
UberShaderCommon.h Change BitfieldExtract to use a pointer to the bitfield member 2021-05-07 15:11:17 -07:00
UberShaderPixel.cpp Skip indirect operation for out of bounds indirect stages 2021-05-27 22:13:42 -07:00
UberShaderPixel.h VideoCommon/ShaderGenCommon: Make template functions regular functions 2020-05-25 21:12:29 -04:00
UberShaderVertex.cpp Change BitfieldExtract to use a pointer to the bitfield member 2021-05-07 15:11:17 -07:00
UberShaderVertex.h VideoCommon: Remove unnecessary memset on ShaderUid instances. 2019-05-30 06:41:54 -04:00
VertexLoader_Color.cpp Convert VertexLoader_Color to a table 2021-05-07 15:42:11 -07:00
VertexLoader_Color.h Convert VertexLoader_Color to a table 2021-05-07 15:42:11 -07:00
VertexLoader_Normal.cpp Convert CPMemory to BitField and enum class 2021-03-06 19:27:08 -08:00
VertexLoader_Normal.h Convert CPMemory to BitField and enum class 2021-03-06 19:27:08 -08:00
VertexLoader_Position.cpp Convert CPMemory to BitField and enum class 2021-03-06 19:27:08 -08:00
VertexLoader_Position.h Convert CPMemory to BitField and enum class 2021-03-06 19:27:08 -08:00
VertexLoader_TextCoord.cpp Convert CPMemory to BitField and enum class 2021-03-06 19:27:08 -08:00
VertexLoader_TextCoord.h Convert CPMemory to BitField and enum class 2021-03-06 19:27:08 -08:00
VertexLoader.cpp Move vertex size and component calculation to VertexLoaderBase 2021-05-07 15:42:17 -07:00
VertexLoader.h Remove VertexLoaderBase::IsInitialized 2021-05-07 15:42:17 -07:00
VertexLoaderARM64.cpp Apple M1: RAII Wrapper for JITPageWrite*Execute*() 2021-05-22 15:25:18 -07:00
VertexLoaderARM64.h Remove VertexLoaderBase::IsInitialized 2021-05-07 15:42:17 -07:00
VertexLoaderBase.cpp Separate vertex components by spaces 2021-05-07 15:42:26 -07:00
VertexLoaderBase.h Fix -Wreorder warnings 2021-05-30 17:10:20 +01:00
VertexLoaderManager.cpp Move vertex size and component calculation to VertexLoaderBase 2021-05-07 15:42:17 -07:00
VertexLoaderManager.h Remove VertexLoader::ToString 2021-05-07 15:42:13 -07:00
VertexLoaderUtils.h Externals: Add zstd 2020-05-13 20:53:10 +02:00
VertexLoaderX64.cpp Move vertex size and component calculation to VertexLoaderBase 2021-05-07 15:42:17 -07:00
VertexLoaderX64.h Remove VertexLoaderBase::IsInitialized 2021-05-07 15:42:17 -07:00
VertexManagerBase.cpp Convert XFMemory to BitField and enum class 2021-03-06 19:27:14 -08:00
VertexManagerBase.h VideoCommon: Tweak widescreen heuristic and clean up some related Renderer logic. 2020-02-09 13:22:25 -06:00
VertexShaderGen.cpp VertexShaderGen: Sonic epsilon hack for OpenGL ES 2021-04-02 15:12:30 +02:00
VertexShaderGen.h Convert XFMemory to BitField and enum class 2021-03-06 19:27:14 -08:00
VertexShaderManager.cpp Convert XFMemory to BitField and enum class 2021-03-06 19:27:14 -08:00
VertexShaderManager.h VideoCommon: remove VertexShaderManager functions instead preferring the direct freelook camera methods 2020-05-03 13:34:13 -05:00
VideoBackendBase.cpp VideoCommon: Add fallback handling for bounding box when disabled or unsupported 2021-05-31 19:56:24 -04:00
VideoBackendBase.h VideoCommon: Get rid of the global g_available_video_backends 2020-10-21 22:00:10 +02:00
VideoCommon.h Implement EFB Peeks for compressed z16 formats 2021-05-05 11:32:29 +12:00
VideoConfig.cpp Core / VideoCommon: Remove old Free Look config 2020-12-24 13:49:25 -06:00
VideoConfig.h Core / VideoCommon: Remove old Free Look config 2020-12-24 13:49:25 -06:00
VideoState.cpp FramebufferManager: Support saving EFB to save state 2019-07-24 05:19:22 +10:00
VideoState.h VideoBackends: Merge Initialize and Shutdown functions. 2016-06-26 12:34:59 +02:00
XFMemory.cpp VideoCommon: Header cleanup 2016-01-17 20:11:45 -05:00
XFMemory.h Skip loading unknown XF registers in the FIFO player 2021-04-06 11:54:49 -07:00
XFStructs.cpp Add descriptions for GX_LOAD_INDX_A/B/C/D 2021-05-07 15:42:26 -07:00
XFStructs.h Add descriptions for GX_LOAD_INDX_A/B/C/D 2021-05-07 15:42:26 -07:00