From f76e85840af11ac519a643006c23ff3ff888f50b Mon Sep 17 00:00:00 2001 From: Yu Li Date: Mon, 9 Dec 2024 09:29:09 +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..1248033b 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 out_handle_param_name = cur_cmd.params[-2].name + HandleState* const parentHandleState = GetHandleState(HandleStateKey{HandleToInt(/*{ first_handle_name }*/), XR_OBJECT_TYPE_SESSION}); + RegisterHandleState(parentHandleState->CloneForChild(HandleToInt(* /*{ out_handle_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.