Skip to content

Android: window and Vulkan swap chain support - #51

Open
ASDAlexander77 wants to merge 1 commit into
NVIDIA-RTX:mainfrom
ASDAlexander77:android-window
Open

ASDAlexander77 wants to merge 1 commit into
NVIDIA-RTX:mainfrom
ASDAlexander77:android-window

Conversation

@ASDAlexander77

@ASDAlexander77 ASDAlexander77 commented Oct 8, 2026 •

Copy link
Copy Markdown

Changes needed to run Donut's Vulkan backend on Android (GLFW NativeActivity window):

  • DeviceManager.cpp: don't force the X11 GLFW platform on Android; leave the main loop before rendering a frame once the window is closing (on Android the surface is gone when the activity stops).
  • DeviceManager_VK.cpp:
    • swap chain creation uses the surface's capabilities: composite alpha (Android surfaces often only support inherit), present mode fallback (FIFO always; mailbox when immediate is missing), and clamped image count;
    • present/acquire semaphores are created per swap chain image in createSwapChain, so a recreated swap chain with more images (mailbox on Android) has enough;
    • keep RGBA swap chain formats on Android (no BGRA formats there);
    • don't recreate a swap chain that is only suboptimal on Android: with an identity pre-transform a rotated display reports it permanently, so recreating just loops;
    • the 'unsupported swap chain format' message lists the formats the surface does offer.

Non-Android behaviour is unchanged apart from the extra diagnostics and the semaphore creation moving into createSwapChain.

🤖 Generated with Claude Code

Do not force the X11 GLFW platform on Android; stop before a frame once the window is closing; take the surface's alpha, present modes and image count into account when creating the swap chain (create semaphores for every swap chain image, also after recreation); keep RGBA swap chain formats on Android; do not recreate a suboptimal swap chain on Android, where a rotated display always reports it; list the available surface formats when the requested one is missing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ASDAlexander77

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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

Successfully merging this pull request may close these issues.

1 participant