Merge "[Vulkan Snapshot] tryLock when an API might create extra handles" into main
diff --git a/codegen/vulkan/vulkan-docs-next/scripts/cereal/decodersnapshot.py b/codegen/vulkan/vulkan-docs-next/scripts/cereal/decodersnapshot.py
index 2a5ef47..4495399 100644
--- a/codegen/vulkan/vulkan-docs-next/scripts/cereal/decodersnapshot.py
+++ b/codegen/vulkan/vulkan-docs-next/scripts/cereal/decodersnapshot.py
@@ -300,7 +300,9 @@
             if p.pointerIndirectionLevels > 0:
                 cgen.stmt("if (!%s) return" % access)
             isCreateExtraHandleApi = api.name in apiCrreateExtraHandles
-            if not isCreateExtraHandleApi:
+            if isCreateExtraHandleApi:
+                cgen.stmt("mLock.tryLock()");
+            else:
                 cgen.stmt("android::base::AutoLock lock(mLock)")
             cgen.line("// %s create" % p.paramName)
             if p.isCreatedBy(api):
diff --git a/common/end2end/GfxstreamEnd2EndVkSnapshotPipelineTests.cpp b/common/end2end/GfxstreamEnd2EndVkSnapshotPipelineTests.cpp
index 7bd14a9..be14641 100644
--- a/common/end2end/GfxstreamEnd2EndVkSnapshotPipelineTests.cpp
+++ b/common/end2end/GfxstreamEnd2EndVkSnapshotPipelineTests.cpp
@@ -1258,6 +1258,11 @@
                             TestParams{
                                 .with_gl = false,
                                 .with_vk = true,
+                                .with_features = {"VulkanSnapshots", "VulkanBatchedDescriptorSetUpdate"},
+                            },
+                            TestParams{
+                                .with_gl = false,
+                                .with_vk = true,
                                 .with_features = {"VulkanSnapshots"},
                             },
                         }),
diff --git a/host/vulkan/VkDecoderSnapshot.cpp b/host/vulkan/VkDecoderSnapshot.cpp
index ac10325..6543722 100644
--- a/host/vulkan/VkDecoderSnapshot.cpp
+++ b/host/vulkan/VkDecoderSnapshot.cpp
@@ -143,6 +143,7 @@
                         VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo,
                         const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) {
         if (!pDevice) return;
+        mLock.tryLock();
         // pDevice create
         mReconstruction.addHandles((const uint64_t*)pDevice, 1);
         mReconstruction.addHandleDependency((const uint64_t*)pDevice, 1,
@@ -751,6 +752,7 @@
                                 const VkAllocationCallbacks* pAllocator,
                                 VkDescriptorPool* pDescriptorPool) {
         if (!pDescriptorPool) return;
+        mLock.tryLock();
         // pDescriptorPool create
         mReconstruction.addHandles((const uint64_t*)pDescriptorPool, 1);
         mReconstruction.addHandleDependency((const uint64_t*)pDescriptorPool, 1,