mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
st/oxr: Add extension XR_FB_composition_layer_settings
This commit is contained in:
parent
0a96a0f976
commit
0a6e3dfd49
|
@ -413,6 +413,9 @@ if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_WINMR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Defaults for OpenXR layer support
|
# Defaults for OpenXR layer support
|
||||||
|
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_FB_COMPOSITION_SETTINGS)
|
||||||
|
set(XRT_FEATURE_OPENXR_LAYER_FB_COMPOSITION_SETTINGS OFF)
|
||||||
|
endif()
|
||||||
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH)
|
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH)
|
||||||
set(XRT_FEATURE_OPENXR_LAYER_DEPTH ON)
|
set(XRT_FEATURE_OPENXR_LAYER_DEPTH ON)
|
||||||
endif()
|
endif()
|
||||||
|
@ -646,6 +649,7 @@ message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE
|
||||||
message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}")
|
message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}")
|
||||||
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT1: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT1}")
|
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT1: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT1}")
|
||||||
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}")
|
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}")
|
||||||
|
message(STATUS "# FEATURE_OPENXR_COMPOSITION_LAYER_SETTINGS: ${XRT_FEATURE_OPENXR_LAYER_FB_COMPOSITION_SETTINGS}")
|
||||||
message(STATUS "# FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT ${XRT_FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT}")
|
message(STATUS "# FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT ${XRT_FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT}")
|
||||||
message(STATUS "# FEATURE_OPENXR_OVERLAY: ${XRT_FEATURE_OPENXR_OVERLAY}")
|
message(STATUS "# FEATURE_OPENXR_OVERLAY: ${XRT_FEATURE_OPENXR_OVERLAY}")
|
||||||
message(STATUS "# FEATURE_OPENXR_SPACE_LOCAL_FLOOR: ${XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR}")
|
message(STATUS "# FEATURE_OPENXR_SPACE_LOCAL_FLOOR: ${XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR}")
|
||||||
|
|
|
@ -65,6 +65,7 @@ EXTENSIONS = (
|
||||||
['XR_EXT_palm_pose', 'XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE'],
|
['XR_EXT_palm_pose', 'XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE'],
|
||||||
['XR_EXT_samsung_odyssey_controller', 'XRT_FEATURE_OPENXR_INTERACTION_WINMR'],
|
['XR_EXT_samsung_odyssey_controller', 'XRT_FEATURE_OPENXR_INTERACTION_WINMR'],
|
||||||
['XR_FB_composition_layer_image_layout', 'XRT_FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT'],
|
['XR_FB_composition_layer_image_layout', 'XRT_FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT'],
|
||||||
|
['XR_FB_composition_layer_settings', 'XRT_FEATURE_OPENXR_LAYER_FB_COMPOSITION_SETTINGS'],
|
||||||
['XR_FB_display_refresh_rate', 'XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE'],
|
['XR_FB_display_refresh_rate', 'XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE'],
|
||||||
['XR_ML_ml2_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_ML2'],
|
['XR_ML_ml2_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_ML2'],
|
||||||
['XR_MND_headless', 'XRT_FEATURE_OPENXR_HEADLESS'],
|
['XR_MND_headless', 'XRT_FEATURE_OPENXR_HEADLESS'],
|
||||||
|
|
|
@ -104,6 +104,17 @@ enum xrt_layer_composition_flags
|
||||||
*/
|
*/
|
||||||
XRT_LAYER_COMPOSITION_COLOR_BIAS_SCALE = 1u << 4u,
|
XRT_LAYER_COMPOSITION_COLOR_BIAS_SCALE = 1u << 4u,
|
||||||
|
|
||||||
|
//! Normal super sampling, see XrCompositionLayerSettingsFlagsFB.
|
||||||
|
XRT_COMPOSITION_LAYER_PROCESSING_NORMAL_SUPER_SAMPLING_BIT_FB = 1u << 5u,
|
||||||
|
|
||||||
|
//! Quality super sampling, see XrCompositionLayerSettingsFlagsFB.
|
||||||
|
XRT_COMPOSITION_LAYER_PROCESSING_QUALITY_SUPER_SAMPLING_BIT_FB = 1u << 6u,
|
||||||
|
|
||||||
|
//! Normal sharpening, see XrCompositionLayerSettingsFlagsFB.
|
||||||
|
XRT_COMPOSITION_LAYER_PROCESSING_NORMAL_SHARPENING_BIT_FB = 1u << 7u,
|
||||||
|
|
||||||
|
//! Quality sharpening, see XrCompositionLayerSettingsFlagsFB.
|
||||||
|
XRT_COMPOSITION_LAYER_PROCESSING_QUALITY_SHARPENING_BIT_FB = 1u << 8u,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH
|
#cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT1
|
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT1
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
|
#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
|
||||||
|
#cmakedefine XRT_FEATURE_OPENXR_LAYER_FB_COMPOSITION_SETTINGS
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT
|
#cmakedefine XRT_FEATURE_OPENXR_LAYER_FB_LAYER_IMAGE_LAYOUT
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_OVERLAY
|
#cmakedefine XRT_FEATURE_OPENXR_OVERLAY
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR
|
#cmakedefine XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR
|
||||||
|
|
|
@ -394,6 +394,16 @@
|
||||||
#define OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_)
|
#define OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XR_FB_composition_layer_settings
|
||||||
|
*/
|
||||||
|
#if defined(XR_FB_composition_layer_settings) && defined(XRT_FEATURE_OPENXR_LAYER_FB_COMPOSITION_SETTINGS)
|
||||||
|
#define OXR_HAVE_FB_composition_layer_settings
|
||||||
|
#define OXR_EXTENSION_SUPPORT_FB_composition_layer_settings(_) \
|
||||||
|
_(FB_composition_layer_settings, FB_COMPOSITION_LAYER_SETTINGS)
|
||||||
|
#else
|
||||||
|
#define OXR_EXTENSION_SUPPORT_FB_composition_layer_settings(_)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XR_ML_ml2_controller_interaction
|
* XR_ML_ml2_controller_interaction
|
||||||
|
@ -598,6 +608,7 @@
|
||||||
OXR_EXTENSION_SUPPORT_EXT_palm_pose(_) \
|
OXR_EXTENSION_SUPPORT_EXT_palm_pose(_) \
|
||||||
OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_) \
|
OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_) \
|
||||||
OXR_EXTENSION_SUPPORT_FB_composition_layer_image_layout(_) \
|
OXR_EXTENSION_SUPPORT_FB_composition_layer_image_layout(_) \
|
||||||
|
OXR_EXTENSION_SUPPORT_FB_composition_layer_settings(_) \
|
||||||
OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_) \
|
OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_) \
|
||||||
OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_) \
|
OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_) \
|
||||||
OXR_EXTENSION_SUPPORT_MND_headless(_) \
|
OXR_EXTENSION_SUPPORT_MND_headless(_) \
|
||||||
|
|
|
@ -161,6 +161,30 @@ fill_in_color_scale_bias(struct oxr_session *sess,
|
||||||
#endif // OXR_HAVE_KHR_composition_layer_color_scale_bias
|
#endif // OXR_HAVE_KHR_composition_layer_color_scale_bias
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum xrt_layer_composition_flags
|
||||||
|
convert_layer_settings_flags(XrCompositionLayerSettingsFlagsFB xr_layer_settings_flags)
|
||||||
|
{
|
||||||
|
enum xrt_layer_composition_flags layer_settings_flags = 0;
|
||||||
|
|
||||||
|
if ((xr_layer_settings_flags & XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB) != 0) {
|
||||||
|
layer_settings_flags |= XRT_COMPOSITION_LAYER_PROCESSING_NORMAL_SUPER_SAMPLING_BIT_FB;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((xr_layer_settings_flags & XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB) != 0) {
|
||||||
|
layer_settings_flags |= XRT_COMPOSITION_LAYER_PROCESSING_QUALITY_SUPER_SAMPLING_BIT_FB;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((xr_layer_settings_flags & XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB) != 0) {
|
||||||
|
layer_settings_flags |= XRT_COMPOSITION_LAYER_PROCESSING_NORMAL_SHARPENING_BIT_FB;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((xr_layer_settings_flags & XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB) != 0) {
|
||||||
|
layer_settings_flags |= XRT_COMPOSITION_LAYER_PROCESSING_QUALITY_SHARPENING_BIT_FB;
|
||||||
|
}
|
||||||
|
|
||||||
|
return layer_settings_flags;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_in_y_flip(struct oxr_session *sess, const XrCompositionLayerBaseHeader *layer, struct xrt_layer_data *xlayer_data)
|
fill_in_y_flip(struct oxr_session *sess, const XrCompositionLayerBaseHeader *layer, struct xrt_layer_data *xlayer_data)
|
||||||
{
|
{
|
||||||
|
@ -199,6 +223,23 @@ fill_in_sub_image(const struct oxr_swapchain *sc, const XrSwapchainSubImage *oxr
|
||||||
xsub->norm_rect.y = (float)(rect->offset.h / (double)sc->height);
|
xsub->norm_rect.y = (float)(rect->offset.h / (double)sc->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_in_layer_settings(struct oxr_session *sess,
|
||||||
|
const XrCompositionLayerBaseHeader *layer,
|
||||||
|
struct xrt_layer_data *xlayer_data)
|
||||||
|
{
|
||||||
|
#ifdef OXR_HAVE_FB_composition_layer_settings
|
||||||
|
// Is the extension enabled?
|
||||||
|
if (!sess->sys->inst->extensions.FB_composition_layer_settings) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const XrCompositionLayerSettingsFB *layer_settings =
|
||||||
|
OXR_GET_INPUT_FROM_CHAIN(layer->next, XR_TYPE_COMPOSITION_LAYER_SETTINGS_FB, XrCompositionLayerSettingsFB);
|
||||||
|
if (layer_settings != NULL) {
|
||||||
|
xlayer_data->flags |= convert_layer_settings_flags(layer_settings->layerFlags);
|
||||||
|
}
|
||||||
|
#endif // OXR_HAVE_FB_composition_layer_settings
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -987,6 +1028,7 @@ submit_quad_layer(struct oxr_session *sess,
|
||||||
fill_in_sub_image(sc, &quad->subImage, &data.quad.sub);
|
fill_in_sub_image(sc, &quad->subImage, &data.quad.sub);
|
||||||
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)quad, &data);
|
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)quad, &data);
|
||||||
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)quad, &data);
|
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)quad, &data);
|
||||||
|
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)quad, &data);
|
||||||
|
|
||||||
xrt_result_t xret = xrt_comp_layer_quad(xc, head, sc->swapchain, &data);
|
xrt_result_t xret = xrt_comp_layer_quad(xc, head, sc->swapchain, &data);
|
||||||
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_quad);
|
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_quad);
|
||||||
|
@ -1044,6 +1086,8 @@ submit_projection_layer(struct oxr_session *sess,
|
||||||
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)proj, &data);
|
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)proj, &data);
|
||||||
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)proj, &data);
|
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)proj, &data);
|
||||||
|
|
||||||
|
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)proj, &data);
|
||||||
|
|
||||||
#ifdef OXR_HAVE_KHR_composition_layer_depth
|
#ifdef OXR_HAVE_KHR_composition_layer_depth
|
||||||
const XrCompositionLayerDepthInfoKHR *d_l = OXR_GET_INPUT_FROM_CHAIN(
|
const XrCompositionLayerDepthInfoKHR *d_l = OXR_GET_INPUT_FROM_CHAIN(
|
||||||
&proj->views[0], XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR, XrCompositionLayerDepthInfoKHR);
|
&proj->views[0], XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR, XrCompositionLayerDepthInfoKHR);
|
||||||
|
@ -1126,6 +1170,7 @@ submit_cube_layer(struct oxr_session *sess,
|
||||||
data.name = XRT_INPUT_GENERIC_HEAD_POSE;
|
data.name = XRT_INPUT_GENERIC_HEAD_POSE;
|
||||||
data.timestamp = xrt_timestamp;
|
data.timestamp = xrt_timestamp;
|
||||||
data.flags = convert_layer_flags(cube->layerFlags);
|
data.flags = convert_layer_flags(cube->layerFlags);
|
||||||
|
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)cube, &data);
|
||||||
|
|
||||||
if (spc->space_type == OXR_SPACE_TYPE_REFERENCE_VIEW) {
|
if (spc->space_type == OXR_SPACE_TYPE_REFERENCE_VIEW) {
|
||||||
data.flags |= XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT;
|
data.flags |= XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT;
|
||||||
|
@ -1201,6 +1246,7 @@ submit_cylinder_layer(struct oxr_session *sess,
|
||||||
fill_in_sub_image(sc, &cylinder->subImage, &data.cylinder.sub);
|
fill_in_sub_image(sc, &cylinder->subImage, &data.cylinder.sub);
|
||||||
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)cylinder, &data);
|
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)cylinder, &data);
|
||||||
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)cylinder, &data);
|
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)cylinder, &data);
|
||||||
|
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)cylinder, &data);
|
||||||
|
|
||||||
xrt_result_t xret = xrt_comp_layer_cylinder(xc, head, sc->swapchain, &data);
|
xrt_result_t xret = xrt_comp_layer_cylinder(xc, head, sc->swapchain, &data);
|
||||||
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_cylinder);
|
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_cylinder);
|
||||||
|
@ -1246,7 +1292,7 @@ submit_equirect1_layer(struct oxr_session *sess,
|
||||||
fill_in_sub_image(sc, &equirect->subImage, &data.equirect1.sub);
|
fill_in_sub_image(sc, &equirect->subImage, &data.equirect1.sub);
|
||||||
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
||||||
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
||||||
|
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
||||||
|
|
||||||
struct xrt_vec2 *scale = (struct xrt_vec2 *)&equirect->scale;
|
struct xrt_vec2 *scale = (struct xrt_vec2 *)&equirect->scale;
|
||||||
struct xrt_vec2 *bias = (struct xrt_vec2 *)&equirect->bias;
|
struct xrt_vec2 *bias = (struct xrt_vec2 *)&equirect->bias;
|
||||||
|
@ -1310,6 +1356,7 @@ submit_equirect2_layer(struct oxr_session *sess,
|
||||||
fill_in_sub_image(sc, &equirect->subImage, &data.equirect2.sub);
|
fill_in_sub_image(sc, &equirect->subImage, &data.equirect2.sub);
|
||||||
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
fill_in_color_scale_bias(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
||||||
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
fill_in_y_flip(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
||||||
|
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)equirect, &data);
|
||||||
|
|
||||||
xrt_result_t xret = xrt_comp_layer_equirect2(xc, head, sc->swapchain, &data);
|
xrt_result_t xret = xrt_comp_layer_equirect2(xc, head, sc->swapchain, &data);
|
||||||
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_equirect2);
|
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_equirect2);
|
||||||
|
|
Loading…
Reference in a new issue