Treat VK_SUBOPTIMAL_KHR as VK_SUCCESS on Android. (#3525)

This commit is contained in:
James0124 authored and GitHub committed 2023-02-27 10:52:09 +01:00
1 parent e6de03134f
commit 9dc834a0ac
3 files changed
+14

No files matched your search

+4
View File
@@ -109,6 +109,10 @@ By @teoxoy in [#3436](https://github.com/gfx-rs/wgpu/pull/3436)
- `copyTextureToTexture` src/dst aspects must both refer to all aspects of src/dst format. By @teoxoy in [#3431](https://github.com/gfx-rs/wgpu/pull/3431)
- Validate before extracting texture selectors. By @teoxoy in [#3487](https://github.com/gfx-rs/wgpu/pull/3487)
#### Vulkan
- Treat `VK_SUBOPTIMAL_KHR` as `VK_SUCCESS` on Android. By @James2022-rgb in [#3525](https://github.com/gfx-rs/wgpu/pull/3525)
## wgpu-0.15.0 (2023-01-25)
### Major Changes
+5
View File
@@ -758,6 +758,11 @@ impl crate::Surface<super::Api> for super::Surface {
sc.functor
.acquire_next_image(sc.raw, timeout_ns, vk::Semaphore::null(), sc.fence)
} {
// We treat `VK_SUBOPTIMAL_KHR` as `VK_SUCCESS` on Android.
// See the comment in `Queue::present`.
#[cfg(target_os = "android")]
Ok((index, _)) => (index, false),
#[cfg(not(target_os = "android"))]
Ok(pair) => pair,
Err(error) => {
return match error {
+5
View File
@@ -595,6 +595,11 @@ impl crate::Queue<Api> for Queue {
})?
};
if suboptimal {
// We treat `VK_SUBOPTIMAL_KHR` as `VK_SUCCESS` on Android.
// On Android 10+, libvulkan's `vkQueuePresentKHR` implementation returns `VK_SUBOPTIMAL_KHR` if not doing pre-rotation
// (i.e `VkSwapchainCreateInfoKHR::preTransform` not being equal to the current device orientation).
// This is always the case when the device orientation is anything other than the identity one, as we unconditionally use `VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR`.
#[cfg(not(target_os = "android"))]
log::warn!("Suboptimal present of frame {}", texture.index);
}
Ok(())