mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-16 03:45:24 +00:00
st/oxr: Add plumbing for layers
This commit is contained in:
parent
4a8ac6ebed
commit
38703fc1d2
1
doc/changes/state_trackers/mr.476.md
Normal file
1
doc/changes/state_trackers/mr.476.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
OpenXR: Add stub functions and support plumbing for a lot of layer extensions.
|
|
@ -14,6 +14,10 @@ EXTENSIONS = (
|
||||||
['XR_KHR_opengl_enable', 'XR_USE_GRAPHICS_API_OPENGL'],
|
['XR_KHR_opengl_enable', 'XR_USE_GRAPHICS_API_OPENGL'],
|
||||||
['XR_KHR_opengl_es_enable', 'XR_USE_GRAPHICS_API_OPENGL_ES'],
|
['XR_KHR_opengl_es_enable', 'XR_USE_GRAPHICS_API_OPENGL_ES'],
|
||||||
['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'],
|
['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'],
|
||||||
|
['XR_KHR_composition_layer_depth', 'XRT_FEATURE_OPENXR_LAYER_DEPTH'],
|
||||||
|
['XR_KHR_composition_layer_cube', 'XRT_FEATURE_OPENXR_LAYER_CUBE'],
|
||||||
|
['XR_KHR_composition_layer_cylinder', 'XRT_FEATURE_OPENXR_LAYER_CYLINDER'],
|
||||||
|
['XR_KHR_composition_layer_equirect', 'XRT_FEATURE_OPENXR_LAYER_EQUIRECT'],
|
||||||
['XR_EXT_debug_utils'],
|
['XR_EXT_debug_utils'],
|
||||||
['XR_MND_headless'],
|
['XR_MND_headless'],
|
||||||
['XR_MND_swapchain_usage_input_attachment_bit'],
|
['XR_MND_swapchain_usage_input_attachment_bit'],
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "xrt/xrt_config_build.h"
|
||||||
|
|
||||||
// beginning of GENERATED defines - do not modify - used by scripts
|
// beginning of GENERATED defines - do not modify - used by scripts
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,6 +68,58 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XR_KHR_composition_layer_depth
|
||||||
|
*/
|
||||||
|
#if defined(XR_KHR_composition_layer_depth) && \
|
||||||
|
defined(XRT_FEATURE_OPENXR_LAYER_DEPTH)
|
||||||
|
#define OXR_HAVE_KHR_composition_layer_depth
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_depth(_) \
|
||||||
|
_(KHR_composition_layer_depth, KHR_COMPOSITION_LAYER_DEPTH)
|
||||||
|
#else
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_depth(_)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XR_KHR_composition_layer_cube
|
||||||
|
*/
|
||||||
|
#if defined(XR_KHR_composition_layer_cube) && \
|
||||||
|
defined(XRT_FEATURE_OPENXR_LAYER_CUBE)
|
||||||
|
#define OXR_HAVE_KHR_composition_layer_cube
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_cube(_) \
|
||||||
|
_(KHR_composition_layer_cube, KHR_COMPOSITION_LAYER_CUBE)
|
||||||
|
#else
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_cube(_)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XR_KHR_composition_layer_cylinder
|
||||||
|
*/
|
||||||
|
#if defined(XR_KHR_composition_layer_cylinder) && \
|
||||||
|
defined(XRT_FEATURE_OPENXR_LAYER_CYLINDER)
|
||||||
|
#define OXR_HAVE_KHR_composition_layer_cylinder
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_cylinder(_) \
|
||||||
|
_(KHR_composition_layer_cylinder, KHR_COMPOSITION_LAYER_CYLINDER)
|
||||||
|
#else
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_cylinder(_)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XR_KHR_composition_layer_equirect
|
||||||
|
*/
|
||||||
|
#if defined(XR_KHR_composition_layer_equirect) && \
|
||||||
|
defined(XRT_FEATURE_OPENXR_LAYER_EQUIRECT)
|
||||||
|
#define OXR_HAVE_KHR_composition_layer_equirect
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_equirect(_) \
|
||||||
|
_(KHR_composition_layer_equirect, KHR_COMPOSITION_LAYER_EQUIRECT)
|
||||||
|
#else
|
||||||
|
#define OXR_EXTENSION_SUPPORT_KHR_composition_layer_equirect(_)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XR_EXT_debug_utils
|
* XR_EXT_debug_utils
|
||||||
*/
|
*/
|
||||||
|
@ -165,6 +219,10 @@
|
||||||
OXR_EXTENSION_SUPPORT_KHR_opengl_enable(_) \
|
OXR_EXTENSION_SUPPORT_KHR_opengl_enable(_) \
|
||||||
OXR_EXTENSION_SUPPORT_KHR_opengl_es_enable(_) \
|
OXR_EXTENSION_SUPPORT_KHR_opengl_es_enable(_) \
|
||||||
OXR_EXTENSION_SUPPORT_KHR_vulkan_enable(_) \
|
OXR_EXTENSION_SUPPORT_KHR_vulkan_enable(_) \
|
||||||
|
OXR_EXTENSION_SUPPORT_KHR_composition_layer_depth(_) \
|
||||||
|
OXR_EXTENSION_SUPPORT_KHR_composition_layer_cube(_) \
|
||||||
|
OXR_EXTENSION_SUPPORT_KHR_composition_layer_cylinder(_) \
|
||||||
|
OXR_EXTENSION_SUPPORT_KHR_composition_layer_equirect(_) \
|
||||||
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
|
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
|
||||||
OXR_EXTENSION_SUPPORT_MND_headless(_) \
|
OXR_EXTENSION_SUPPORT_MND_headless(_) \
|
||||||
OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_) \
|
OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_) \
|
||||||
|
|
|
@ -801,6 +801,63 @@ verify_projection_layer(struct xrt_compositor *xc,
|
||||||
return XR_SUCCESS;
|
return XR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static XrResult
|
||||||
|
verify_cube_layer(struct xrt_compositor *xc,
|
||||||
|
struct oxr_logger *log,
|
||||||
|
uint32_t layer_index,
|
||||||
|
const XrCompositionLayerCubeKHR *cube,
|
||||||
|
struct xrt_device *head,
|
||||||
|
uint64_t timestamp)
|
||||||
|
{
|
||||||
|
#ifndef XRT_FEATURE_OPENXR_LAYER_CUBE
|
||||||
|
return oxr_error(log, XR_ERROR_LAYER_INVALID,
|
||||||
|
"(frameEndInfo->layers[%u]->type) layer type "
|
||||||
|
"XrCompositionLayerCubeKHR not supported",
|
||||||
|
layer_index);
|
||||||
|
#else
|
||||||
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
|
"XrCompositionLayerCubeKHR not implemented");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static XrResult
|
||||||
|
verify_cylinder_layer(struct xrt_compositor *xc,
|
||||||
|
struct oxr_logger *log,
|
||||||
|
uint32_t layer_index,
|
||||||
|
const XrCompositionLayerCylinderKHR *cylinder,
|
||||||
|
struct xrt_device *head,
|
||||||
|
uint64_t timestamp)
|
||||||
|
{
|
||||||
|
#ifndef XRT_FEATURE_OPENXR_LAYER_CYLINDER
|
||||||
|
return oxr_error(log, XR_ERROR_LAYER_INVALID,
|
||||||
|
"(frameEndInfo->layers[%u]->type) layer type "
|
||||||
|
"XrCompositionLayerCylinderKHR not supported",
|
||||||
|
layer_index);
|
||||||
|
#else
|
||||||
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
|
"XrCompositionLayerCylinderKHR not implemented");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static XrResult
|
||||||
|
verify_equirect_layer(struct xrt_compositor *xc,
|
||||||
|
struct oxr_logger *log,
|
||||||
|
uint32_t layer_index,
|
||||||
|
const XrCompositionLayerEquirectKHR *equirect,
|
||||||
|
struct xrt_device *head,
|
||||||
|
uint64_t timestamp)
|
||||||
|
{
|
||||||
|
#ifndef XRT_FEATURE_OPENXR_LAYER_EQUIRECT
|
||||||
|
return oxr_error(log, XR_ERROR_LAYER_INVALID,
|
||||||
|
"(frameEndInfo->layers[%u]->type) layer type "
|
||||||
|
"XrCompositionLayerEquirectKHR not supported",
|
||||||
|
layer_index);
|
||||||
|
#else
|
||||||
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
|
"XrCompositionLayerEquirectKHR not implemented");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static enum xrt_layer_composition_flags
|
static enum xrt_layer_composition_flags
|
||||||
convert_layer_flags(XrSwapchainUsageFlags xr_flags)
|
convert_layer_flags(XrSwapchainUsageFlags xr_flags)
|
||||||
{
|
{
|
||||||
|
@ -1008,6 +1065,42 @@ submit_projection_layer(struct xrt_compositor *xc,
|
||||||
return XR_SUCCESS;
|
return XR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
submit_cube_layer(struct oxr_session *sess,
|
||||||
|
struct xrt_compositor *xc,
|
||||||
|
struct oxr_logger *log,
|
||||||
|
const XrCompositionLayerCubeKHR *cube,
|
||||||
|
struct xrt_device *head,
|
||||||
|
struct xrt_pose *inv_offset,
|
||||||
|
uint64_t timestamp)
|
||||||
|
{
|
||||||
|
// Not implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
submit_cylinder_layer(struct oxr_session *sess,
|
||||||
|
struct xrt_compositor *xc,
|
||||||
|
struct oxr_logger *log,
|
||||||
|
const XrCompositionLayerCylinderKHR *cylinder,
|
||||||
|
struct xrt_device *head,
|
||||||
|
struct xrt_pose *inv_offset,
|
||||||
|
uint64_t timestamp)
|
||||||
|
{
|
||||||
|
// Not implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
submit_equirect_layer(struct oxr_session *sess,
|
||||||
|
struct xrt_compositor *xc,
|
||||||
|
struct oxr_logger *log,
|
||||||
|
const XrCompositionLayerEquirectKHR *equirect,
|
||||||
|
struct xrt_device *head,
|
||||||
|
struct xrt_pose *inv_offset,
|
||||||
|
uint64_t timestamp)
|
||||||
|
{
|
||||||
|
// Not implemented
|
||||||
|
}
|
||||||
|
|
||||||
XrResult
|
XrResult
|
||||||
oxr_session_frame_end(struct oxr_logger *log,
|
oxr_session_frame_end(struct oxr_logger *log,
|
||||||
struct oxr_session *sess,
|
struct oxr_session *sess,
|
||||||
|
@ -1115,6 +1208,21 @@ oxr_session_frame_end(struct oxr_logger *log,
|
||||||
xc, log, i, (XrCompositionLayerQuad *)layer, xdev,
|
xc, log, i, (XrCompositionLayerQuad *)layer, xdev,
|
||||||
frameEndInfo->displayTime);
|
frameEndInfo->displayTime);
|
||||||
break;
|
break;
|
||||||
|
case XR_TYPE_COMPOSITION_LAYER_CUBE_KHR:
|
||||||
|
res = verify_cube_layer(
|
||||||
|
xc, log, i, (XrCompositionLayerCubeKHR *)layer,
|
||||||
|
xdev, frameEndInfo->displayTime);
|
||||||
|
break;
|
||||||
|
case XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR:
|
||||||
|
res = verify_cylinder_layer(
|
||||||
|
xc, log, i, (XrCompositionLayerCylinderKHR *)layer,
|
||||||
|
xdev, frameEndInfo->displayTime);
|
||||||
|
break;
|
||||||
|
case XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR:
|
||||||
|
res = verify_equirect_layer(
|
||||||
|
xc, log, i, (XrCompositionLayerEquirectKHR *)layer,
|
||||||
|
xdev, frameEndInfo->displayTime);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return oxr_error(log, XR_ERROR_LAYER_INVALID,
|
return oxr_error(log, XR_ERROR_LAYER_INVALID,
|
||||||
"(frameEndInfo->layers[%u]->type) "
|
"(frameEndInfo->layers[%u]->type) "
|
||||||
|
@ -1153,6 +1261,23 @@ oxr_session_frame_end(struct oxr_logger *log,
|
||||||
sess, xc, log, (XrCompositionLayerQuad *)layer,
|
sess, xc, log, (XrCompositionLayerQuad *)layer,
|
||||||
xdev, &inv_offset, frameEndInfo->displayTime);
|
xdev, &inv_offset, frameEndInfo->displayTime);
|
||||||
break;
|
break;
|
||||||
|
case XR_TYPE_COMPOSITION_LAYER_CUBE_KHR:
|
||||||
|
submit_cube_layer(
|
||||||
|
sess, xc, log, (XrCompositionLayerCubeKHR *)layer,
|
||||||
|
xdev, &inv_offset, frameEndInfo->displayTime);
|
||||||
|
break;
|
||||||
|
case XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR:
|
||||||
|
submit_cylinder_layer(
|
||||||
|
sess, xc, log,
|
||||||
|
(XrCompositionLayerCylinderKHR *)layer, xdev,
|
||||||
|
&inv_offset, frameEndInfo->displayTime);
|
||||||
|
break;
|
||||||
|
case XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR:
|
||||||
|
submit_equirect_layer(
|
||||||
|
sess, xc, log,
|
||||||
|
(XrCompositionLayerEquirectKHR *)layer, xdev,
|
||||||
|
&inv_offset, frameEndInfo->displayTime);
|
||||||
|
break;
|
||||||
default: assert(false && "invalid layer type");
|
default: assert(false && "invalid layer type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue