Treat VK_SUBOPTIMAL_KHR
as VK_SUCCESS
on Android.
#3525
Merged
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.
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
Addresses issue #3345.
Description
This PR makes is so that
vkQueuePresentKHR
'sVK_SUBOPTIMAL_KHR
is treated asVK_SUCCESS
(i.e ignored and not logged) on Android.On Android 10+,
vkQueuePresentKHR
returnsVK_SUBOPTIMAL_KHR
if the swapchain'sVkSwapchainCreateInfoKHR::preTransform
does not match the device's current orientation.This is always the case in wgpu when the device orientation is anything other than the identity one,
because we unconditionally use
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
when creating the swapchain.The assumption is that on Android, as discussed in the issue,
VK_SUBOPTIMAL_KHR
is only returned when the device's current orientation doesn't matchVkSwapchainCreateInfoKHR::preTransform
.https://developer.android.com/games/optimize/vulkan-prerotation#detect_device_orientation_changes
The only code path that returns
VK_SUBOPTIMAL_KHR
in Android libvulkan'svkQueuePresentKHR
implementation:https://android.googlesource.com/platform/frameworks/native/+/master/vulkan/libvulkan/swapchain.cpp#2021
More in-detail description of the problem in the connected issue.
Testing
Tested on my Galaxy S20 Ultra 5G (Adreno 650), Android 10, that the log spam is no longer exhibited.