Skip to content

vulkan: Fix state snapshot capture on Android - #30

Open
olehkuznetsov wants to merge 1 commit into
android-graphics:devfrom
olehkuznetsov:fix-capture-and-frame-looping
Open

vulkan: Fix state snapshot capture on Android#30
olehkuznetsov wants to merge 1 commit into
android-graphics:devfrom
olehkuznetsov:fix-capture-and-frame-looping

Conversation

@olehkuznetsov

@olehkuznetsov olehkuznetsov commented Aug 11, 2026

Copy link
Copy Markdown

Summary

This PR addresses state snapshot capture crashes on Android (vkGetDeviceQueue loader crashes and invalid queue family indexing):

  • Queue Family Indices Tracking: InitializeState<VkPhysicalDevice, DeviceWrapper, VkDeviceCreateInfo> initializes wrapper->queue_family_indices from pQueueCreateInfos.
  • Queue Family Index Validation: Added GetValidQueueFamilyIndex validator in vulkan_handle_wrapper_util.h to prevent VK_QUEUE_FAMILY_IGNORED (~0U), VK_QUEUE_FAMILY_EXTERNAL, or invalid queue family indices from being passed to VulkanResourcesUtil.
  • Queue Handle Reuse & Deduplication: Added VulkanResourcesUtil::SetQueue and RegisterDeviceQueues to register existing valid VkQueue handles from device_wrapper->child_queues rather than calling vkGetDeviceQueue on Android (which crashes the Android Vulkan loader).

Testing

  • Captured 200-frame state snapshot of Unity Coop benchmark app (unity_coop_200.gfxr) on Pixel 11 Pro Fold.
  • Verified state snapshot serialization and resource dumping without crashes.

@olehkuznetsov
olehkuznetsov force-pushed the fix-capture-and-frame-looping branch 4 times, most recently from f9fe548 to 4b57b6c Compare August 13, 2026 14:42
@olehkuznetsov olehkuznetsov changed the title vulkan: Fix state snapshot capture on Android and frame looping replay synchronization vulkan: Fix state snapshot capture on Android Aug 13, 2026
- Initialize DeviceWrapper queue_family_indices from VkDeviceCreateInfo to track valid queue families during state snapshot.
- Add GetValidQueueFamilyIndex validator to prevent VK_QUEUE_FAMILY_IGNORED / invalid indices from being passed to VulkanResourcesUtil.
- Add VulkanResourcesUtil::SetQueue and register existing child queue handles during state snapshotting and import fd processing, avoiding unneeded vkGetDeviceQueue calls that crash the Android Vulkan loader.
- Add RegisterDeviceQueues helper to deduplicate queue registration across state writer and capture manager.
@olehkuznetsov
olehkuznetsov force-pushed the fix-capture-and-frame-looping branch from 4b57b6c to fb5d0f8 Compare August 13, 2026 17:15
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