Skip to content

Clear Window before blitting Viewport in gl_compatibility renderer#73300

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
clayjohn:GL-clear_window
Feb 15, 2023
Merged

Clear Window before blitting Viewport in gl_compatibility renderer#73300
akien-mga merged 1 commit into
godotengine:masterfrom
clayjohn:GL-clear_window

Conversation

@clayjohn

Copy link
Copy Markdown
Member

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.

@clayjohn clayjohn added this to the 4.0 milestone Feb 14, 2023
@clayjohn clayjohn requested review from a team as code owners February 14, 2023 18:34
@akien-mga akien-mga merged commit eff6508 into godotengine:master Feb 15, 2023
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenGL: Window stretch mode canvas_items or viewport leaves uncleared section if using keep, keep_width or keep_height stretch aspect

2 participants