mirror of
https://github.com/Nexoniarz/Fry3DX.git
synced 2026-11-03 04:24:26 +00:00
Phone: turns with the phone (portrait layout), fullscreen, picture the right way up; tap/drag fixes for touch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NMSrd5oe1GpUD7E6d825KP
This commit is contained in:
parent
5d4ff6338a
commit
a5e0d2a9eb
5 changed files with 87 additions and 16 deletions
|
|
@ -227,6 +227,9 @@ bool Device::createSwapchain() {
|
|||
vkDeviceWaitIdle(device_);
|
||||
VkSwapchainKHR old = swapchain_;
|
||||
auto sc = vkb::SwapchainBuilder(physical_, device_, surface_)
|
||||
#if defined(__ANDROID__) // (the compositor turns the picture with the phone: drawn as it's seen)
|
||||
.set_pre_transform_flags(VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
|
||||
#endif
|
||||
.set_desired_format({VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR})
|
||||
.set_desired_present_mode(vsync_ ? VK_PRESENT_MODE_FIFO_KHR : VK_PRESENT_MODE_MAILBOX_KHR)
|
||||
.add_fallback_present_mode(vsync_ ? VK_PRESENT_MODE_FIFO_KHR : VK_PRESENT_MODE_IMMEDIATE_KHR)
|
||||
|
|
@ -312,6 +315,13 @@ void Device::endFrame() {
|
|||
pi.pSwapchains = &swapchain_;
|
||||
pi.pImageIndices = &imageIndex_;
|
||||
VkResult r = vkQueuePresentKHR(queue_, &pi);
|
||||
#if defined(__ANDROID__) // (suboptimal every frame while the phone's turned: the compositor turns it; only a new size matters)
|
||||
if (r == VK_SUBOPTIMAL_KHR) {
|
||||
uint32_t w = 0, h = 0;
|
||||
window_->pixelSize(w, h);
|
||||
if (w == extent_.width && h == extent_.height) r = VK_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
if (r == VK_ERROR_OUT_OF_DATE_KHR || r == VK_SUBOPTIMAL_KHR) swapchainDirty_ = true;
|
||||
else VK_CHECK(r);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue