Clear Window before blitting Viewport in gl_compatibility renderer #73300
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.
Fixes: #71799
In Godot 3.x we had an API to draw black bars on the side of the window if some amount of the window was left uncovered by the Viewport. This covered up the leftover colored pixels from previous frames. In Godot 4.0 we got rid of that API as it is not needed for Vulkan which has to recreate the swapchain each time the window resizes.
Instead of bringing back the black bars we just clear the window if any section is left uncovered. Clearing to zero is a special operation on most drivers and is much faster than issuing 2 draw calls, plus the full screen clear signals that we don't care about the previous contents which can be a performance benefit in some cases.
A potential optimization would be to track window size and only clear on window size changes. However, I do not think it is worth the added complexity.