Fix window_res related bugs and harden OpenGL state#6753
Merged
Conversation
wookieejedi
approved these changes
Jun 6, 2025
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.
As it turns out, a few things were trying to read from incorrect buffers when window_res was active, causing OpenGL error messages and possibly unintended behaviour in some parts.
Fix these by reading from the correct buffer when window_res is used.
This is especially important as it appears that newer SDL versions (SDL3 through SDL2compat is definitely affected, possibly older versions as well) exhibit some sort of cleanup effect on the front buffer, which results in bad reads and incorrect rendering of pause frames and other dialogs. To fix this, a followup PR should likely enable window_res at all times (as is done for fullscreen at the momemt), and for that, window_res needs to function reliably and without OpenGL errors.
Also harden the GL state handling, by querying whether the GL state is valid for the buffer flip, as SDL will exhibit undefined behaviour if it is not set correctly.