Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle VK_SUBOPTIMAL_KHR as a valid error code to fix Android performance. #88361

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

DarioSamo
Copy link
Contributor

Fixes #88355.

This should basically revert the behavior of presentation handling to the behavior previous to #87340.

Copied from my comment in the code.

// Godot does not currently support native rotation in Android when creating the swap chain. It intentionally uses
// VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR instead of the current transform bits available in the surface capabilities.
// Choosing the transform that leads to optimal presentation leads to distortion that makes the application unusable,
// as the rotation of all the content is not handled at the moment.
//
// VK_SUBOPTIMAL_KHR is accepted as a successful case even if it's not the most efficient solution to work around this
// problem. This behavior should not be changed unless the swap chain recreation uses the current transform bits, as
// it'll lead to very low performance in Android by entering an endless loop where it'll always resize the swap chain
// every frame.

I've verified this fixes the issue in Android for me at least. The easiest way to spot the error was that the frame time stats were completely wrong as the swap chain was constantly getting trashed.

@DarioSamo DarioSamo requested a review from a team as a code owner February 15, 2024 13:55
@DarioSamo DarioSamo force-pushed the vk_present_suboptimal_fix branch from 262646e to 24fcee6 Compare February 15, 2024 13:59
@akien-mga akien-mga added this to the 4.3 milestone Feb 15, 2024
@akien-mga akien-mga changed the title Handle VK_SUBOPTIMAL_KHR as a valid error code to fix Android performance. Handle VK_SUBOPTIMAL_KHR as a valid error code to fix Android performance. Feb 15, 2024
@akien-mga akien-mga merged commit 564af14 into godotengine:master Feb 16, 2024
16 checks passed
@akien-mga
Copy link
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.

Android low FPS and GPU timer not updating after 73eff10
3 participants