From cf9b05d3b03d3a720e91cb260ee003f7ed6dbe09 Mon Sep 17 00:00:00 2001 From: Yu Li Date: Tue, 12 Nov 2024 11:03:08 +0800 Subject: [PATCH] Register handle state for the swapchain created by xrCreateSwapchainAndroidSurfaceKHR --- src/scripts/template_gen_dispatch.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/scripts/template_gen_dispatch.cpp b/src/scripts/template_gen_dispatch.cpp index 57163776..af506855 100644 --- a/src/scripts/template_gen_dispatch.cpp +++ b/src/scripts/template_gen_dispatch.cpp @@ -110,6 +110,17 @@ } //# endif +//## xrCreateSwapchainAndroidSurfaceKHR is a special case because +//## this is a create command but returned swapchain is not the last parameter. +//# set is_create_swapchain_android_surface = ("xrCreateSwapchainAndroidSurfaceKHR" == cur_cmd.name) +//# if is_create_swapchain_android_surface + if (XR_SUCCEEDED(result)) { +//# set penultimate_param_name = cur_cmd.params[-2].name + HandleState* const parentHandleState = GetHandleState(HandleStateKey{HandleToInt(/*{first_handle_name}*/), XR_OBJECT_TYPE_SESSION}); + RegisterHandleState(parentHandleState->CloneForChild(HandleToInt(* /*{penultimate_param_name}*/), XR_OBJECT_TYPE_SWAPCHAIN)); + } +//# endif + //## If this is a xrQuerySpacesFB, we have to create an entry in //## the appropriate unordered_map pointing to the correct dispatch table for //## the newly created objects.