88#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
89 void destroySwapchain();
90 void setErrorString(XrResult
result,
const char *callName);
91 void checkXrExtensions(
const char* layerName,
int indent = 0);
94 XrResult createXrInstance();
95 void checkXrInstance();
97 void setupDebugMessenger();
99 XrResult initializeSystem();
101 void checkViewConfiguration();
102 bool checkXrResult(
const XrResult &
result);
103 void checkEnvironmentBlendMode(XrViewConfigurationType
type);
105 bool setupGraphics();
107#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
108 void checkReferenceSpaces();
109 bool isReferenceSpaceAvailable(XrReferenceSpaceType
type);
111 bool setupAppSpace();
112 void updateAppSpace(XrTime predictedDisplayTime);
113 bool setupViewSpace();
114 bool resetEmulatedFloorHeight(XrTime predictedDisplayTime);
116 void createSwapchains();
119 void processXrEvents();
120#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
121 void pollEvents(
bool *exitRenderLoop,
bool *requestRestart);
125#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
126 bool renderLayer(XrTime predictedDisplayTime,
127 XrDuration predictedDisplayPeriod,
128 XrCompositionLayerProjection &
layer);
129 void doRender(
const XrSwapchainSubImage &subImage,
130 const XrSwapchainImageBaseHeader *swapchainImage,
131 const XrSwapchainImageBaseHeader *depthSwapchainImage =
nullptr);
134 void preSetupQuickScene();
135 bool setupQuickScene();
136#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
138 void updateCameraNonMultiview(
int eye,
const XrCompositionLayerProjectionView &layerView);
139 void updateCameraMultiview(
int projectionLayerViewStartIndex,
int count);
143 bool supportsPassthrough()
const;
145#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
146 void setupMetaQuestColorSpaces();
147 void setupMetaQuestRefreshRates();
148 void setupMetaQuestFoveation();
151 XrPassthroughFB m_passthroughFeature{XR_NULL_HANDLE};
152 void createMetaQuestPassthrough();
153 void destroyMetaQuestPassthrough();
154 void startMetaQuestPassthrough();
155 void pauseMetaQuestPassthrough();
157 XrPassthroughLayerFB m_passthroughLayer{XR_NULL_HANDLE};
158 void createMetaQuestPassthroughLayer();
159 void destroyMetaQuestPassthroughLayer();
160 void pauseMetaQuestPassthroughLayer();
161 void resumeMetaQuestPassthroughLayer();
163 XrInstance m_instance{XR_NULL_HANDLE};
165 XrSpace m_appSpace{XR_NULL_HANDLE};
166 XrReferenceSpaceType m_requestedReferenceSpace = XR_REFERENCE_SPACE_TYPE_STAGE;
167 XrReferenceSpaceType m_referenceSpace = XR_REFERENCE_SPACE_TYPE_LOCAL;
168 bool m_isEmulatingLocalFloor =
false;
169 bool m_isFloorResetPending =
false;
170 XrSpace m_viewSpace{XR_NULL_HANDLE};
171 XrFormFactor m_formFactor{XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY};
172 XrViewConfigurationType m_viewConfigType{XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO};
173 XrEnvironmentBlendMode m_environmentBlendMode{XR_ENVIRONMENT_BLEND_MODE_OPAQUE};
174 XrSystemId m_systemId{XR_NULL_SYSTEM_ID};
176 QVector<XrReferenceSpaceType> m_availableReferenceSpace;
178#ifdef XR_EXT_debug_utils
179 XrDebugUtilsMessengerEXT m_debugMessenger = XR_NULL_HANDLE;
180 PFN_xrDestroyDebugUtilsMessengerEXT m_xrDestroyDebugUtilsMessengerEXT =
nullptr;
190#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
195#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
196 XrTime m_previousTime = 0;
206 bool m_multiviewRendering =
false;
207#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
208 QVector<XrViewConfigurationView> m_configViews;
209 QVector<XrCompositionLayerProjectionView> m_projectionLayerViews;
210 QVector<XrCompositionLayerDepthInfoKHR> m_layerDepthInfos;
211 QVector<Swapchain> m_swapchains;
212 QVector<Swapchain> m_depthSwapchains;
213 QMap<XrSwapchain, QVector<XrSwapchainImageBaseHeader*>> m_swapchainImages;
214 QMap<XrSwapchain, QVector<XrSwapchainImageBaseHeader*>> m_depthSwapchainImages;
215 QVector<XrView> m_views;
217 int64_t m_colorSwapchainFormat = -1;
218 int64_t m_depthSwapchainFormat = -1;
221#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
223 XrSessionState m_sessionState{XR_SESSION_STATE_UNKNOWN};
225 bool m_sessionRunning{
false};
227#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
228 XrEventDataBuffer m_eventDataBuffer;
231 bool m_enablePassthrough =
false;
232 bool m_passthroughSupported =
false;
233#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
234 bool m_spaceExtensionSupported =
false;
236 bool m_colorspaceExtensionSupported =
false;
237 bool m_displayRefreshRateExtensionSupported =
false;
238 bool m_foveationExtensionSupported =
false;
239 XrFoveationLevelFB m_foveationLevel = XR_FOVEATION_LEVEL_HIGH_FB;
240 bool m_compositionLayerDepthSupported =
false;
241 bool m_submitLayerDepth =
false;
242 bool m_handtrackingExtensionSupported =
false;
243 bool m_handtrackingAimExtensionSupported =
false;
245#ifdef XR_USE_PLATFORM_ANDROID
256#if defined(Q_NO_TEMPORARY_DISABLE_XR_API)
257#if QT_CONFIG(graphicsframecapture)
258 std::unique_ptr<QGraphicsFrameCapture> m_frameCapture;
262#if defined(Q_OS_VISIONOS)