Update samples to release 109 (#98)
This commit is contained in:
Родитель
bc79ee50f9
Коммит
6742451152
|
@ -28,7 +28,7 @@ or choose x64 platform when running on a Windows Desktop PC with the HoloLens 2
|
|||
|
||||
The [openxr_preview](https://github.com/microsoft/OpenXR-MixedReality/tree/main/openxr_preview) folder contains a set of [preview header files](https://github.com/microsoft/OpenXR-MixedReality/tree/main/openxr_preview/include/openxr) containing the following OpenXR extensions that are only available [in preview runtime](http://aka.ms/openxr-preview).
|
||||
|
||||
1. [XR_MSFT_spatial_anchor_export_preview](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_SPATIAL_ANCHOR_EXPORT_PREVIEW)
|
||||
1. There's no additional preview extensions in latest preview runtime.
|
||||
|
||||
Please send feedback on preview extensions and samples at [GitHub issues](https://github.com/microsoft/OpenXR-MixedReality/issues).
|
||||
We are planning to incorporate your feedback and finalize these extensions as vendor extensions (MSFT) or cross-vendor extensions (EXT)
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
((((major) & 0xffffULL) << 48) | (((minor) & 0xffffULL) << 32) | ((patch) & 0xffffffffULL))
|
||||
|
||||
// OpenXR current version number.
|
||||
#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 18)
|
||||
#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 19)
|
||||
|
||||
#define XR_VERSION_MAJOR(version) (uint16_t)(((uint64_t)(version) >> 48)& 0xffffULL)
|
||||
#define XR_VERSION_MINOR(version) (uint16_t)(((uint64_t)(version) >> 32) & 0xffffULL)
|
||||
|
@ -198,9 +198,6 @@ typedef enum XrResult {
|
|||
XR_ERROR_COLOR_SPACE_UNSUPPORTED_FB = -1000108000,
|
||||
XR_ERROR_SPATIAL_ANCHOR_NAME_NOT_FOUND_MSFT = -1000142001,
|
||||
XR_ERROR_SPATIAL_ANCHOR_NAME_INVALID_MSFT = -1000142002,
|
||||
XR_SPATIAL_ANCHOR_EXPORT_DATA_UNAVAILABLE_MSFT = 1000062000,
|
||||
XR_ERROR_SPATIAL_ANCHOR_EXPORT_FAILED_MSFT = -1000062000,
|
||||
XR_ERROR_SPATIAL_ANCHOR_SUFFICIENCY_QUERY_FAILED_MSFT = -1000062001,
|
||||
XR_RESULT_MAX_ENUM = 0x7FFFFFFF
|
||||
} XrResult;
|
||||
|
||||
|
@ -297,7 +294,6 @@ typedef enum XrStructureType {
|
|||
XR_TYPE_COMPOSITION_LAYER_ALPHA_BLEND_FB = 1000041001,
|
||||
XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT = 1000046000,
|
||||
XR_TYPE_GRAPHICS_BINDING_EGL_MNDX = 1000048004,
|
||||
XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT = 1000049000,
|
||||
XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT = 1000051000,
|
||||
XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT = 1000051001,
|
||||
XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT = 1000051002,
|
||||
|
@ -355,6 +351,10 @@ typedef enum XrStructureType {
|
|||
XR_TYPE_SCENE_DESERIALIZE_INFO_MSFT = 1000098001,
|
||||
XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB = 1000101000,
|
||||
XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB = 1000108000,
|
||||
XR_TYPE_HAND_TRACKING_MESH_FB = 1000110001,
|
||||
XR_TYPE_HAND_TRACKING_SCALE_FB = 1000110003,
|
||||
XR_TYPE_HAND_TRACKING_AIM_STATE_FB = 1000111001,
|
||||
XR_TYPE_HAND_TRACKING_CAPSULES_STATE_FB = 1000112000,
|
||||
XR_TYPE_FOVEATION_PROFILE_CREATE_INFO_FB = 1000114000,
|
||||
XR_TYPE_SWAPCHAIN_CREATE_INFO_FOVEATION_FB = 1000114001,
|
||||
XR_TYPE_SWAPCHAIN_STATE_FOVEATION_FB = 1000114002,
|
||||
|
@ -370,8 +370,12 @@ typedef enum XrStructureType {
|
|||
XR_TYPE_SWAPCHAIN_STATE_ANDROID_SURFACE_DIMENSIONS_FB = 1000161000,
|
||||
XR_TYPE_SWAPCHAIN_STATE_SAMPLER_OPENGL_ES_FB = 1000162000,
|
||||
XR_TYPE_SWAPCHAIN_STATE_SAMPLER_VULKAN_FB = 1000163000,
|
||||
XR_TYPE_SPATIAL_ANCHOR_EXPORT_PURPOSE_INFO_MSFT = 1000062000,
|
||||
XR_TYPE_SPATIAL_ANCHOR_EXPORT_SUFFICIENCY_MSFT = 1000062001,
|
||||
XR_TYPE_COMPOSITION_LAYER_SPACE_WARP_INFO_FB = 1000171000,
|
||||
XR_TYPE_SYSTEM_SPACE_WARP_PROPERTIES_FB = 1000171001,
|
||||
XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT = 1000049000,
|
||||
XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_CREATE_INFO_MSFT = 1000049001,
|
||||
XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_GET_INFO_MSFT = 1000049002,
|
||||
XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_MSFT = 1000049003,
|
||||
XR_TYPE_GRAPHICS_BINDING_VULKAN2_KHR = XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR,
|
||||
XR_TYPE_SWAPCHAIN_IMAGE_VULKAN2_KHR = XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR,
|
||||
XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN2_KHR = XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR,
|
||||
|
@ -452,7 +456,7 @@ typedef enum XrObjectType {
|
|||
XR_OBJECT_TYPE_SCENE_MSFT = 1000097001,
|
||||
XR_OBJECT_TYPE_FOVEATION_PROFILE_FB = 1000114000,
|
||||
XR_OBJECT_TYPE_SPATIAL_ANCHOR_STORE_CONNECTION_MSFT = 1000142000,
|
||||
XR_OBJECT_TYPE_SPATIAL_ANCHOR_NEIGHBORHOOD_DATA_STREAM_MSFT = 1000062000,
|
||||
XR_OBJECT_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_MSFT = 1000049000,
|
||||
XR_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} XrObjectType;
|
||||
typedef XrFlags64 XrInstanceCreateFlags;
|
||||
|
@ -1527,7 +1531,7 @@ typedef struct XrCompositionLayerEquirect2KHR {
|
|||
#define XR_KHR_binding_modification 1
|
||||
#define XR_KHR_binding_modification_SPEC_VERSION 1
|
||||
#define XR_KHR_BINDING_MODIFICATION_EXTENSION_NAME "XR_KHR_binding_modification"
|
||||
typedef struct XrBindingModificationBaseHeaderKHR {
|
||||
typedef struct XR_MAY_ALIAS XrBindingModificationBaseHeaderKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
} XrBindingModificationBaseHeaderKHR;
|
||||
|
@ -1933,8 +1937,12 @@ XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceLocationEXT(
|
|||
|
||||
|
||||
#define XR_MSFT_spatial_graph_bridge 1
|
||||
|
||||
XR_DEFINE_HANDLE(XrSpatialGraphStaticNodeBindingMSFT)
|
||||
|
||||
#define XR_MSFT_spatial_graph_bridge_SPEC_VERSION 1
|
||||
#define XR_MSFT_SPATIAL_GRAPH_BRIDGE_EXTENSION_NAME "XR_MSFT_spatial_graph_bridge"
|
||||
#define XR_GUID_SIZE_MSFT 16
|
||||
|
||||
typedef enum XrSpatialGraphNodeTypeMSFT {
|
||||
XR_SPATIAL_GRAPH_NODE_TYPE_STATIC_MSFT = 1,
|
||||
|
@ -1949,7 +1957,30 @@ typedef struct XrSpatialGraphNodeSpaceCreateInfoMSFT {
|
|||
XrPosef pose;
|
||||
} XrSpatialGraphNodeSpaceCreateInfoMSFT;
|
||||
|
||||
typedef struct XrSpatialGraphStaticNodeBindingCreateInfoMSFT {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrSpace space;
|
||||
XrPosef poseInSpace;
|
||||
XrTime time;
|
||||
} XrSpatialGraphStaticNodeBindingCreateInfoMSFT;
|
||||
|
||||
typedef struct XrSpatialGraphStaticNodeBindingPropertiesGetInfoMSFT {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
} XrSpatialGraphStaticNodeBindingPropertiesGetInfoMSFT;
|
||||
|
||||
typedef struct XrSpatialGraphStaticNodeBindingPropertiesMSFT {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
uint8_t nodeId[XR_GUID_SIZE_MSFT];
|
||||
XrPosef poseInNodeSpace;
|
||||
} XrSpatialGraphStaticNodeBindingPropertiesMSFT;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialGraphNodeSpaceMSFT)(XrSession session, const XrSpatialGraphNodeSpaceCreateInfoMSFT* createInfo, XrSpace* space);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrTryCreateSpatialGraphStaticNodeBindingMSFT)(XrSession session, const XrSpatialGraphStaticNodeBindingCreateInfoMSFT* createInfo, XrSpatialGraphStaticNodeBindingMSFT* nodeBinding);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrDestroySpatialGraphStaticNodeBindingMSFT)(XrSpatialGraphStaticNodeBindingMSFT nodeBinding);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetSpatialGraphStaticNodeBindingPropertiesMSFT)(XrSpatialGraphStaticNodeBindingMSFT nodeBinding, const XrSpatialGraphStaticNodeBindingPropertiesGetInfoMSFT* getInfo, XrSpatialGraphStaticNodeBindingPropertiesMSFT* properties);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
|
@ -1957,6 +1988,19 @@ XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialGraphNodeSpaceMSFT(
|
|||
XrSession session,
|
||||
const XrSpatialGraphNodeSpaceCreateInfoMSFT* createInfo,
|
||||
XrSpace* space);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrTryCreateSpatialGraphStaticNodeBindingMSFT(
|
||||
XrSession session,
|
||||
const XrSpatialGraphStaticNodeBindingCreateInfoMSFT* createInfo,
|
||||
XrSpatialGraphStaticNodeBindingMSFT* nodeBinding);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrDestroySpatialGraphStaticNodeBindingMSFT(
|
||||
XrSpatialGraphStaticNodeBindingMSFT nodeBinding);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetSpatialGraphStaticNodeBindingPropertiesMSFT(
|
||||
XrSpatialGraphStaticNodeBindingMSFT nodeBinding,
|
||||
const XrSpatialGraphStaticNodeBindingPropertiesGetInfoMSFT* getInfo,
|
||||
XrSpatialGraphStaticNodeBindingPropertiesMSFT* properties);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
|
||||
|
@ -2321,61 +2365,6 @@ typedef struct XrViewConfigurationViewFovEPIC {
|
|||
|
||||
|
||||
|
||||
#define XR_MSFT_spatial_anchor_export_preview 1
|
||||
|
||||
XR_DEFINE_HANDLE(XrSpatialAnchorNeighborhoodDataStreamMSFT)
|
||||
|
||||
#define XR_MSFT_spatial_anchor_export_preview_SPEC_VERSION 1
|
||||
#define XR_MSFT_SPATIAL_ANCHOR_EXPORT_PREVIEW_EXTENSION_NAME "XR_MSFT_spatial_anchor_export_preview"
|
||||
|
||||
typedef enum XrSpatialAnchorExportPurposeMSFT {
|
||||
XR_SPATIAL_ANCHOR_EXPORT_PURPOSE_RELOCALIZATION_MSFT = 0,
|
||||
XR_SPATIAL_ANCHOR_EXPORT_PURPOSE_SHARING_MSFT = 1,
|
||||
XR_SPATIAL_ANCHOR_EXPORT_PURPOSE_MAX_ENUM_MSFT = 0x7FFFFFFF
|
||||
} XrSpatialAnchorExportPurposeMSFT;
|
||||
typedef struct XrSpatialAnchorExportPurposeInfoMSFT {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrSpatialAnchorExportPurposeMSFT exportPurpose;
|
||||
} XrSpatialAnchorExportPurposeInfoMSFT;
|
||||
|
||||
typedef struct XrSpatialAnchorExportSufficiencyMSFT {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrBool32 isMinimallySufficient;
|
||||
float recommendedSufficiencyLevel;
|
||||
float sufficiencyLevel;
|
||||
} XrSpatialAnchorExportSufficiencyMSFT;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialAnchorNeighborhoodDataStreamMSFT)(XrSpatialAnchorMSFT spatialAnchor, const XrSpatialAnchorExportPurposeInfoMSFT* exportPurposeInfo, XrSpatialAnchorNeighborhoodDataStreamMSFT* neighborhoodDataStream);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrDestroySpatialAnchorNeighborhoodDataStreamMSFT)(XrSpatialAnchorNeighborhoodDataStreamMSFT neighborhoodDataStream);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrReadSpatialAnchorNeighborhoodDataMSFT)(XrSpatialAnchorNeighborhoodDataStreamMSFT neighborhoodDataStream, uint32_t bytesToRead, uint32_t* bytesRead, void* buffer);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetSpatialAnchorExportSufficiencyMSFT)(XrSpatialAnchorMSFT spatialAnchor, const XrSpatialAnchorExportPurposeInfoMSFT* exportPurposeInfo, XrSpatialAnchorExportSufficiencyMSFT* exportSufficiency);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialAnchorNeighborhoodDataStreamMSFT(
|
||||
XrSpatialAnchorMSFT spatialAnchor,
|
||||
const XrSpatialAnchorExportPurposeInfoMSFT* exportPurposeInfo,
|
||||
XrSpatialAnchorNeighborhoodDataStreamMSFT* neighborhoodDataStream);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrDestroySpatialAnchorNeighborhoodDataStreamMSFT(
|
||||
XrSpatialAnchorNeighborhoodDataStreamMSFT neighborhoodDataStream);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrReadSpatialAnchorNeighborhoodDataMSFT(
|
||||
XrSpatialAnchorNeighborhoodDataStreamMSFT neighborhoodDataStream,
|
||||
uint32_t bytesToRead,
|
||||
uint32_t* bytesRead,
|
||||
void* XR_MAY_ALIAS buffer);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetSpatialAnchorExportSufficiencyMSFT(
|
||||
XrSpatialAnchorMSFT spatialAnchor,
|
||||
const XrSpatialAnchorExportPurposeInfoMSFT* exportPurposeInfo,
|
||||
XrSpatialAnchorExportSufficiencyMSFT* exportSufficiency);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
|
||||
|
||||
#define XR_MSFT_composition_layer_reprojection 1
|
||||
#define XR_MSFT_composition_layer_reprojection_SPEC_VERSION 1
|
||||
#define XR_MSFT_COMPOSITION_LAYER_REPROJECTION_EXTENSION_NAME "XR_MSFT_composition_layer_reprojection"
|
||||
|
@ -2466,9 +2455,8 @@ typedef struct XrCompositionLayerSecureContentFB {
|
|||
|
||||
|
||||
#define XR_VALVE_analog_threshold 1
|
||||
#define XR_VALVE_analog_threshold_SPEC_VERSION 1
|
||||
#define XR_VALVE_analog_threshold_SPEC_VERSION 2
|
||||
#define XR_VALVE_ANALOG_THRESHOLD_EXTENSION_NAME "XR_VALVE_analog_threshold"
|
||||
// XrInteractionProfileAnalogThresholdVALVE extends XrInteractionProfileSuggestedBinding
|
||||
typedef struct XrInteractionProfileAnalogThresholdVALVE {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
|
@ -2960,6 +2948,107 @@ XRAPI_ATTR XrResult XRAPI_CALL xrSetColorSpaceFB(
|
|||
#endif /* !XR_NO_PROTOTYPES */
|
||||
|
||||
|
||||
#define XR_FB_hand_tracking_mesh 1
|
||||
#define XR_FB_hand_tracking_mesh_SPEC_VERSION 1
|
||||
#define XR_FB_HAND_TRACKING_MESH_EXTENSION_NAME "XR_FB_hand_tracking_mesh"
|
||||
typedef struct XrVector4sFB {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t z;
|
||||
int16_t w;
|
||||
} XrVector4sFB;
|
||||
|
||||
typedef struct XrHandTrackingMeshFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
uint32_t jointCapacityInput;
|
||||
uint32_t jointCountOutput;
|
||||
XrPosef* jointBindPoses;
|
||||
float* jointRadii;
|
||||
XrHandJointEXT* jointParents;
|
||||
uint32_t vertexCapacityInput;
|
||||
uint32_t vertexCountOutput;
|
||||
XrVector3f* vertexPositions;
|
||||
XrVector3f* vertexNormals;
|
||||
XrVector2f* vertexUVs;
|
||||
XrVector4sFB* vertexBlendIndices;
|
||||
XrVector4f* vertexBlendWeights;
|
||||
uint32_t indexCapacityInput;
|
||||
uint32_t indexCountOutput;
|
||||
int16_t* indices;
|
||||
} XrHandTrackingMeshFB;
|
||||
|
||||
// XrHandTrackingScaleFB extends XrHandJointsLocateInfoEXT
|
||||
typedef struct XrHandTrackingScaleFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
float sensorOutput;
|
||||
float currentOutput;
|
||||
XrBool32 overrideHandScale;
|
||||
float overrideValueInput;
|
||||
} XrHandTrackingScaleFB;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetHandMeshFB)(XrHandTrackerEXT handTracker, XrHandTrackingMeshFB* mesh);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetHandMeshFB(
|
||||
XrHandTrackerEXT handTracker,
|
||||
XrHandTrackingMeshFB* mesh);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
|
||||
|
||||
#define XR_FB_hand_tracking_aim 1
|
||||
#define XR_FB_hand_tracking_aim_SPEC_VERSION 1
|
||||
#define XR_FB_HAND_TRACKING_AIM_EXTENSION_NAME "XR_FB_hand_tracking_aim"
|
||||
typedef XrFlags64 XrHandTrackingAimFlagsFB;
|
||||
|
||||
// Flag bits for XrHandTrackingAimFlagsFB
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_COMPUTED_BIT_FB = 0x00000001;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_VALID_BIT_FB = 0x00000002;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_INDEX_PINCHING_BIT_FB = 0x00000004;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_MIDDLE_PINCHING_BIT_FB = 0x00000008;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_RING_PINCHING_BIT_FB = 0x00000010;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_LITTLE_PINCHING_BIT_FB = 0x00000020;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_SYSTEM_GESTURE_BIT_FB = 0x00000040;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_DOMINANT_HAND_BIT_FB = 0x00000080;
|
||||
static const XrHandTrackingAimFlagsFB XR_HAND_TRACKING_AIM_MENU_PRESSED_BIT_FB = 0x00000100;
|
||||
|
||||
// XrHandTrackingAimStateFB extends XrHandJointsLocateInfoEXT
|
||||
typedef struct XrHandTrackingAimStateFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
XrHandTrackingAimFlagsFB status;
|
||||
XrPosef aimPose;
|
||||
float pinchStrengthIndex;
|
||||
float pinchStrengthMiddle;
|
||||
float pinchStrengthRing;
|
||||
float pinchStrengthLittle;
|
||||
} XrHandTrackingAimStateFB;
|
||||
|
||||
|
||||
|
||||
#define XR_FB_hand_tracking_capsules 1
|
||||
#define XR_FB_HAND_TRACKING_CAPSULE_POINT_COUNT 2
|
||||
#define XR_FB_HAND_TRACKING_CAPSULE_COUNT 19
|
||||
#define XR_FB_hand_tracking_capsules_SPEC_VERSION 1
|
||||
#define XR_FB_HAND_TRACKING_CAPSULES_EXTENSION_NAME "XR_FB_hand_tracking_capsules"
|
||||
typedef struct XrHandCapsuleFB {
|
||||
XrVector3f points[XR_FB_HAND_TRACKING_CAPSULE_POINT_COUNT];
|
||||
float radius;
|
||||
XrHandJointEXT joint;
|
||||
} XrHandCapsuleFB;
|
||||
|
||||
// XrHandTrackingCapsulesStateFB extends XrHandJointsLocateInfoEXT
|
||||
typedef struct XrHandTrackingCapsulesStateFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
XrHandCapsuleFB capsules[XR_FB_HAND_TRACKING_CAPSULE_COUNT];
|
||||
} XrHandTrackingCapsulesStateFB;
|
||||
|
||||
|
||||
|
||||
#define XR_FB_foveation 1
|
||||
XR_DEFINE_HANDLE(XrFoveationProfileFB)
|
||||
#define XR_FB_foveation_SPEC_VERSION 1
|
||||
|
@ -3154,6 +3243,37 @@ XRAPI_ATTR XrResult XRAPI_CALL xrClearSpatialAnchorStoreMSFT(
|
|||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
|
||||
|
||||
#define XR_FB_space_warp 1
|
||||
#define XR_FB_space_warp_SPEC_VERSION 1
|
||||
#define XR_FB_SPACE_WARP_EXTENSION_NAME "XR_FB_space_warp"
|
||||
typedef XrFlags64 XrCompositionLayerSpaceWarpInfoFlagsFB;
|
||||
|
||||
// Flag bits for XrCompositionLayerSpaceWarpInfoFlagsFB
|
||||
|
||||
// XrCompositionLayerSpaceWarpInfoFB extends XrCompositionLayerProjectionView
|
||||
typedef struct XrCompositionLayerSpaceWarpInfoFB {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrCompositionLayerSpaceWarpInfoFlagsFB layerFlags;
|
||||
XrSwapchainSubImage motionVectorSubImage;
|
||||
XrPosef appSpaceDeltaPose;
|
||||
XrSwapchainSubImage depthSubImage;
|
||||
float minDepth;
|
||||
float maxDepth;
|
||||
float nearZ;
|
||||
float farZ;
|
||||
} XrCompositionLayerSpaceWarpInfoFB;
|
||||
|
||||
// XrSystemSpaceWarpPropertiesFB extends XrSystemProperties
|
||||
typedef struct XrSystemSpaceWarpPropertiesFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
uint32_t recommendedMotionVectorImageRectWidth;
|
||||
uint32_t recommendedMotionVectorImageRectHeight;
|
||||
} XrSystemSpaceWarpPropertiesFB;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -102,9 +102,6 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_ERROR_COLOR_SPACE_UNSUPPORTED_FB, -1000108000) \
|
||||
_(XR_ERROR_SPATIAL_ANCHOR_NAME_NOT_FOUND_MSFT, -1000142001) \
|
||||
_(XR_ERROR_SPATIAL_ANCHOR_NAME_INVALID_MSFT, -1000142002) \
|
||||
_(XR_SPATIAL_ANCHOR_EXPORT_DATA_UNAVAILABLE_MSFT, 1000062000) \
|
||||
_(XR_ERROR_SPATIAL_ANCHOR_EXPORT_FAILED_MSFT, -1000062000) \
|
||||
_(XR_ERROR_SPATIAL_ANCHOR_SUFFICIENCY_QUERY_FAILED_MSFT, -1000062001) \
|
||||
_(XR_RESULT_MAX_ENUM, 0x7FFFFFFF)
|
||||
|
||||
#define XR_LIST_ENUM_XrStructureType(_) \
|
||||
|
@ -200,7 +197,6 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_TYPE_COMPOSITION_LAYER_ALPHA_BLEND_FB, 1000041001) \
|
||||
_(XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT, 1000046000) \
|
||||
_(XR_TYPE_GRAPHICS_BINDING_EGL_MNDX, 1000048004) \
|
||||
_(XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT, 1000049000) \
|
||||
_(XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT, 1000051000) \
|
||||
_(XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT, 1000051001) \
|
||||
_(XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT, 1000051002) \
|
||||
|
@ -258,6 +254,10 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_TYPE_SCENE_DESERIALIZE_INFO_MSFT, 1000098001) \
|
||||
_(XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB, 1000101000) \
|
||||
_(XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB, 1000108000) \
|
||||
_(XR_TYPE_HAND_TRACKING_MESH_FB, 1000110001) \
|
||||
_(XR_TYPE_HAND_TRACKING_SCALE_FB, 1000110003) \
|
||||
_(XR_TYPE_HAND_TRACKING_AIM_STATE_FB, 1000111001) \
|
||||
_(XR_TYPE_HAND_TRACKING_CAPSULES_STATE_FB, 1000112000) \
|
||||
_(XR_TYPE_FOVEATION_PROFILE_CREATE_INFO_FB, 1000114000) \
|
||||
_(XR_TYPE_SWAPCHAIN_CREATE_INFO_FOVEATION_FB, 1000114001) \
|
||||
_(XR_TYPE_SWAPCHAIN_STATE_FOVEATION_FB, 1000114002) \
|
||||
|
@ -273,8 +273,12 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_TYPE_SWAPCHAIN_STATE_ANDROID_SURFACE_DIMENSIONS_FB, 1000161000) \
|
||||
_(XR_TYPE_SWAPCHAIN_STATE_SAMPLER_OPENGL_ES_FB, 1000162000) \
|
||||
_(XR_TYPE_SWAPCHAIN_STATE_SAMPLER_VULKAN_FB, 1000163000) \
|
||||
_(XR_TYPE_SPATIAL_ANCHOR_EXPORT_PURPOSE_INFO_MSFT, 1000062000) \
|
||||
_(XR_TYPE_SPATIAL_ANCHOR_EXPORT_SUFFICIENCY_MSFT, 1000062001) \
|
||||
_(XR_TYPE_COMPOSITION_LAYER_SPACE_WARP_INFO_FB, 1000171000) \
|
||||
_(XR_TYPE_SYSTEM_SPACE_WARP_PROPERTIES_FB, 1000171001) \
|
||||
_(XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT, 1000049000) \
|
||||
_(XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_CREATE_INFO_MSFT, 1000049001) \
|
||||
_(XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_GET_INFO_MSFT, 1000049002) \
|
||||
_(XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_MSFT, 1000049003) \
|
||||
_(XR_STRUCTURE_TYPE_MAX_ENUM, 0x7FFFFFFF)
|
||||
|
||||
#define XR_LIST_ENUM_XrFormFactor(_) \
|
||||
|
@ -344,7 +348,7 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_OBJECT_TYPE_SCENE_MSFT, 1000097001) \
|
||||
_(XR_OBJECT_TYPE_FOVEATION_PROFILE_FB, 1000114000) \
|
||||
_(XR_OBJECT_TYPE_SPATIAL_ANCHOR_STORE_CONNECTION_MSFT, 1000142000) \
|
||||
_(XR_OBJECT_TYPE_SPATIAL_ANCHOR_NEIGHBORHOOD_DATA_STREAM_MSFT, 1000062000) \
|
||||
_(XR_OBJECT_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_MSFT, 1000049000) \
|
||||
_(XR_OBJECT_TYPE_MAX_ENUM, 0x7FFFFFFF)
|
||||
|
||||
#define XR_LIST_ENUM_XrAndroidThreadTypeKHR(_) \
|
||||
|
@ -441,11 +445,6 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT, 1) \
|
||||
_(XR_HAND_POSE_TYPE_MAX_ENUM_MSFT, 0x7FFFFFFF)
|
||||
|
||||
#define XR_LIST_ENUM_XrSpatialAnchorExportPurposeMSFT(_) \
|
||||
_(XR_SPATIAL_ANCHOR_EXPORT_PURPOSE_RELOCALIZATION_MSFT, 0) \
|
||||
_(XR_SPATIAL_ANCHOR_EXPORT_PURPOSE_SHARING_MSFT, 1) \
|
||||
_(XR_SPATIAL_ANCHOR_EXPORT_PURPOSE_MAX_ENUM_MSFT, 0x7FFFFFFF)
|
||||
|
||||
#define XR_LIST_ENUM_XrReprojectionModeMSFT(_) \
|
||||
_(XR_REPROJECTION_MODE_DEPTH_MSFT, 1) \
|
||||
_(XR_REPROJECTION_MODE_PLANAR_FROM_DEPTH_MSFT, 2) \
|
||||
|
@ -611,12 +610,25 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_COMPOSITION_LAYER_SECURE_CONTENT_EXCLUDE_LAYER_BIT_FB, 0x00000001) \
|
||||
_(XR_COMPOSITION_LAYER_SECURE_CONTENT_REPLACE_LAYER_BIT_FB, 0x00000002) \
|
||||
|
||||
#define XR_LIST_BITS_XrHandTrackingAimFlagsFB(_) \
|
||||
_(XR_HAND_TRACKING_AIM_COMPUTED_BIT_FB, 0x00000001) \
|
||||
_(XR_HAND_TRACKING_AIM_VALID_BIT_FB, 0x00000002) \
|
||||
_(XR_HAND_TRACKING_AIM_INDEX_PINCHING_BIT_FB, 0x00000004) \
|
||||
_(XR_HAND_TRACKING_AIM_MIDDLE_PINCHING_BIT_FB, 0x00000008) \
|
||||
_(XR_HAND_TRACKING_AIM_RING_PINCHING_BIT_FB, 0x00000010) \
|
||||
_(XR_HAND_TRACKING_AIM_LITTLE_PINCHING_BIT_FB, 0x00000020) \
|
||||
_(XR_HAND_TRACKING_AIM_SYSTEM_GESTURE_BIT_FB, 0x00000040) \
|
||||
_(XR_HAND_TRACKING_AIM_DOMINANT_HAND_BIT_FB, 0x00000080) \
|
||||
_(XR_HAND_TRACKING_AIM_MENU_PRESSED_BIT_FB, 0x00000100) \
|
||||
|
||||
#define XR_LIST_BITS_XrSwapchainCreateFoveationFlagsFB(_) \
|
||||
_(XR_SWAPCHAIN_CREATE_FOVEATION_SCALED_BIN_BIT_FB, 0x00000001) \
|
||||
_(XR_SWAPCHAIN_CREATE_FOVEATION_FRAGMENT_DENSITY_MAP_BIT_FB, 0x00000002) \
|
||||
|
||||
#define XR_LIST_BITS_XrSwapchainStateFoveationFlagsFB(_)
|
||||
|
||||
#define XR_LIST_BITS_XrCompositionLayerSpaceWarpInfoFlagsFB(_)
|
||||
|
||||
#define XR_LIST_STRUCT_XrApiLayerProperties(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
|
@ -1415,6 +1427,23 @@ XR_ENUM_STR(XrResult);
|
|||
_(nodeId) \
|
||||
_(pose) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSpatialGraphStaticNodeBindingCreateInfoMSFT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(space) \
|
||||
_(poseInSpace) \
|
||||
_(time) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSpatialGraphStaticNodeBindingPropertiesGetInfoMSFT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSpatialGraphStaticNodeBindingPropertiesMSFT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(nodeId) \
|
||||
_(poseInNodeSpace) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSystemHandTrackingPropertiesEXT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
|
@ -1577,18 +1606,6 @@ XR_ENUM_STR(XrResult);
|
|||
_(recommendedFov) \
|
||||
_(maxMutableFov) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSpatialAnchorExportPurposeInfoMSFT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(exportPurpose) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSpatialAnchorExportSufficiencyMSFT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(isMinimallySufficient) \
|
||||
_(recommendedSufficiencyLevel) \
|
||||
_(sufficiencyLevel) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrHolographicWindowAttachmentMSFT(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
|
@ -1823,6 +1840,59 @@ XR_ENUM_STR(XrResult);
|
|||
_(next) \
|
||||
_(colorSpace) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrVector4sFB(_) \
|
||||
_(x) \
|
||||
_(y) \
|
||||
_(z) \
|
||||
_(w) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrHandTrackingMeshFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(jointCapacityInput) \
|
||||
_(jointCountOutput) \
|
||||
_(jointBindPoses) \
|
||||
_(jointRadii) \
|
||||
_(jointParents) \
|
||||
_(vertexCapacityInput) \
|
||||
_(vertexCountOutput) \
|
||||
_(vertexPositions) \
|
||||
_(vertexNormals) \
|
||||
_(vertexUVs) \
|
||||
_(vertexBlendIndices) \
|
||||
_(vertexBlendWeights) \
|
||||
_(indexCapacityInput) \
|
||||
_(indexCountOutput) \
|
||||
_(indices) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrHandTrackingScaleFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(sensorOutput) \
|
||||
_(currentOutput) \
|
||||
_(overrideHandScale) \
|
||||
_(overrideValueInput) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrHandTrackingAimStateFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(status) \
|
||||
_(aimPose) \
|
||||
_(pinchStrengthIndex) \
|
||||
_(pinchStrengthMiddle) \
|
||||
_(pinchStrengthRing) \
|
||||
_(pinchStrengthLittle) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrHandCapsuleFB(_) \
|
||||
_(points) \
|
||||
_(radius) \
|
||||
_(joint) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrHandTrackingCapsulesStateFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(capsules) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrFoveationProfileCreateInfoFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
|
@ -1923,6 +1993,24 @@ XR_ENUM_STR(XrResult);
|
|||
_(maxAnisotropy) \
|
||||
_(borderColor) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrCompositionLayerSpaceWarpInfoFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(layerFlags) \
|
||||
_(motionVectorSubImage) \
|
||||
_(appSpaceDeltaPose) \
|
||||
_(depthSubImage) \
|
||||
_(minDepth) \
|
||||
_(maxDepth) \
|
||||
_(nearZ) \
|
||||
_(farZ) \
|
||||
|
||||
#define XR_LIST_STRUCT_XrSystemSpaceWarpPropertiesFB(_) \
|
||||
_(type) \
|
||||
_(next) \
|
||||
_(recommendedMotionVectorImageRectWidth) \
|
||||
_(recommendedMotionVectorImageRectHeight) \
|
||||
|
||||
|
||||
|
||||
#define XR_LIST_STRUCTURE_TYPES_CORE(_) \
|
||||
|
@ -1999,6 +2087,9 @@ XR_ENUM_STR(XrResult);
|
|||
_(XrCompositionLayerAlphaBlendFB, XR_TYPE_COMPOSITION_LAYER_ALPHA_BLEND_FB) \
|
||||
_(XrViewConfigurationDepthRangeEXT, XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT) \
|
||||
_(XrSpatialGraphNodeSpaceCreateInfoMSFT, XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT) \
|
||||
_(XrSpatialGraphStaticNodeBindingCreateInfoMSFT, XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_CREATE_INFO_MSFT) \
|
||||
_(XrSpatialGraphStaticNodeBindingPropertiesGetInfoMSFT, XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_GET_INFO_MSFT) \
|
||||
_(XrSpatialGraphStaticNodeBindingPropertiesMSFT, XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_MSFT) \
|
||||
_(XrSystemHandTrackingPropertiesEXT, XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT) \
|
||||
_(XrHandTrackerCreateInfoEXT, XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT) \
|
||||
_(XrHandJointsLocateInfoEXT, XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT) \
|
||||
|
@ -2021,8 +2112,6 @@ XR_ENUM_STR(XrResult);
|
|||
_(XrControllerModelNodeStateMSFT, XR_TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT) \
|
||||
_(XrControllerModelStateMSFT, XR_TYPE_CONTROLLER_MODEL_STATE_MSFT) \
|
||||
_(XrViewConfigurationViewFovEPIC, XR_TYPE_VIEW_CONFIGURATION_VIEW_FOV_EPIC) \
|
||||
_(XrSpatialAnchorExportPurposeInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_EXPORT_PURPOSE_INFO_MSFT) \
|
||||
_(XrSpatialAnchorExportSufficiencyMSFT, XR_TYPE_SPATIAL_ANCHOR_EXPORT_SUFFICIENCY_MSFT) \
|
||||
_(XrCompositionLayerReprojectionInfoMSFT, XR_TYPE_COMPOSITION_LAYER_REPROJECTION_INFO_MSFT) \
|
||||
_(XrCompositionLayerReprojectionPlaneOverrideMSFT, XR_TYPE_COMPOSITION_LAYER_REPROJECTION_PLANE_OVERRIDE_MSFT) \
|
||||
_(XrCompositionLayerSecureContentFB, XR_TYPE_COMPOSITION_LAYER_SECURE_CONTENT_FB) \
|
||||
|
@ -2051,6 +2140,10 @@ XR_ENUM_STR(XrResult);
|
|||
_(XrSceneDeserializeInfoMSFT, XR_TYPE_SCENE_DESERIALIZE_INFO_MSFT) \
|
||||
_(XrEventDataDisplayRefreshRateChangedFB, XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB) \
|
||||
_(XrSystemColorSpacePropertiesFB, XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB) \
|
||||
_(XrHandTrackingMeshFB, XR_TYPE_HAND_TRACKING_MESH_FB) \
|
||||
_(XrHandTrackingScaleFB, XR_TYPE_HAND_TRACKING_SCALE_FB) \
|
||||
_(XrHandTrackingAimStateFB, XR_TYPE_HAND_TRACKING_AIM_STATE_FB) \
|
||||
_(XrHandTrackingCapsulesStateFB, XR_TYPE_HAND_TRACKING_CAPSULES_STATE_FB) \
|
||||
_(XrFoveationProfileCreateInfoFB, XR_TYPE_FOVEATION_PROFILE_CREATE_INFO_FB) \
|
||||
_(XrSwapchainCreateInfoFoveationFB, XR_TYPE_SWAPCHAIN_CREATE_INFO_FOVEATION_FB) \
|
||||
_(XrSwapchainStateFoveationFB, XR_TYPE_SWAPCHAIN_STATE_FOVEATION_FB) \
|
||||
|
@ -2061,6 +2154,8 @@ XR_ENUM_STR(XrResult);
|
|||
_(XrCompositionLayerDepthTestVARJO, XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_VARJO) \
|
||||
_(XrSpatialAnchorPersistenceInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_PERSISTENCE_INFO_MSFT) \
|
||||
_(XrSpatialAnchorFromPersistedAnchorCreateInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_FROM_PERSISTED_ANCHOR_CREATE_INFO_MSFT) \
|
||||
_(XrCompositionLayerSpaceWarpInfoFB, XR_TYPE_COMPOSITION_LAYER_SPACE_WARP_INFO_FB) \
|
||||
_(XrSystemSpaceWarpPropertiesFB, XR_TYPE_SYSTEM_SPACE_WARP_PROPERTIES_FB) \
|
||||
|
||||
|
||||
|
||||
|
@ -2260,7 +2355,6 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_MSFT_perception_anchor_interop, 57) \
|
||||
_(XR_EXT_win32_appcontainer_compatible, 58) \
|
||||
_(XR_EPIC_view_configuration_fov, 60) \
|
||||
_(XR_MSFT_spatial_anchor_export_preview, 63) \
|
||||
_(XR_MSFT_holographic_window_attachment, 64) \
|
||||
_(XR_MSFT_composition_layer_reprojection, 67) \
|
||||
_(XR_HUAWEI_controller_interaction, 70) \
|
||||
|
@ -2281,6 +2375,9 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_FB_display_refresh_rate, 102) \
|
||||
_(XR_HTC_vive_cosmos_controller_interaction, 103) \
|
||||
_(XR_FB_color_space, 109) \
|
||||
_(XR_FB_hand_tracking_mesh, 111) \
|
||||
_(XR_FB_hand_tracking_aim, 112) \
|
||||
_(XR_FB_hand_tracking_capsules, 113) \
|
||||
_(XR_FB_foveation, 115) \
|
||||
_(XR_FB_foveation_configuration, 116) \
|
||||
_(XR_KHR_binding_modification, 121) \
|
||||
|
@ -2294,6 +2391,7 @@ XR_ENUM_STR(XrResult);
|
|||
_(XR_FB_swapchain_update_state_opengl_es, 163) \
|
||||
_(XR_FB_swapchain_update_state_vulkan, 164) \
|
||||
_(XR_KHR_swapchain_usage_input_attachment_bit, 166) \
|
||||
_(XR_FB_space_warp, 172) \
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -34,6 +34,13 @@ engine::ProjectionLayer::ProjectionLayer(const sample::SessionContext& sessionCo
|
|||
}
|
||||
}
|
||||
|
||||
void engine::ProjectionLayer::DestroySwapchains() {
|
||||
for (auto& viewConfigComponent : m_viewConfigComponents) {
|
||||
viewConfigComponent.second.ColorSwapchain = {};
|
||||
viewConfigComponent.second.DepthSwapchain = {};
|
||||
}
|
||||
}
|
||||
|
||||
void engine::ProjectionLayer::PrepareRendering(const Context& context,
|
||||
XrViewConfigurationType viewConfigType,
|
||||
const std::vector<XrViewConfigurationView>& viewConfigViews) {
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace engine {
|
|||
const std::vector<std::unique_ptr<Scene>>& activeScenes,
|
||||
XrViewConfigurationType viewConfig);
|
||||
|
||||
void DestroySwapchains();
|
||||
|
||||
private:
|
||||
struct ViewConfigComponent {
|
||||
ProjectionLayerConfig CurrentConfig;
|
||||
|
|
|
@ -20,9 +20,10 @@ namespace engine {
|
|||
XrCompositionLayerFlags CompositionLayerFlags{};
|
||||
XrEyeVisibility EyeVisibility{XR_EYE_VISIBILITY_BOTH};
|
||||
LayerGrouping LayerGroup = LayerGrouping::Overlay;
|
||||
DirectX::XMFLOAT4 ColorScale = {1, 1, 1, 1};
|
||||
DirectX::XMFLOAT4 ColorBias = {0, 0, 0, 0};
|
||||
};
|
||||
|
||||
std::shared_ptr<QuadLayerObject> CreateQuadLayerObject(XrSpace space, XrSwapchainSubImage image);
|
||||
|
||||
} // namespace engine
|
||||
|
||||
|
|
|
@ -456,6 +456,9 @@ namespace {
|
|||
void ImplementXrApp::EndSession() {
|
||||
StopRenderThreadIfRunning();
|
||||
m_sessionRunning = false;
|
||||
|
||||
m_projectionLayers.ForEachLayerWithLock([this](auto&& layer) { layer.DestroySwapchains(); });
|
||||
|
||||
CHECK_XRCMD(xrEndSession(Context().Session.Handle));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "XrString.h"
|
||||
#include "XrHandle.h"
|
||||
|
||||
namespace xr {
|
||||
class ActionSet {
|
||||
public:
|
||||
ActionSet(XrInstance instance, const char* name, const char* localizedName, uint32_t priority = 0)
|
||||
: m_instance(instance) {
|
||||
XrActionSetCreateInfo actionSetCreateInfo{XR_TYPE_ACTION_SET_CREATE_INFO};
|
||||
strcpy_s(actionSetCreateInfo.actionSetName, name);
|
||||
strcpy_s(actionSetCreateInfo.localizedActionSetName, localizedName);
|
||||
actionSetCreateInfo.priority = priority;
|
||||
CHECK_XRCMD(xrCreateActionSet(m_instance, &actionSetCreateInfo, m_actionSet.Put()));
|
||||
}
|
||||
|
||||
XrAction CreateAction(const char* actionName,
|
||||
const char* localizedName,
|
||||
XrActionType actionType,
|
||||
const std::vector<std::string>& subactionPaths) {
|
||||
std::vector<XrPath> subActionXrPaths = xr::StringsToPaths(m_instance, subactionPaths);
|
||||
|
||||
XrActionCreateInfo actionCreateInfo{XR_TYPE_ACTION_CREATE_INFO};
|
||||
actionCreateInfo.actionType = actionType;
|
||||
actionCreateInfo.countSubactionPaths = static_cast<uint32_t>(subActionXrPaths.size());
|
||||
actionCreateInfo.subactionPaths = subActionXrPaths.data();
|
||||
strcpy_s(actionCreateInfo.actionName, actionName);
|
||||
strcpy_s(actionCreateInfo.localizedActionName, localizedName);
|
||||
|
||||
for (XrPath subactionPath : subActionXrPaths) {
|
||||
m_declaredSubactionPaths.insert(subactionPath); // std::set will remove duplication.
|
||||
}
|
||||
|
||||
xr::ActionHandle action;
|
||||
CHECK_XRCMD(xrCreateAction(m_actionSet.Get(), &actionCreateInfo, action.Put()));
|
||||
|
||||
m_actions.push_back(std::move(action));
|
||||
|
||||
return m_actions.back().Get();
|
||||
}
|
||||
|
||||
bool Active() const {
|
||||
return m_active;
|
||||
}
|
||||
void SetActive(bool active) {
|
||||
m_active = active;
|
||||
}
|
||||
|
||||
XrActionSet Handle() const {
|
||||
return m_actionSet.Get();
|
||||
}
|
||||
|
||||
const std::set<XrPath>& DeclaredSubactionPaths() const {
|
||||
return m_declaredSubactionPaths;
|
||||
}
|
||||
|
||||
private:
|
||||
const XrInstance m_instance;
|
||||
xr::ActionSetHandle m_actionSet;
|
||||
std::vector<xr::ActionHandle> m_actions;
|
||||
bool m_active{true};
|
||||
std::set<XrPath> m_declaredSubactionPaths;
|
||||
};
|
||||
|
||||
//
|
||||
// OpenXR requires one xrSuggestInteractionProfileBindings call for each interaction profile
|
||||
// and one xrAttachSessionActionSets for each session.
|
||||
// The xrSyncActions call must be done for all active actionset together.
|
||||
// ActionContext class collects action and actionset metadata from multiple places in an app
|
||||
// and finalize the binding and attach to session together.
|
||||
//
|
||||
struct ActionContext {
|
||||
struct ActionBinding {
|
||||
XrAction action;
|
||||
std::string binding;
|
||||
};
|
||||
|
||||
explicit ActionContext(XrInstance instance)
|
||||
: m_instance(instance) {
|
||||
}
|
||||
|
||||
ActionSet& CreateActionSet(const char* name, const char* localizedName, uint32_t priority = 0) {
|
||||
return m_actionSets.emplace_back(ActionSet{m_instance, name, localizedName, priority});
|
||||
}
|
||||
|
||||
void SuggestInteractionProfileBindings(const char* interactionProfile, const std::vector<ActionBinding>& suggestedBindings) {
|
||||
const XrPath profilePath = xr::StringToPath(m_instance, interactionProfile);
|
||||
for (const auto& actionBinding : suggestedBindings) {
|
||||
m_actionBindings[profilePath].emplace_back(actionBinding);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
XrInstance m_instance;
|
||||
std::list<ActionSet> m_actionSets;
|
||||
std::unordered_map<XrPath /*interaction profile*/, std::vector<ActionBinding>> m_actionBindings;
|
||||
|
||||
friend void AttachActionsToSession(XrInstance instance,
|
||||
XrSession session,
|
||||
const std::vector<const xr::ActionContext*>& actionContexts);
|
||||
friend void SyncActions(XrSession session, const std::vector<const xr::ActionContext*>& actionContexts);
|
||||
};
|
||||
|
||||
inline void AttachActionsToSession(XrInstance instance,
|
||||
XrSession session,
|
||||
const std::vector<const xr::ActionContext*>& actionContexts) {
|
||||
// Collect action bindings for each context and summarize using interaction profile path as key.
|
||||
std::unordered_map<XrPath, std::vector<XrActionSuggestedBinding>> allBindings;
|
||||
for (const xr::ActionContext* actionContext : actionContexts) {
|
||||
for (const auto& [profilePath, stringBindings] : actionContext->m_actionBindings) {
|
||||
for (const auto& [actionPath, binding] : stringBindings) {
|
||||
allBindings[profilePath].emplace_back(
|
||||
XrActionSuggestedBinding{actionPath, xr::StringToPath(instance, binding.c_str())});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [interactionProfile, suggestedBindings] : allBindings) {
|
||||
XrInteractionProfileSuggestedBinding bindings{XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING};
|
||||
bindings.interactionProfile = interactionProfile;
|
||||
bindings.suggestedBindings = suggestedBindings.data();
|
||||
bindings.countSuggestedBindings = static_cast<uint32_t>(suggestedBindings.size());
|
||||
CHECK_XRCMD(xrSuggestInteractionProfileBindings(instance, &bindings));
|
||||
}
|
||||
|
||||
std::vector<XrActionSet> actionSetHandles;
|
||||
for (const xr::ActionContext* actionContext : actionContexts) {
|
||||
for (const xr::ActionSet& actionSet : actionContext->m_actionSets) {
|
||||
actionSetHandles.push_back(actionSet.Handle());
|
||||
}
|
||||
}
|
||||
|
||||
if (!std::empty(actionSetHandles)) {
|
||||
XrSessionActionSetsAttachInfo attachInfo{XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO};
|
||||
attachInfo.countActionSets = static_cast<uint32_t>(std::size(actionSetHandles));
|
||||
attachInfo.actionSets = actionSetHandles.data();
|
||||
CHECK_XRCMD(xrAttachSessionActionSets(session, &attachInfo));
|
||||
}
|
||||
}
|
||||
|
||||
inline void SyncActions(XrSession session, const std::vector<const xr::ActionContext*>& actionContexts) {
|
||||
std::vector<XrActiveActionSet> activeActionSets;
|
||||
|
||||
for (const xr::ActionContext* actionContext : actionContexts) {
|
||||
for (const xr::ActionSet& actionSet : actionContext->m_actionSets) {
|
||||
if (!actionSet.Active()) {
|
||||
continue;
|
||||
}
|
||||
if (std::empty(actionSet.DeclaredSubactionPaths())) {
|
||||
activeActionSets.emplace_back(XrActiveActionSet{actionSet.Handle(), XR_NULL_PATH});
|
||||
} else {
|
||||
for (const XrPath& subactionPath : actionSet.DeclaredSubactionPaths()) {
|
||||
activeActionSets.emplace_back(XrActiveActionSet{actionSet.Handle(), subactionPath});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!activeActionSets.empty()) {
|
||||
XrActionsSyncInfo syncInfo{XR_TYPE_ACTIONS_SYNC_INFO};
|
||||
syncInfo.countActiveActionSets = static_cast<uint32_t>(std::size(activeActionSets));
|
||||
syncInfo.activeActionSets = activeActionSets.data();
|
||||
CHECK_XRCMD(xrSyncActions(session, &syncInfo));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace xr
|
|
@ -5,7 +5,11 @@
|
|||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <stdarg.h>
|
||||
#include "XrToString.h"
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define CHECK_XRCMD(cmd) xr::detail::_CheckXrResult(cmd, #cmd, FILE_AND_LINE)
|
||||
#define CHECK_XRRESULT(res, cmdStr) xr::detail::_CheckXrResult(res, cmdStr, FILE_AND_LINE)
|
||||
|
|
|
@ -9,32 +9,37 @@
|
|||
|
||||
namespace xr {
|
||||
struct ExtensionContext : xr::ExtensionDispatchTable {
|
||||
bool SupportsD3D11;
|
||||
bool SupportsD3D12;
|
||||
bool SupportsDepthInfo;
|
||||
bool SupportsVisibilityMask;
|
||||
bool SupportsUnboundedSpace;
|
||||
bool SupportsSpatialAnchor;
|
||||
bool SupportsHandInteraction;
|
||||
bool SupportsEyeGazeInteraction;
|
||||
bool SupportsHandJointTracking;
|
||||
bool SupportsHandMeshTracking;
|
||||
bool SupportsSpatialGraphBridge;
|
||||
bool SupportsControllerModel;
|
||||
bool SupportsSecondaryViewConfiguration;
|
||||
bool SupportsAppContainer;
|
||||
bool SupportsHolographicWindowAttachment;
|
||||
bool SupportsSamsungOdysseyController;
|
||||
bool SupportsHPMixedRealityController;
|
||||
bool SupportsSpatialAnchorExport;
|
||||
bool SupportsSpatialAnchorPersistence;
|
||||
bool SupportsPerceptionAnchorInterop;
|
||||
bool SupportsColorScaleBias;
|
||||
bool SupportsSceneUnderstanding;
|
||||
bool SupportsSceneUnderstandingSerialization;
|
||||
bool SupportsReprojectionConfiguration;
|
||||
bool SupportsD3D11{false};
|
||||
bool SupportsD3D12{false};
|
||||
bool SupportsDepthInfo{false};
|
||||
bool SupportsVisibilityMask{false};
|
||||
bool SupportsUnboundedSpace{false};
|
||||
bool SupportsSpatialAnchor{false};
|
||||
bool SupportsHandInteraction{false};
|
||||
bool SupportsEyeGazeInteraction{false};
|
||||
bool SupportsHandJointTracking{false};
|
||||
bool SupportsHandMeshTracking{false};
|
||||
bool SupportsSpatialGraphBridge{false};
|
||||
bool SupportsControllerModel{false};
|
||||
bool SupportsSecondaryViewConfiguration{false};
|
||||
bool SupportsAppContainer{false};
|
||||
bool SupportsHolographicWindowAttachment{false};
|
||||
bool SupportsSamsungOdysseyController{false};
|
||||
bool SupportsHPMixedRealityController{false};
|
||||
bool SupportsSpatialAnchorPersistence{false};
|
||||
bool SupportsPerceptionAnchorInterop{false};
|
||||
bool SupportsColorScaleBias{false};
|
||||
bool SupportsSceneUnderstanding{false};
|
||||
bool SupportsSceneUnderstandingSerialization{false};
|
||||
bool SupportsReprojectionConfiguration{false};
|
||||
|
||||
std::vector<const char*> EnabledExtensions;
|
||||
|
||||
inline bool IsEnabled(const char* extensionName) const {
|
||||
const auto it = std::find_if(
|
||||
EnabledExtensions.begin(), EnabledExtensions.end(), [&extensionName](auto&& i) { return 0 == strcmp(i, extensionName); });
|
||||
return it != EnabledExtensions.end();
|
||||
}
|
||||
};
|
||||
|
||||
inline ExtensionContext CreateExtensionContext(const std::vector<const char*>& requestedExtensions) {
|
||||
|
@ -51,44 +56,37 @@ namespace xr {
|
|||
}
|
||||
}
|
||||
|
||||
auto isExtensionEnabled = [&list = extensions.EnabledExtensions](const char* extensionName) -> bool {
|
||||
return list.end() !=
|
||||
std::find_if(list.begin(), list.end(), [&extensionName](auto&& i) { return 0 == strcmp(i, extensionName); });
|
||||
};
|
||||
|
||||
// Record enabled extensions in extension context as bool for easy usage.
|
||||
#ifdef XR_USE_GRAPHICS_API_D3D11
|
||||
extensions.SupportsD3D11 = isExtensionEnabled(XR_KHR_D3D11_ENABLE_EXTENSION_NAME);
|
||||
extensions.SupportsD3D11 = extensions.IsEnabled(XR_KHR_D3D11_ENABLE_EXTENSION_NAME);
|
||||
#endif
|
||||
#ifdef XR_USE_GRAPHICS_API_D3D12
|
||||
extensions.SupportsD3D12 = isExtensionEnabled(XR_KHR_D3D12_ENABLE_EXTENSION_NAME);
|
||||
extensions.SupportsD3D12 = extensions.IsEnabled(XR_KHR_D3D12_ENABLE_EXTENSION_NAME);
|
||||
#endif
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
extensions.SupportsAppContainer = isExtensionEnabled(XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME);
|
||||
extensions.SupportsHolographicWindowAttachment = isExtensionEnabled(XR_MSFT_HOLOGRAPHIC_WINDOW_ATTACHMENT_EXTENSION_NAME);
|
||||
extensions.SupportsPerceptionAnchorInterop = isExtensionEnabled(XR_MSFT_PERCEPTION_ANCHOR_INTEROP_EXTENSION_NAME);
|
||||
extensions.SupportsAppContainer = extensions.IsEnabled(XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME);
|
||||
extensions.SupportsHolographicWindowAttachment = extensions.IsEnabled(XR_MSFT_HOLOGRAPHIC_WINDOW_ATTACHMENT_EXTENSION_NAME);
|
||||
extensions.SupportsPerceptionAnchorInterop = extensions.IsEnabled(XR_MSFT_PERCEPTION_ANCHOR_INTEROP_EXTENSION_NAME);
|
||||
#endif
|
||||
extensions.SupportsDepthInfo = isExtensionEnabled(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME);
|
||||
extensions.SupportsVisibilityMask = isExtensionEnabled(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME);
|
||||
extensions.SupportsUnboundedSpace = isExtensionEnabled(XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialAnchor = isExtensionEnabled(XR_MSFT_SPATIAL_ANCHOR_EXTENSION_NAME);
|
||||
extensions.SupportsHandInteraction = isExtensionEnabled(XR_MSFT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
extensions.SupportsEyeGazeInteraction = isExtensionEnabled(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
extensions.SupportsSecondaryViewConfiguration = isExtensionEnabled(XR_MSFT_SECONDARY_VIEW_CONFIGURATION_EXTENSION_NAME);
|
||||
extensions.SupportsHandJointTracking = isExtensionEnabled(XR_EXT_HAND_TRACKING_EXTENSION_NAME);
|
||||
extensions.SupportsHandMeshTracking = isExtensionEnabled(XR_MSFT_HAND_TRACKING_MESH_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialGraphBridge = isExtensionEnabled(XR_MSFT_SPATIAL_GRAPH_BRIDGE_EXTENSION_NAME);
|
||||
extensions.SupportsControllerModel = isExtensionEnabled(XR_MSFT_CONTROLLER_MODEL_EXTENSION_NAME);
|
||||
extensions.SupportsSamsungOdysseyController = isExtensionEnabled(XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME);
|
||||
extensions.SupportsHPMixedRealityController = isExtensionEnabled(XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
|
||||
extensions.SupportsColorScaleBias = isExtensionEnabled(XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME);
|
||||
extensions.SupportsSceneUnderstanding = isExtensionEnabled(XR_MSFT_SCENE_UNDERSTANDING_EXTENSION_NAME);
|
||||
extensions.SupportsSceneUnderstandingSerialization = isExtensionEnabled(XR_MSFT_SCENE_UNDERSTANDING_SERIALIZATION_EXTENSION_NAME);
|
||||
extensions.SupportsReprojectionConfiguration = isExtensionEnabled(XR_MSFT_COMPOSITION_LAYER_REPROJECTION_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialAnchorExport = isExtensionEnabled(XR_MSFT_SPATIAL_ANCHOR_EXPORT_PREVIEW_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialAnchorPersistence = isExtensionEnabled(XR_MSFT_SPATIAL_ANCHOR_PERSISTENCE_EXTENSION_NAME);
|
||||
extensions.SupportsDepthInfo = extensions.IsEnabled(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME);
|
||||
extensions.SupportsVisibilityMask = extensions.IsEnabled(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME);
|
||||
extensions.SupportsUnboundedSpace = extensions.IsEnabled(XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialAnchor = extensions.IsEnabled(XR_MSFT_SPATIAL_ANCHOR_EXTENSION_NAME);
|
||||
extensions.SupportsHandInteraction = extensions.IsEnabled(XR_MSFT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
extensions.SupportsEyeGazeInteraction = extensions.IsEnabled(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
extensions.SupportsSecondaryViewConfiguration = extensions.IsEnabled(XR_MSFT_SECONDARY_VIEW_CONFIGURATION_EXTENSION_NAME);
|
||||
extensions.SupportsHandJointTracking = extensions.IsEnabled(XR_EXT_HAND_TRACKING_EXTENSION_NAME);
|
||||
extensions.SupportsHandMeshTracking = extensions.IsEnabled(XR_MSFT_HAND_TRACKING_MESH_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialGraphBridge = extensions.IsEnabled(XR_MSFT_SPATIAL_GRAPH_BRIDGE_EXTENSION_NAME);
|
||||
extensions.SupportsControllerModel = extensions.IsEnabled(XR_MSFT_CONTROLLER_MODEL_EXTENSION_NAME);
|
||||
extensions.SupportsSamsungOdysseyController = extensions.IsEnabled(XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME);
|
||||
extensions.SupportsHPMixedRealityController = extensions.IsEnabled(XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
|
||||
extensions.SupportsColorScaleBias = extensions.IsEnabled(XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME);
|
||||
extensions.SupportsSceneUnderstanding = extensions.IsEnabled(XR_MSFT_SCENE_UNDERSTANDING_EXTENSION_NAME);
|
||||
extensions.SupportsSceneUnderstandingSerialization = extensions.IsEnabled(XR_MSFT_SCENE_UNDERSTANDING_SERIALIZATION_EXTENSION_NAME);
|
||||
extensions.SupportsReprojectionConfiguration = extensions.IsEnabled(XR_MSFT_COMPOSITION_LAYER_REPROJECTION_EXTENSION_NAME);
|
||||
extensions.SupportsSpatialAnchorPersistence = extensions.IsEnabled(XR_MSFT_SPATIAL_ANCHOR_PERSISTENCE_EXTENSION_NAME);
|
||||
|
||||
return extensions;
|
||||
}
|
||||
} // namespace xr
|
||||
|
||||
|
|
|
@ -58,7 +58,11 @@
|
|||
#endif
|
||||
|
||||
#if XR_MSFT_spatial_graph_bridge
|
||||
#define FOR_EACH_SPATIAL_GRAPH_BRIDGE_FUNCTION(_) _(xrCreateSpatialGraphNodeSpaceMSFT)
|
||||
#define FOR_EACH_SPATIAL_GRAPH_BRIDGE_FUNCTION(_) \
|
||||
_(xrCreateSpatialGraphNodeSpaceMSFT) \
|
||||
_(xrTryCreateSpatialGraphStaticNodeBindingMSFT) \
|
||||
_(xrDestroySpatialGraphStaticNodeBindingMSFT) \
|
||||
_(xrGetSpatialGraphStaticNodeBindingPropertiesMSFT)
|
||||
#else
|
||||
#define FOR_EACH_SPATIAL_GRAPH_BRIDGE_FUNCTION(_)
|
||||
#endif
|
||||
|
@ -91,21 +95,10 @@
|
|||
#define FOR_EACH_SCENE_UNDERSTANDING_SERIALIZATION_FUNCTION(_) \
|
||||
_(xrDeserializeSceneMSFT) \
|
||||
_(xrGetSerializedSceneFragmentDataMSFT)
|
||||
|
||||
#else
|
||||
#define FOR_EACH_SCENE_UNDERSTANDING_SERIALIZATION_FUNCTION(_)
|
||||
#endif
|
||||
|
||||
#if XR_MSFT_spatial_anchor_export_preview
|
||||
#define FOR_EACH_SPATIAL_ANCHOR_EXPORT_FUNCTION(_) \
|
||||
_(xrCreateSpatialAnchorNeighborhoodDataStreamMSFT) \
|
||||
_(xrReadSpatialAnchorNeighborhoodDataMSFT) \
|
||||
_(xrGetSpatialAnchorExportSufficiencyMSFT) \
|
||||
_(xrDestroySpatialAnchorNeighborhoodDataStreamMSFT)
|
||||
#else
|
||||
#define FOR_EACH_PERCEPTION_ANCHOR_INTEROP_FUNCTION(_)
|
||||
#endif
|
||||
|
||||
#if XR_MSFT_spatial_anchor_persistence
|
||||
#define FOR_EACH_SPATIAL_ANCHOR_PERSISTENCE_FUNCTION(_) \
|
||||
_(xrCreateSpatialAnchorStoreConnectionMSFT) \
|
||||
|
@ -119,7 +112,11 @@
|
|||
#define FOR_EACH_SPATIAL_ANCHOR_PERSISTENCE_FUNCTION(_)
|
||||
#endif
|
||||
|
||||
#if XR_MSFT_composition_layer_reprojection
|
||||
#define FOR_EACH_COMPOSITION_LAYER_REPROJECTION_FUNCTION(_) _(xrEnumerateReprojectionModesMSFT)
|
||||
#else
|
||||
#define FOR_EACH_COMPOSITION_LAYER_REPROJECTION_FUNCTION(_)
|
||||
#endif
|
||||
|
||||
#define FOR_EACH_EXTENSION_FUNCTION(_) \
|
||||
FOR_EACH_WIN32_EXTENSION_FUNCTION(_) \
|
||||
|
@ -133,15 +130,21 @@
|
|||
FOR_EACH_PERCEPTION_ANCHOR_INTEROP_FUNCTION(_) \
|
||||
FOR_EACH_SCENE_UNDERSTANDING_FUNCTION(_) \
|
||||
FOR_EACH_SCENE_UNDERSTANDING_SERIALIZATION_FUNCTION(_) \
|
||||
FOR_EACH_SPATIAL_ANCHOR_EXPORT_FUNCTION(_) \
|
||||
FOR_EACH_SPATIAL_ANCHOR_PERSISTENCE_FUNCTION(_) \
|
||||
FOR_EACH_COMPOSITION_LAYER_REPROJECTION_FUNCTION(_)
|
||||
|
||||
|
||||
#define GET_INSTANCE_PROC_ADDRESS(name) \
|
||||
(void)xrGetInstanceProcAddr(instance, #name, reinterpret_cast<PFN_xrVoidFunction*>(const_cast<PFN_##name*>(&name)));
|
||||
#define DEFINE_PROC_MEMBER(name) PFN_##name name{nullptr};
|
||||
|
||||
// Define a local variable of given function name and get proc address from given instance handle.
|
||||
// The returned function pointer may be nullptr when the function is not supported by the xr instance.
|
||||
// NOTE: The app should cache the function pointer for the lifetime of the corresponding instance handle,
|
||||
// because this xrGetInstanceProcAddr operation may be expensive to do repeatedly in a frame loop.
|
||||
#define DEFINE_XR_FUNCTION_AND_GET_INSTANCE_PROC_ADDRESS(xrFunctionName, instance, PFN_xrGetInstanceProcAddr) \
|
||||
PFN_##xrFunctionName xrFunctionName = nullptr; \
|
||||
(void)(*PFN_xrGetInstanceProcAddr)(instance, #xrFunctionName, (PFN_xrVoidFunction*)&xrFunctionName);
|
||||
|
||||
namespace xr {
|
||||
struct ExtensionDispatchTable {
|
||||
FOR_EACH_EXTENSION_FUNCTION(DEFINE_PROC_MEMBER);
|
||||
|
@ -156,4 +159,3 @@ namespace xr {
|
|||
#undef DEFINE_PROC_MEMBER
|
||||
#undef GET_INSTANCE_PROC_ADDRESS
|
||||
#undef FOR_EACH_EXTENSION_FUNCTION
|
||||
|
||||
|
|
|
@ -3,18 +3,57 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory.h>
|
||||
#include <functional>
|
||||
#include <string.h>
|
||||
|
||||
namespace xr {
|
||||
template <typename GUID1, typename GUID2>
|
||||
void CopyGuid(GUID1& dest, const GUID2& src) noexcept {
|
||||
static_assert(sizeof(GUID1) == sizeof(GUID2), "GUID sizes must be equal");
|
||||
#ifdef _MSC_VER
|
||||
memcpy_s(&dest, sizeof(GUID1), &src, sizeof(GUID2));
|
||||
#else
|
||||
memcpy(&dest, &src, sizeof(GUID2));
|
||||
#endif
|
||||
|
||||
// GUID_DEFINED is defined in guiddef.h
|
||||
#ifdef GUID_DEFINED
|
||||
|
||||
inline constexpr GUID ToGuid(const XrUuidMSFT& src) noexcept {
|
||||
GUID dest{};
|
||||
const auto& u = src.bytes;
|
||||
// Data1, Data2, and Data3 are encoded as big-endian for Variant-1
|
||||
dest.Data1 = u[0] * 0x01000000u + u[1] * 0x00010000u + u[2] * 0x00000100u + u[3];
|
||||
dest.Data2 = uint16_t(u[4] * 0x0100u + u[5]);
|
||||
dest.Data3 = uint16_t(u[6] * 0x0100u + u[7]);
|
||||
dest.Data4[0] = u[8];
|
||||
dest.Data4[1] = u[9];
|
||||
dest.Data4[2] = u[10];
|
||||
dest.Data4[3] = u[11];
|
||||
dest.Data4[4] = u[12];
|
||||
dest.Data4[5] = u[13];
|
||||
dest.Data4[6] = u[14];
|
||||
dest.Data4[7] = u[15];
|
||||
return dest;
|
||||
}
|
||||
|
||||
inline constexpr XrUuidMSFT ToXrUuidMSFT(const GUID& src) noexcept {
|
||||
XrUuidMSFT dest{};
|
||||
auto& u = dest.bytes;
|
||||
// Data1, Data2, and Data3 are encoded as big-endian for Variant-1
|
||||
u[0] = uint8_t(src.Data1 >> 24);
|
||||
u[1] = uint8_t(src.Data1 >> 16);
|
||||
u[2] = uint8_t(src.Data1 >> 8);
|
||||
u[3] = uint8_t(src.Data1);
|
||||
|
||||
u[4] = uint8_t(src.Data2 >> 8);
|
||||
u[5] = uint8_t(src.Data2);
|
||||
|
||||
u[6] = uint8_t(src.Data3 >> 8);
|
||||
u[7] = uint8_t(src.Data3);
|
||||
|
||||
u[8] = src.Data4[0];
|
||||
u[9] = src.Data4[1];
|
||||
u[10] = src.Data4[2];
|
||||
u[11] = src.Data4[3];
|
||||
u[12] = src.Data4[4];
|
||||
u[13] = src.Data4[5];
|
||||
u[14] = src.Data4[6];
|
||||
u[15] = src.Data4[7];
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif // GUID_DEFINED
|
||||
} // namespace xr
|
||||
|
|
|
@ -34,7 +34,15 @@ namespace xr {
|
|||
return *this;
|
||||
}
|
||||
|
||||
operator bool() const noexcept {
|
||||
bool operator==(const UniqueExtHandle& other) noexcept {
|
||||
return m_handle == other.m_handle;
|
||||
}
|
||||
|
||||
bool operator!=(const UniqueExtHandle& other) noexcept {
|
||||
return m_handle != other.m_handle;
|
||||
}
|
||||
|
||||
explicit operator bool() const noexcept {
|
||||
return m_handle != XR_NULL_HANDLE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "XrHandle.h"
|
||||
#include "XrStruct.h"
|
||||
#include "XrString.h"
|
||||
|
||||
namespace xr {
|
||||
struct InstanceContext {
|
||||
const XrInstance Handle;
|
||||
const NameVersion AppInfo;
|
||||
const NameVersion EngineInfo;
|
||||
const XrInstanceProperties Properties{XR_TYPE_INSTANCE_PROPERTIES};
|
||||
const XrPath LeftHandPath;
|
||||
const XrPath RightHandPath;
|
||||
|
||||
public:
|
||||
InstanceContext(xr::InstanceHandle instance, NameVersion appInfo, NameVersion engineInfo, XrInstanceProperties instanceProperties)
|
||||
: Handle(instance.Get())
|
||||
, AppInfo(std::move(appInfo))
|
||||
, EngineInfo(std::move(engineInfo))
|
||||
, Properties(std::move(instanceProperties))
|
||||
, m_instance(std::move(instance))
|
||||
, LeftHandPath(xr::StringToPath(Handle, "/user/hand/left"))
|
||||
, RightHandPath(xr::StringToPath(Handle, "/user/hand/right")) {
|
||||
}
|
||||
|
||||
private:
|
||||
xr::InstanceHandle m_instance;
|
||||
};
|
||||
|
||||
inline InstanceContext CreateInstanceContext(NameVersion appInfo, NameVersion engineInfo, const std::vector<const char*>& extensions) {
|
||||
XrInstanceCreateInfo instanceCreateInfo{XR_TYPE_INSTANCE_CREATE_INFO};
|
||||
xr::SetEnabledExtensions(instanceCreateInfo, extensions);
|
||||
xr::SetApplicationInfo(instanceCreateInfo.applicationInfo, appInfo, engineInfo);
|
||||
|
||||
xr::InstanceHandle instance;
|
||||
CHECK_XRCMD(xrCreateInstance(&instanceCreateInfo, instance.Put()));
|
||||
|
||||
XrInstanceProperties instanceProperties{XR_TYPE_INSTANCE_PROPERTIES};
|
||||
CHECK_XRCMD(xrGetInstanceProperties(instance.Get(), &instanceProperties));
|
||||
|
||||
return xr::InstanceContext(std::move(instance), std::move(appInfo), std::move(engineInfo), std::move(instanceProperties));
|
||||
}
|
||||
|
||||
} // namespace xr
|
|
@ -459,24 +459,22 @@ namespace xr::math {
|
|||
return a / std::sqrt(Dot(a, a));
|
||||
}
|
||||
|
||||
inline bool IsValidFov(const XrFovf& fov) {
|
||||
if (fov.angleRight >= DirectX::XM_PIDIV2 || fov.angleLeft <= -DirectX::XM_PIDIV2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fov.angleUp >= DirectX::XM_PIDIV2 || fov.angleDown <= -DirectX::XM_PIDIV2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2 * n / (r - l) 0 0 0
|
||||
// 0 2 * n / (t - b) 0 0
|
||||
// (r + l) / (r - l) (t + b) / (t - b) f / (n - f) -1
|
||||
// 0 0 n*f / (n - f) 0
|
||||
inline DirectX::XMMATRIX ComposeProjectionMatrix(const XrFovf& fov, const NearFar& nearFar) {
|
||||
if (!IsValidFov(fov)) {
|
||||
const auto ValidateFovAngle = [](float angle) {
|
||||
if (angle >= DirectX::XM_PIDIV2 || angle <= -DirectX::XM_PIDIV2) {
|
||||
throw std::runtime_error("Invalid projection specification");
|
||||
}
|
||||
};
|
||||
ValidateFovAngle(fov.angleLeft);
|
||||
ValidateFovAngle(fov.angleRight);
|
||||
ValidateFovAngle(fov.angleUp);
|
||||
ValidateFovAngle(fov.angleDown);
|
||||
if (fabs(fov.angleLeft - fov.angleRight) < std::numeric_limits<float>::epsilon() ||
|
||||
fabs(fov.angleUp - fov.angleDown) < std::numeric_limits<float>::epsilon()) {
|
||||
throw std::runtime_error("Invalid projection specification");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "XrEnumerate.h"
|
||||
#include "XrSystemContext.h"
|
||||
#include "XrViewConfiguration.h"
|
||||
|
||||
namespace xr {
|
||||
struct SessionContext {
|
||||
const XrSession Handle;
|
||||
const XrViewConfigurationType PrimaryViewConfigurationType;
|
||||
const XrEnvironmentBlendMode PrimaryViewConfigurationBlendMode;
|
||||
std::vector<XrViewConfigurationType> EnabledSecondaryViewConfigurationTypes;
|
||||
|
||||
std::vector<DXGI_FORMAT> SupportedColorSwapchainFormats;
|
||||
std::vector<DXGI_FORMAT> SupportedDepthSwapchainFormats;
|
||||
|
||||
// note: all runtimes must support VIEW and LOCAL reference spaces.
|
||||
std::vector<XrReferenceSpaceType> SupportedReferenceSpaces;
|
||||
bool SupportsStageSpace;
|
||||
bool SupportsUnboundedSpace;
|
||||
|
||||
explicit SessionContext(xr::SessionHandle sessionHandle,
|
||||
const xr::SystemContext& system,
|
||||
const xr::ExtensionContext& extensions,
|
||||
XrViewConfigurationType primaryViewConfigurationType,
|
||||
const std::vector<XrViewConfigurationType>& appEnabledSecondaryViewConfigurationTypes,
|
||||
const std::vector<DXGI_FORMAT>& appSupportedColorSwapchainFormats,
|
||||
const std::vector<DXGI_FORMAT>& appSupportedDepthSwapchainFormats)
|
||||
: Handle(sessionHandle.Get())
|
||||
, m_session(std::move(sessionHandle))
|
||||
, PrimaryViewConfigurationType(primaryViewConfigurationType)
|
||||
, PrimaryViewConfigurationBlendMode(system.ViewProperties.at(primaryViewConfigurationType).BlendMode) {
|
||||
for (const auto secondaryViewConfigurationType : appEnabledSecondaryViewConfigurationTypes) {
|
||||
if (!xr::Contains(system.SupportedSecondaryViewConfigurationTypes, secondaryViewConfigurationType)) {
|
||||
continue; // Not supported by the system
|
||||
}
|
||||
EnabledSecondaryViewConfigurationTypes.push_back(secondaryViewConfigurationType);
|
||||
}
|
||||
|
||||
for (auto systemSupportedSwapchainFormat : xr::EnumerateSwapchainFormats(Handle)) {
|
||||
if (xr::Contains(appSupportedColorSwapchainFormats, systemSupportedSwapchainFormat)) {
|
||||
SupportedColorSwapchainFormats.push_back(static_cast<DXGI_FORMAT>(systemSupportedSwapchainFormat));
|
||||
}
|
||||
if (xr::Contains(appSupportedDepthSwapchainFormats, systemSupportedSwapchainFormat)) {
|
||||
SupportedDepthSwapchainFormats.push_back(static_cast<DXGI_FORMAT>(systemSupportedSwapchainFormat));
|
||||
}
|
||||
}
|
||||
|
||||
SupportedReferenceSpaces = xr::EnumerateReferenceSpaceTypes(Handle);
|
||||
assert(xr::Contains(SupportedReferenceSpaces, XR_REFERENCE_SPACE_TYPE_VIEW));
|
||||
assert(xr::Contains(SupportedReferenceSpaces, XR_REFERENCE_SPACE_TYPE_LOCAL));
|
||||
SupportsStageSpace = xr::Contains(SupportedReferenceSpaces, XR_REFERENCE_SPACE_TYPE_STAGE);
|
||||
SupportsUnboundedSpace =
|
||||
extensions.SupportsUnboundedSpace && xr::Contains(SupportedReferenceSpaces, XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT);
|
||||
}
|
||||
|
||||
private:
|
||||
xr::SessionHandle m_session;
|
||||
};
|
||||
|
||||
inline std::vector<XrViewConfigurationType> GetAllViewConfigurationTypes(const SessionContext& sessionContext) {
|
||||
std::vector<XrViewConfigurationType> result;
|
||||
result.push_back(sessionContext.PrimaryViewConfigurationType);
|
||||
result.insert(result.end(),
|
||||
sessionContext.EnabledSecondaryViewConfigurationTypes.begin(),
|
||||
sessionContext.EnabledSecondaryViewConfigurationTypes.end());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace xr
|
|
@ -0,0 +1,69 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include "XrStruct.h"
|
||||
#include "XrHandle.h"
|
||||
#include "XrGuid.h"
|
||||
#include "XrExtensions.h"
|
||||
|
||||
namespace xr {
|
||||
class SpatialGraphStaticNodeBindingHandle : public xr::UniqueExtHandle<XrSpatialGraphStaticNodeBindingMSFT> {};
|
||||
|
||||
// GUID_DEFINED is defined in guiddef.h
|
||||
#ifdef GUID_DEFINED
|
||||
|
||||
struct SpatialGraphStaticNodeBindingProperties {
|
||||
GUID nodeId;
|
||||
XrPosef poseInNodeSpace;
|
||||
};
|
||||
|
||||
inline void SetNodeId(XrSpatialGraphNodeSpaceCreateInfoMSFT& createInfo, const GUID& guid) {
|
||||
#ifdef __STDC_LIB_EXT1__
|
||||
memcpy_s(&createInfo.nodeId, sizeof(createInfo.nodeId), &guid, sizeof(guid));
|
||||
#else
|
||||
memcpy(&createInfo.nodeId, &guid, sizeof(guid));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline const GUID& GetNodeIdAsGuid(const XrSpatialGraphStaticNodeBindingPropertiesMSFT& properties) {
|
||||
return reinterpret_cast<GUID const&>(properties.nodeId);
|
||||
}
|
||||
|
||||
inline xr::SpaceHandle CreateSpatialGraphNodeSpace(const xr::ExtensionDispatchTable& extensions,
|
||||
XrSession session,
|
||||
XrSpatialGraphNodeTypeMSFT nodeType,
|
||||
const GUID& nodeId,
|
||||
const XrPosef& pose) {
|
||||
XrSpatialGraphNodeSpaceCreateInfoMSFT spaceCreateInfo{XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT};
|
||||
spaceCreateInfo.nodeType = nodeType;
|
||||
spaceCreateInfo.pose = pose;
|
||||
SetNodeId(spaceCreateInfo, nodeId);
|
||||
xr::SpaceHandle space;
|
||||
CHECK_XRCMD(extensions.xrCreateSpatialGraphNodeSpaceMSFT(session, &spaceCreateInfo, space.Put()));
|
||||
return space;
|
||||
}
|
||||
|
||||
inline xr::SpatialGraphStaticNodeBindingHandle TryCreateSpatialGraphStaticNodeBinding(
|
||||
const xr::ExtensionDispatchTable& extensions, XrSession session, XrSpace space, XrPosef poseInSpace, XrTime time) {
|
||||
xr::SpatialGraphStaticNodeBindingHandle nodeBinding;
|
||||
XrSpatialGraphStaticNodeBindingCreateInfoMSFT createInfo{XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_CREATE_INFO_MSFT};
|
||||
createInfo.space = space;
|
||||
createInfo.poseInSpace = poseInSpace;
|
||||
createInfo.time = time;
|
||||
CHECK_XRCMD(extensions.xrTryCreateSpatialGraphStaticNodeBindingMSFT(
|
||||
session, &createInfo, nodeBinding.Put(extensions.xrDestroySpatialGraphStaticNodeBindingMSFT)));
|
||||
return nodeBinding;
|
||||
}
|
||||
|
||||
inline SpatialGraphStaticNodeBindingProperties GetSpatialGraphStaticNodeBindingProperties(
|
||||
const xr::ExtensionDispatchTable& extensions, XrSpatialGraphStaticNodeBindingMSFT nodeBinding) {
|
||||
XrSpatialGraphStaticNodeBindingPropertiesMSFT properties{XR_TYPE_SPATIAL_GRAPH_STATIC_NODE_BINDING_PROPERTIES_MSFT};
|
||||
CHECK_XRCMD(extensions.xrGetSpatialGraphStaticNodeBindingPropertiesMSFT(nodeBinding, nullptr, &properties));
|
||||
return {GetNodeIdAsGuid(properties), properties.poseInNodeSpace};
|
||||
}
|
||||
#endif // GUID_DEFINED
|
||||
} // namespace xr
|
|
@ -48,7 +48,7 @@ namespace xr {
|
|||
std::wstring wideText;
|
||||
const int wideLength = ::MultiByteToWideChar(CP_UTF8, 0, utf8Text.data(), (int)utf8Text.size(), nullptr, 0);
|
||||
if (wideLength == 0) {
|
||||
DEBUG_PRINT("utf8_to_wide get size error: {}", ::GetLastError());
|
||||
DEBUG_PRINT("utf8_to_wide get size error.");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace xr {
|
|||
wideText.resize(wideLength, 0);
|
||||
const int length = ::MultiByteToWideChar(CP_UTF8, 0, utf8Text.data(), (int)utf8Text.size(), wideText.data(), wideLength);
|
||||
if (length != wideLength) {
|
||||
DEBUG_PRINT("utf8_to_wide convert string error: {}", ::GetLastError());
|
||||
DEBUG_PRINT("utf8_to_wide convert string error.");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace xr {
|
|||
std::string narrowText;
|
||||
int narrowLength = ::WideCharToMultiByte(CP_UTF8, 0, wideText.data(), (int)wideText.size(), nullptr, 0, nullptr, nullptr);
|
||||
if (narrowLength == 0) {
|
||||
DEBUG_PRINT("wide_to_utf8 get size error: {}", ::GetLastError());
|
||||
DEBUG_PRINT("wide_to_utf8 get size error.");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace xr {
|
|||
const int length =
|
||||
::WideCharToMultiByte(CP_UTF8, 0, wideText.data(), (int)wideText.size(), narrowText.data(), narrowLength, nullptr, nullptr);
|
||||
if (length != narrowLength) {
|
||||
DEBUG_PRINT("wide_to_utf8 convert string error: {}", ::GetLastError());
|
||||
DEBUG_PRINT("wide_to_utf8 convert string error.");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include "XrEnumerate.h"
|
||||
#include "XrExtensionContext.h"
|
||||
#include "XrViewConfiguration.h"
|
||||
#include "XrStruct.h"
|
||||
|
||||
namespace xr {
|
||||
struct SystemContext {
|
||||
XrSystemId Id = XR_NULL_SYSTEM_ID;
|
||||
XrFormFactor FormFactor{};
|
||||
XrSystemProperties Properties{XR_TYPE_SYSTEM_PROPERTIES};
|
||||
XrSystemHandTrackingPropertiesEXT HandTrackingProperties{XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT};
|
||||
XrSystemHandTrackingMeshPropertiesMSFT HandMeshProperties{XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT};
|
||||
XrSystemEyeGazeInteractionPropertiesEXT EyeGazeInteractionProperties{XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT};
|
||||
|
||||
std::vector<XrViewConfigurationType> SupportedPrimaryViewConfigurationTypes;
|
||||
std::vector<XrViewConfigurationType> SupportedSecondaryViewConfigurationTypes;
|
||||
std::unordered_map<XrViewConfigurationType, xr::ViewProperties> ViewProperties;
|
||||
};
|
||||
|
||||
inline std::optional<xr::SystemContext>
|
||||
CreateSystemContext(XrInstance instance,
|
||||
const xr::ExtensionContext& extensions,
|
||||
XrFormFactor formFactor,
|
||||
const std::vector<XrViewConfigurationType>& appSupportedViewConfigurationTypes,
|
||||
const std::vector<XrEnvironmentBlendMode>& appSupportedEnvironmentBlendMode) {
|
||||
xr::SystemContext system{};
|
||||
XrSystemGetInfo systemInfo{XR_TYPE_SYSTEM_GET_INFO};
|
||||
systemInfo.formFactor = formFactor;
|
||||
XrResult result = xrGetSystem(instance, &systemInfo, &system.Id);
|
||||
if (result == XR_ERROR_FORM_FACTOR_UNAVAILABLE) {
|
||||
return std::nullopt; // Cannot find a system with given form factor
|
||||
} else {
|
||||
CHECK_XRCMD(result);
|
||||
}
|
||||
|
||||
system.FormFactor = formFactor;
|
||||
|
||||
// Initialize system properties including extension system properties.
|
||||
if (extensions.SupportsHandJointTracking) {
|
||||
xr::InsertExtensionStruct(system.Properties, system.HandTrackingProperties);
|
||||
}
|
||||
if (extensions.SupportsHandMeshTracking) {
|
||||
xr::InsertExtensionStruct(system.Properties, system.HandMeshProperties);
|
||||
}
|
||||
if (extensions.SupportsEyeGazeInteraction) {
|
||||
xr::InsertExtensionStruct(system.Properties, system.EyeGazeInteractionProperties);
|
||||
}
|
||||
CHECK_XRCMD(xrGetSystemProperties(instance, system.Id, &system.Properties));
|
||||
|
||||
// Initialize view configuration properties and environment blend modes
|
||||
const std::vector<XrViewConfigurationType> systemSupportedViewConfigurationTypes =
|
||||
xr::EnumerateViewConfigurations(instance, system.Id);
|
||||
|
||||
for (const auto viewConfigType : appSupportedViewConfigurationTypes) {
|
||||
if (!xr::Contains(systemSupportedViewConfigurationTypes, viewConfigType)) {
|
||||
continue; // The system doesn't support this view configuration
|
||||
}
|
||||
|
||||
auto viewProperties = xr::CreateViewProperties(instance, system.Id, viewConfigType, appSupportedEnvironmentBlendMode);
|
||||
if (viewProperties.SupportedBlendModes.size() > 0) {
|
||||
system.ViewProperties.emplace(viewConfigType, viewProperties);
|
||||
|
||||
if (xr::IsPrimaryViewConfigurationType(viewConfigType)) {
|
||||
system.SupportedPrimaryViewConfigurationTypes.push_back(viewConfigType);
|
||||
} else {
|
||||
system.SupportedSecondaryViewConfigurationTypes.push_back(viewConfigType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return system;
|
||||
}
|
||||
} // namespace xr
|
|
@ -52,5 +52,6 @@ namespace xr {
|
|||
MAKE_TO_STRING_FUNCS(XrVisibilityMaskTypeKHR);
|
||||
MAKE_TO_STRING_FUNCS(XrReprojectionModeMSFT);
|
||||
MAKE_TO_STRING_FUNCS(XrSceneComponentTypeMSFT);
|
||||
MAKE_TO_STRING_FUNCS(XrSceneComputeFeatureMSFT);
|
||||
MAKE_TO_STRING_FUNCS(XrSpatialGraphNodeTypeMSFT);
|
||||
} // namespace xr
|
||||
|
||||
|
|
|
@ -14,9 +14,25 @@ inline bool operator!=(const XrUuidMSFT& lh, const XrUuidMSFT& rh) noexcept {
|
|||
return !(lh == rh);
|
||||
}
|
||||
|
||||
inline bool operator<(const XrUuidMSFT& lh, const XrUuidMSFT& rh) noexcept {
|
||||
return memcmp(&lh, &rh, sizeof(XrUuidMSFT)) < 0;
|
||||
}
|
||||
|
||||
namespace xr {
|
||||
// Type safe UUID for ensuring that two different types of UUIDs do not get mixed.
|
||||
// Example: Mesh::Id and Plane::Id.
|
||||
// Example:
|
||||
// XrUuidMSFT uuid {};
|
||||
// TypedUuid<Plane> planeId(uuid); // allowed
|
||||
// TypedUuid<Mesh> meshId{planeId}; // compile error
|
||||
// meshId = planeId; // compile error
|
||||
// meshId = uuid; // allowed
|
||||
// uuid = meshId; // compiler error
|
||||
// uuid = static_cast<XrUuidMSFT>(meshId); // allowed
|
||||
// if (meshId < meshId_2) {} // allowed
|
||||
// if (meshId != planeId) {} // compiler error
|
||||
// To access the uint8_t[16] array in TypedUuid, use
|
||||
// static_cast<XrUuidMSFT>(meshId).bytes
|
||||
//
|
||||
template <typename Type>
|
||||
struct TypedUuid {
|
||||
TypedUuid() noexcept = default;
|
||||
|
@ -41,9 +57,14 @@ namespace xr {
|
|||
return m_uuid != other.m_uuid;
|
||||
}
|
||||
|
||||
bool operator<(const TypedUuid& other) const noexcept {
|
||||
return m_uuid < other.m_uuid;
|
||||
}
|
||||
|
||||
private:
|
||||
XrUuidMSFT m_uuid;
|
||||
};
|
||||
|
||||
} // namespace xr
|
||||
|
||||
namespace std {
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xr {
|
||||
// The properties of a view configuration that's immutable for a system
|
||||
struct ViewProperties {
|
||||
XrViewConfigurationType Type;
|
||||
XrBool32 FovMutable;
|
||||
XrEnvironmentBlendMode BlendMode;
|
||||
std::vector<XrEnvironmentBlendMode> SupportedBlendModes;
|
||||
};
|
||||
|
||||
// The state of a view configuration that's changing during a session but immutable for a frame
|
||||
struct ViewConfigurationState {
|
||||
XrViewConfigurationType Type;
|
||||
std::vector<XrViewConfigurationView> ViewConfigViews;
|
||||
std::vector<XrView> Views;
|
||||
bool Active;
|
||||
};
|
||||
|
||||
constexpr bool IsPrimaryViewConfigurationType(XrViewConfigurationType type) {
|
||||
return type == XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO || type == XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO ||
|
||||
type == XR_VIEW_CONFIGURATION_TYPE_PRIMARY_QUAD_VARJO;
|
||||
}
|
||||
|
||||
inline ViewProperties CreateViewProperties(XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrViewConfigurationType viewConfigurationType,
|
||||
const std::vector<XrEnvironmentBlendMode>& appSupportedEnvironmentBlendModes) {
|
||||
XrViewConfigurationProperties viewConfigProperties{XR_TYPE_VIEW_CONFIGURATION_PROPERTIES};
|
||||
CHECK_XRCMD(xrGetViewConfigurationProperties(instance, systemId, viewConfigurationType, &viewConfigProperties));
|
||||
|
||||
ViewProperties properties{};
|
||||
properties.Type = viewConfigurationType;
|
||||
properties.FovMutable = viewConfigProperties.fovMutable;
|
||||
properties.SupportedBlendModes = xr::EnumerateEnvironmentBlendModes(instance, systemId, viewConfigurationType);
|
||||
properties.BlendMode = xr::PickEnvironmentBlendMode(properties.SupportedBlendModes, appSupportedEnvironmentBlendModes);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
inline ViewConfigurationState CreateViewConfigurationState(XrViewConfigurationType viewConfigurationType,
|
||||
XrInstance instance,
|
||||
XrSystemId systemId) {
|
||||
ViewConfigurationState state{};
|
||||
state.Type = viewConfigurationType;
|
||||
state.ViewConfigViews = xr::EnumerateViewConfigurationViews(instance, systemId, viewConfigurationType);
|
||||
state.Views.resize(state.ViewConfigViews.size(), {XR_TYPE_VIEW});
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
inline bool IsRecommendedSwapchainSizeChanged(const std::vector<XrViewConfigurationView>& oldConfigs,
|
||||
const std::vector<XrViewConfigurationView>& newConfigs) {
|
||||
assert(oldConfigs.size() == newConfigs.size());
|
||||
size_t end = (std::min)(oldConfigs.size(), newConfigs.size());
|
||||
for (size_t i = 0; i < end; i++) {
|
||||
if ((oldConfigs[i].recommendedImageRectWidth != newConfigs[i].recommendedImageRectWidth) ||
|
||||
(oldConfigs[i].recommendedImageRectHeight != newConfigs[i].recommendedImageRectHeight)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace xr
|
Загрузка…
Ссылка в новой задаче