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

VkResult is VK_SUBOPTIMAL_KHR in Android causing SwapChain to be recreated every frame #1150

Open
HakimHauston opened this issue Sep 18, 2024 · 4 comments
Assignees

Comments

@HakimHauston
Copy link

swapChain.queuePresent in VulkanExampleBase::submitFrame returns VK_SUBOPTIMAL_KHR in Android.

This causes windowResize() to be called every frame, re-creating the entire swapChain.

What is the cause of this error? And is there a way to prevent this?

Any input is highly appreciated...

@SaschaWillems
Copy link
Owner

What device does this happen on? I can't replicate this on my Pixel 4a, but I could test with other devices.

And does this happen all the time, or only under certain conditions?

@HakimHauston
Copy link
Author

Hi @SaschaWillems

Thanks for the fast reply and willingness to take a look... I am facing the errors on all the devices I've tested with:

  • Pixel 6 Pro (Mali-G78 MP20) - Android 14
  • Pixel 9 Pro Fold (Mali-G715 MC7) - Android 15 Beta
  • OnePlus Open (Adreno 740) - Android 13
  • Vivo x90 Pro (Immortalis-G715 MC11) - Android 14

Upon hearing your positive result on Pixel 4a, I grabbed a device and run it but get the same error, this is the screenshot

The error happened all the time, starting from the first frame, I have just sync-ed to the latest commit 1615f95 but this issue also exist in my previous base as early as July (8b4ee59)

@w-pearson
Copy link
Contributor

I noticed this a while ago but never got around to reporting it. It depends on whether the device is held portrait or landscape (I believe the issue happens with landscape, but I'm not 100% sure of this).

VK_SUBOPTIMAL_KHR is generated by Android at https://android.googlesource.com/platform/frameworks/native/+/7a8d900e3d534177284184660cb4c587632bb658/vulkan/libvulkan/swapchain.cpp#2533. https://github.com/KhronosGroup/Vulkan-Samples/tree/main/samples/performance/surface_rotation documents how you can use preTransform to avoid the issue.

@SaschaWillems SaschaWillems self-assigned this Oct 6, 2024
@SaschaWillems
Copy link
Owner

That explains why I don't see this. I usually test in portrait mode. Thanks for the links, will take a look and hopefully fix this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants