To create an XrSwapchain object and an Android Surface object call:
// Provided by XR_KHR_android_surface_swapchain XrResult xrCreateSwapchainAndroidSurfaceKHR( XrSession session, const XrSwapchainCreateInfo* info, XrSwapchain* swapchain, jobject* surface);
xrCreateSwapchainAndroidSurfaceKHR creates an XrSwapchain object
swapchain and an Android Surface
jobject returned in
jobject must be valid to be passed back to Java code using JNI and
must be valid to be used with ordinary Android APIs for submitting images
The returned XrSwapchain must be valid to be referenced in
XrSwapchainSubImage structures to show content on the screen.
The width and height passed in XrSwapchainCreateInfo may not be
persistent throughout the life cycle of the created swapchain, since on
Android, the size of the images is controlled by the producer and possibly
changes at any time.
The only function that is allowed to be called on the XrSwapchain returned from this function is xrDestroySwapchain. For example, calling any of the functions xrEnumerateSwapchainImages, xrAcquireSwapchainImage, xrWaitSwapchainImage or xrReleaseSwapchainImage is invalid.
When the application receives the XrEventDataSessionStateChanged event
XR_SESSION_STATE_STOPPING state, it must ensure that no
threads are writing to any of the Android surfaces created with this
extension before calling xrEndSession.
The effect of writing frames to the Surface when the session is in states
xrCreateSwapchainAndroidSurfaceKHR must return the same set of error
codes as xrCreateSwapchain under the same circumstances, plus
XR_ERROR_FUNCTION_UNSUPPORTED in case the function is not supported.
For more information, see the OpenXR Specification
This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.
Copyright 2014-2023 The Khronos Group Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.