The open source OpenXR runtime

doc: Document !2129

authored by

Pingping Meng and committed by
pingping meng
b5df7f17 fd816c83

+47 -45
+1
doc/changes/state_trackers/mr.2129.md
··· 1 + OpenXR: Add extension XR_FB_composition_layer_depth_test.
+15 -15
src/xrt/include/xrt/xrt_compositor.h
··· 124 124 */ 125 125 XRT_LAYER_COMPOSITION_ADVANCED_BLENDING_BIT = 1u << 9u, 126 126 127 - /*! 127 + /*! 128 128 * Depth testing is requested when composing this layer if this flag is set, 129 129 * see XrCompositionLayerDepthTestFB. 130 130 */ 131 - XRT_LAYER_COMPOSITION_DEPTH_TEST = 1u << 10u, 131 + XRT_LAYER_COMPOSITION_DEPTH_TEST = 1u << 10u, 132 132 }; 133 133 134 134 /*! ··· 136 136 */ 137 137 enum xrt_compare_op_fb 138 138 { 139 - XRT_COMPARE_OP_NEVER_FB = 0, 140 - XRT_COMPARE_OP_LESS_FB = 1, 141 - XRT_COMPARE_OP_EQUAL_FB = 2, 142 - XRT_COMPARE_OP_LESS_OR_EQUAL_FB = 3, 143 - XRT_COMPARE_OP_GREATER_FB = 4, 144 - XRT_COMPARE_OP_NOT_EQUAL_FB = 5, 145 - XRT_COMPARE_OP_GREATER_OR_EQUAL_FB = 6, 146 - XRT_COMPARE_OP_ALWAYS_FB = 7, 147 - XRT_COMPARE_OP_MAX_ENUM_FB = 0x7FFFFFFF 139 + XRT_COMPARE_OP_NEVER_FB = 0, 140 + XRT_COMPARE_OP_LESS_FB = 1, 141 + XRT_COMPARE_OP_EQUAL_FB = 2, 142 + XRT_COMPARE_OP_LESS_OR_EQUAL_FB = 3, 143 + XRT_COMPARE_OP_GREATER_FB = 4, 144 + XRT_COMPARE_OP_NOT_EQUAL_FB = 5, 145 + XRT_COMPARE_OP_GREATER_OR_EQUAL_FB = 6, 146 + XRT_COMPARE_OP_ALWAYS_FB = 7, 147 + XRT_COMPARE_OP_MAX_ENUM_FB = 0x7FFFFFFF 148 148 }; 149 149 150 150 /*! ··· 251 251 252 252 struct xrt_layer_depth_test_data 253 253 { 254 - bool depth_mask; 255 - enum xrt_compare_op_fb compare_op; 254 + bool depth_mask; 255 + enum xrt_compare_op_fb compare_op; 256 256 }; 257 257 258 258 /*! ··· 386 386 */ 387 387 enum xrt_layer_composition_flags flags; 388 388 389 - /*! 389 + /*! 390 390 * Depth test data 391 391 */ 392 - struct xrt_layer_depth_test_data depth_test; 392 + struct xrt_layer_depth_test_data depth_test; 393 393 394 394 /*! 395 395 * Whether the main compositor should flip the direction of y when
+4 -3
src/xrt/state_trackers/oxr/oxr_extension_support.h
··· 419 419 #endif 420 420 421 421 /* 422 - * XR_FB_composition_layer_depth_test 423 - */ 422 + * XR_FB_composition_layer_depth_test 423 + */ 424 424 #if defined(XR_FB_composition_layer_depth_test) && defined(XRT_FEATURE_OPENXR_LAYER_FB_DEPTH_TEST) 425 425 #define OXR_HAVE_FB_composition_layer_depth_test 426 - #define OXR_EXTENSION_SUPPORT_FB_composition_layer_depth_test(_) _(FB_composition_layer_depth_test, FB_COMPOSITION_LAYER_DEPTH_TEST) 426 + #define OXR_EXTENSION_SUPPORT_FB_composition_layer_depth_test(_) \ 427 + _(FB_composition_layer_depth_test, FB_COMPOSITION_LAYER_DEPTH_TEST) 427 428 #else 428 429 #define OXR_EXTENSION_SUPPORT_FB_composition_layer_depth_test(_) 429 430 #endif
+27 -27
src/xrt/state_trackers/oxr/oxr_session_frame_end.c
··· 132 132 static enum xrt_compare_op_fb 133 133 convert_compare_op(XrCompareOpFB xr_compare_op) 134 134 { 135 - switch (xr_compare_op) { 136 - case XR_COMPARE_OP_NEVER_FB: return XRT_COMPARE_OP_NEVER_FB; 137 - case XR_COMPARE_OP_LESS_FB: return XRT_COMPARE_OP_LESS_FB; 138 - case XR_COMPARE_OP_EQUAL_FB: return XRT_COMPARE_OP_EQUAL_FB; 139 - case XR_COMPARE_OP_LESS_OR_EQUAL_FB: return XRT_COMPARE_OP_LESS_OR_EQUAL_FB; 140 - case XR_COMPARE_OP_GREATER_FB: return XRT_COMPARE_OP_GREATER_FB; 141 - case XR_COMPARE_OP_NOT_EQUAL_FB: return XRT_COMPARE_OP_NOT_EQUAL_FB; 142 - case XR_COMPARE_OP_GREATER_OR_EQUAL_FB: return XRT_COMPARE_OP_GREATER_OR_EQUAL_FB; 143 - case XR_COMPARE_OP_ALWAYS_FB: return XRT_COMPARE_OP_ALWAYS_FB; 144 - default: return XRT_COMPARE_OP_MAX_ENUM_FB; 145 - } 135 + switch (xr_compare_op) { 136 + case XR_COMPARE_OP_NEVER_FB: return XRT_COMPARE_OP_NEVER_FB; 137 + case XR_COMPARE_OP_LESS_FB: return XRT_COMPARE_OP_LESS_FB; 138 + case XR_COMPARE_OP_EQUAL_FB: return XRT_COMPARE_OP_EQUAL_FB; 139 + case XR_COMPARE_OP_LESS_OR_EQUAL_FB: return XRT_COMPARE_OP_LESS_OR_EQUAL_FB; 140 + case XR_COMPARE_OP_GREATER_FB: return XRT_COMPARE_OP_GREATER_FB; 141 + case XR_COMPARE_OP_NOT_EQUAL_FB: return XRT_COMPARE_OP_NOT_EQUAL_FB; 142 + case XR_COMPARE_OP_GREATER_OR_EQUAL_FB: return XRT_COMPARE_OP_GREATER_OR_EQUAL_FB; 143 + case XR_COMPARE_OP_ALWAYS_FB: return XRT_COMPARE_OP_ALWAYS_FB; 144 + default: return XRT_COMPARE_OP_MAX_ENUM_FB; 145 + } 146 146 } 147 147 148 148 static enum xrt_layer_eye_visibility ··· 299 299 fill_in_depth_test(struct oxr_session *sess, const XrCompositionLayerBaseHeader *layer, struct xrt_layer_data *data) 300 300 { 301 301 #ifdef OXR_HAVE_FB_composition_layer_depth_test 302 - // Is the extension enabled? 303 - if (!sess->sys->inst->extensions.FB_composition_layer_depth_test) { 304 - return; 305 - } 306 - const XrCompositionLayerDepthTestFB *depthTest = OXR_GET_INPUT_FROM_CHAIN( 307 - layer, (XrStructureType)XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_FB, XrCompositionLayerDepthTestFB); 308 - if (depthTest != NULL) { 302 + // Is the extension enabled? 303 + if (!sess->sys->inst->extensions.FB_composition_layer_depth_test) { 304 + return; 305 + } 306 + const XrCompositionLayerDepthTestFB *depthTest = OXR_GET_INPUT_FROM_CHAIN( 307 + layer, (XrStructureType)XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_FB, XrCompositionLayerDepthTestFB); 308 + if (depthTest != NULL) { 309 309 data->flags |= XRT_LAYER_COMPOSITION_DEPTH_TEST; 310 - data->depth_test.depth_mask = depthTest->depthMask; 311 - data->depth_test.compare_op = convert_compare_op(depthTest->compareOp); 312 - } 310 + data->depth_test.depth_mask = depthTest->depthMask; 311 + data->depth_test.compare_op = convert_compare_op(depthTest->compareOp); 312 + } 313 313 #endif // OXR_HAVE_FB_composition_layer_depth_test 314 314 } 315 315 ··· 1181 1181 fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)quad, &data); 1182 1182 fill_in_blend_factors(sess, (XrCompositionLayerBaseHeader *)quad, &data); 1183 1183 fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)quad, &data); 1184 - fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)quad, &data); 1184 + fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)quad, &data); 1185 1185 1186 1186 xrt_result_t xret = xrt_comp_layer_quad(xc, head, sc->swapchain, &data); 1187 1187 OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_quad); ··· 1278 1278 1279 1279 if (d_scs[0] != NULL && d_scs[1] != NULL) { 1280 1280 #ifdef OXR_HAVE_KHR_composition_layer_depth 1281 - fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)proj, &data); 1281 + fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)proj, &data); 1282 1282 data.type = XRT_LAYER_STEREO_PROJECTION_DEPTH; 1283 1283 xrt_result_t xret = xrt_comp_layer_stereo_projection_depth( // 1284 1284 xc, // compositor ··· 1337 1337 fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)cube, &data); 1338 1338 fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)cube, &data); 1339 1339 fill_in_blend_factors(sess, (XrCompositionLayerBaseHeader *)cube, &data); 1340 - fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)cube, &data); 1340 + fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)cube, &data); 1341 1341 1342 1342 struct xrt_pose pose = { 1343 1343 .orientation = ··· 1404 1404 fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)cylinder, &data); 1405 1405 fill_in_blend_factors(sess, (XrCompositionLayerBaseHeader *)cylinder, &data); 1406 1406 fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)cylinder, &data); 1407 - fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)cylinder, &data); 1407 + fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)cylinder, &data); 1408 1408 1409 1409 xrt_result_t xret = xrt_comp_layer_cylinder(xc, head, sc->swapchain, &data); 1410 1410 OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_cylinder); ··· 1452 1452 fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1453 1453 fill_in_blend_factors(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1454 1454 fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1455 - fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1455 + fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1456 1456 1457 1457 struct xrt_vec2 *scale = (struct xrt_vec2 *)&equirect->scale; 1458 1458 struct xrt_vec2 *bias = (struct xrt_vec2 *)&equirect->bias; ··· 1518 1518 fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1519 1519 fill_in_blend_factors(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1520 1520 fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1521 - fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1521 + fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1522 1522 1523 1523 xrt_result_t xret = xrt_comp_layer_equirect2(xc, head, sc->swapchain, &data); 1524 1524 OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_equirect2);