The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

st/oxr: Add extension XR_KHR_composition_layer_color_scale_bias

authored by

Weijie Wang and committed by
Jakob Bornecrantz
fa85b5e9 14f31f0e

+72
+4
CMakeLists.txt
··· 415 415 if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH) 416 416 set(XRT_FEATURE_OPENXR_LAYER_DEPTH ON) 417 417 endif() 418 + if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS) 419 + set(XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS OFF) 420 + endif() 418 421 if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_CUBE) 419 422 set(XRT_FEATURE_OPENXR_LAYER_CUBE OFF) 420 423 endif() ··· 633 636 message(STATUS "# FEATURE_OPENXR_INTERACTION_MSFT_HAND: ${XRT_FEATURE_OPENXR_INTERACTION_MSFT_HAND}") 634 637 message(STATUS "# FEATURE_OPENXR_INTERACTION_OPPO: ${XRT_FEATURE_OPENXR_INTERACTION_OPPO}") 635 638 message(STATUS "# FEATURE_OPENXR_INTERACTION_WINMR: ${XRT_FEATURE_OPENXR_INTERACTION_WINMR}") 639 + message(STATUS "# FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS: ${XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS}") 636 640 message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}") 637 641 message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE_OPENXR_LAYER_CYLINDER}") 638 642 message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}")
+1
scripts/generate_oxr_ext_support.py
··· 36 36 ['XR_KHR_android_create_instance', 'XR_USE_PLATFORM_ANDROID'], 37 37 ['XR_KHR_android_thread_settings', 'XR_USE_PLATFORM_ANDROID'], 38 38 ['XR_KHR_binding_modification'], 39 + ['XR_KHR_composition_layer_color_scale_bias', 'XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS'], 39 40 ['XR_KHR_composition_layer_cube', 'XRT_FEATURE_OPENXR_LAYER_CUBE'], 40 41 ['XR_KHR_composition_layer_cylinder', 'XRT_FEATURE_OPENXR_LAYER_CYLINDER'], 41 42 ['XR_KHR_composition_layer_depth', 'XRT_FEATURE_OPENXR_LAYER_DEPTH'],
+17
src/xrt/include/xrt/xrt_compositor.h
··· 97 97 * adjusted for the IPD. 98 98 */ 99 99 XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT = 1u << 3u, 100 + 101 + /*! 102 + * If this flag is set the compositor should use the scale and bias 103 + * from the @ref xrt_layer_data struct. 104 + */ 105 + XRT_LAYER_COMPOSITION_COLOR_BIAS_SCALE = 1u << 4u, 106 + 100 107 }; 101 108 102 109 /*! ··· 316 323 * compositor. 317 324 */ 318 325 bool flip_y; 326 + 327 + /*! 328 + * Modulate the color sourced from the images. 329 + */ 330 + struct xrt_colour_rgba_f32 color_scale; 331 + 332 + /*! 333 + * Modulate the color sourced from the images. 334 + */ 335 + struct xrt_colour_rgba_f32 color_bias; 319 336 320 337 /*! 321 338 * Union of data values for the various layer types.
+1
src/xrt/include/xrt/xrt_config_build.h.cmake_in
··· 40 40 #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_MSFT_HAND 41 41 #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_OPPO 42 42 #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_WINMR 43 + #cmakedefine XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS 43 44 #cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE 44 45 #cmakedefine XRT_FEATURE_OPENXR_LAYER_CYLINDER 45 46 #cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH
+13
src/xrt/state_trackers/oxr/oxr_extension_support.h
··· 55 55 56 56 57 57 /* 58 + * XR_KHR_composition_layer_color_scale_bias 59 + */ 60 + #if defined(XR_KHR_composition_layer_color_scale_bias) && defined(XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS) 61 + #define OXR_HAVE_KHR_composition_layer_color_scale_bias 62 + #define OXR_EXTENSION_SUPPORT_KHR_composition_layer_color_scale_bias(_) \ 63 + _(KHR_composition_layer_color_scale_bias, KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS) 64 + #else 65 + #define OXR_EXTENSION_SUPPORT_KHR_composition_layer_color_scale_bias(_) 66 + #endif 67 + 68 + 69 + /* 58 70 * XR_KHR_composition_layer_cube 59 71 */ 60 72 #if defined(XR_KHR_composition_layer_cube) && defined(XRT_FEATURE_OPENXR_LAYER_CUBE) ··· 544 556 OXR_EXTENSION_SUPPORT_KHR_android_create_instance(_) \ 545 557 OXR_EXTENSION_SUPPORT_KHR_android_thread_settings(_) \ 546 558 OXR_EXTENSION_SUPPORT_KHR_binding_modification(_) \ 559 + OXR_EXTENSION_SUPPORT_KHR_composition_layer_color_scale_bias(_) \ 547 560 OXR_EXTENSION_SUPPORT_KHR_composition_layer_cube(_) \ 548 561 OXR_EXTENSION_SUPPORT_KHR_composition_layer_cylinder(_) \ 549 562 OXR_EXTENSION_SUPPORT_KHR_composition_layer_depth(_) \
+36
src/xrt/state_trackers/oxr/oxr_session_frame_end.c
··· 131 131 return visibility; 132 132 } 133 133 134 + XRT_MAYBE_UNUSED static void 135 + fill_in_xr_color(const struct XrColor4f *src, struct xrt_colour_rgba_f32 *dest) 136 + { 137 + dest->r = src->r; 138 + dest->g = src->g; 139 + dest->b = src->b; 140 + dest->a = src->a; 141 + } 142 + 143 + static void 144 + fill_in_color_scale_bias(struct oxr_session *sess, 145 + const XrCompositionLayerBaseHeader *layer, 146 + struct xrt_layer_data *xlayer_data) 147 + { 148 + #ifdef XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS 149 + // Is the extension enabled? 150 + if (!sess->sys->inst->extensions.KHR_composition_layer_color_scale_bias) { 151 + return; 152 + } 153 + 154 + const XrCompositionLayerColorScaleBiasKHR *color_scale_bias = OXR_GET_INPUT_FROM_CHAIN( 155 + layer->next, XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR, XrCompositionLayerColorScaleBiasKHR); 156 + if (color_scale_bias) { 157 + xlayer_data->flags |= XRT_LAYER_COMPOSITION_COLOR_BIAS_SCALE; 158 + fill_in_xr_color(&color_scale_bias->colorScale, &xlayer_data->color_scale); 159 + fill_in_xr_color(&color_scale_bias->colorBias, &xlayer_data->color_bias); 160 + } 161 + #endif // XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS 162 + } 163 + 134 164 static void 135 165 fill_in_sub_image(const struct oxr_swapchain *sc, const XrSwapchainSubImage *oxr_sub, struct xrt_sub_image *xsub) 136 166 { ··· 931 961 data.quad.pose = pose; 932 962 data.quad.size = *size; 933 963 fill_in_sub_image(sc, &quad->subImage, &data.quad.sub); 964 + fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)quad, &data); 934 965 935 966 xrt_result_t xret = xrt_comp_layer_quad(xc, head, sc->swapchain, &data); 936 967 OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_quad); ··· 985 1016 data.stereo.r.pose = pose[1]; 986 1017 fill_in_sub_image(scs[0], &proj->views[0].subImage, &data.stereo.l.sub); 987 1018 fill_in_sub_image(scs[1], &proj->views[1].subImage, &data.stereo.r.sub); 1019 + fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)proj, &data); 988 1020 989 1021 #ifdef XRT_FEATURE_OPENXR_LAYER_DEPTH 990 1022 const XrCompositionLayerDepthInfoKHR *d_l = OXR_GET_INPUT_FROM_CHAIN( ··· 1077 1109 1078 1110 data.cube.sub.image_index = sc->released.index; 1079 1111 data.cube.sub.array_index = cube->imageArrayIndex; 1112 + fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)cube, &data); 1080 1113 1081 1114 struct xrt_pose pose = { 1082 1115 .orientation = ··· 1139 1172 data.cylinder.central_angle = cylinder->centralAngle; 1140 1173 data.cylinder.aspect_ratio = cylinder->aspectRatio; 1141 1174 fill_in_sub_image(sc, &cylinder->subImage, &data.cylinder.sub); 1175 + fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)cylinder, &data); 1142 1176 1143 1177 xrt_result_t xret = xrt_comp_layer_cylinder(xc, head, sc->swapchain, &data); 1144 1178 OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_cylinder); ··· 1182 1216 data.equirect1.pose = pose; 1183 1217 data.equirect1.radius = equirect->radius; 1184 1218 fill_in_sub_image(sc, &equirect->subImage, &data.equirect1.sub); 1219 + fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1185 1220 1186 1221 1187 1222 struct xrt_vec2 *scale = (struct xrt_vec2 *)&equirect->scale; ··· 1244 1279 data.equirect2.upper_vertical_angle = equirect->upperVerticalAngle; 1245 1280 data.equirect2.lower_vertical_angle = equirect->lowerVerticalAngle; 1246 1281 fill_in_sub_image(sc, &equirect->subImage, &data.equirect2.sub); 1282 + fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)equirect, &data); 1247 1283 1248 1284 xrt_result_t xret = xrt_comp_layer_equirect2(xc, head, sc->swapchain, &data); 1249 1285 OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_equirect2);