From 3c609a9bf9398b02c8130552d3621dc9020762a8 Mon Sep 17 00:00:00 2001 From: Yahan Zhou Date: Mon, 10 Jun 2024 10:21:17 -0700 Subject: [PATCH] Fix handle create mismatch for Vulkan snapshot In our implementation, VkQueue is created in vkCreateDevice instead of vkGetDeviceQueue. We will need to track their creation API properly, otherwise there will be a name mismatch on snapshot load. This will result in a crash during snapshot load with -guest-angle. This commit marks their creation API properly. Same thing applies for VkDescriptorSet. Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- src/gfxstream/codegen/scripts/cereal/decodersnapshot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py b/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py index ff3b40be4a2..b63345dda19 100644 --- a/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py +++ b/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py @@ -196,8 +196,15 @@ delayedDestroys = [ "vkDestroyShaderModule", ] +# The following types are created and cached by other commands. +# Thus we should not snapshot their "create" commands. +skipCreatorSnapshotTypes = [ + "VkQueue", # created by vkCreateDevice + "VkDescriptorSet", # created by vkCreateDescriptorPool +] + def is_state_change_operation(api, param): - if param.isCreatedBy(api): + if param.isCreatedBy(api) and param.typeName not in skipCreatorSnapshotTypes: return True if api.name in apiChangeState: if param.paramName == apiChangeState[api.name].vk_object: