Repository navigation
Fix native AA framebuffer overflow from quantized display copies - #182
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native 480i/p antialiasing uses a 242-line EFB. With the pinned libogc2, its quantized display copy writes 483 rows, while the VI-sized framebuffer reserves only 480. At 640 pixels, that overruns each buffer by 3,840 bytes and can corrupt adjacent allocations during display changes.
Allocate boot and replacement XFBs for
max(VI rows, GX_GetNumXfbLines(...))using a temporary storage-mode copy. The real VI mode, 480-line output, stride and AA settings stay intact. Failed replacement allocations still preserve both active buffers and avoid GX/VI publication.Validation: the complete native suite passes in debug and O3/LTO. Regressions cover 483/479-row quantizers, padded strides, ordinary 240/480/576 modes, metadata and both allocation failures. A PowerPC/Dolphin GPU canary using the production helper observed 3,840 changed guard bytes for each legacy 480i/p AA allocation and zero for every protected copy. All 12 cases passed, including return from 576p to 480p AA, 240p AA and safe 480i. This verifies emulator GX-copy bounds; physical-console behavior remains unqualified.
Measurements, hashes and reproduction. CI coverage/workflow checks pass locally. The glass-cube sample needs a published SDK containing this fix before enabling native AA by default.