From 158f4207482f9814dc464802c9288e69429cc3e7 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 10 Sep 2023 14:25:14 +0100 Subject: [PATCH] st/oxr: Add XR_MNDX_xdev_space extension header --- .../openxr/XR_MNDX_xdev_space.h | 80 +++++++++++++++++++ .../openxr/openxr_extension_helpers.h | 18 +++++ src/xrt/include/xrt/xrt_openxr_includes.h | 3 +- 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 src/external/openxr_includes/openxr/XR_MNDX_xdev_space.h create mode 100644 src/external/openxr_includes/openxr/openxr_extension_helpers.h diff --git a/src/external/openxr_includes/openxr/XR_MNDX_xdev_space.h b/src/external/openxr_includes/openxr/XR_MNDX_xdev_space.h new file mode 100644 index 000000000..fcfd962b5 --- /dev/null +++ b/src/external/openxr_includes/openxr/XR_MNDX_xdev_space.h @@ -0,0 +1,80 @@ +// Copyright 2023-2024, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Preview header for XR_MNDX_xdev_space extension. + * @author Jakob Bornecrantz + * @ingroup external_openxr + */ +#ifndef XR_MNDX_XDEV_SPACE_H +#define XR_MNDX_XDEV_SPACE_H 1 + +#include "openxr_extension_helpers.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Extension number 445 (444 prefix) +#define XR_MNDX_xdev_space 1 +#define XR_MNDX_xdev_space_SPEC_VERSION 1 +#define XR_MNDX_XDEV_SPACE_EXTENSION_NAME "XR_MNDX_xdev_space" + + +XR_DEFINE_ATOM(XrXDevIdMNDX) +XR_DEFINE_HANDLE(XrXDevListMNDX) + + +XR_STRUCT_ENUM(XR_TYPE_SYSTEM_XDEV_SPACE_PROPERTIES_MNDX, 1000444001); +// XrSystemXDevSpacePropertiesMNDX extends XrSystemProperties +typedef struct XrSystemXDevSpacePropertiesMNDX { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 supportsXDevSpace; +} XrSystemXDevSpacePropertiesMNDX; + +XR_STRUCT_ENUM(XR_TYPE_CREATE_XDEV_LIST_INFO_MNDX, 1000444002); +typedef struct XrCreateXDevListInfoMNDX { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrCreateXDevListInfoMNDX; + +XR_STRUCT_ENUM(XR_TYPE_GET_XDEV_INFO_MNDX, 1000444003); +typedef struct XrGetXDevInfoMNDX { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrXDevIdMNDX id; +} XrGetXDevInfoMNDX; + +XR_STRUCT_ENUM(XR_TYPE_XDEV_PROPERTIES_MNDX, 1000444004); +typedef struct XrXDevPropertiesMNDX { + XrStructureType type; + void* XR_MAY_ALIAS next; + char name[256]; + char serial[256]; + XrBool32 canCreateSpace; +} XrXDevPropertiesMNDX; + +XR_STRUCT_ENUM(XR_TYPE_CREATE_XDEV_SPACE_INFO_MNDX, 1000444005); +typedef struct XrCreateXDevSpaceInfoMNDX { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrXDevListMNDX xdevList; + XrXDevIdMNDX id; + XrPosef offset; +} XrCreateXDevSpaceInfoMNDX; + + +typedef XrResult (XRAPI_PTR *PFN_xrCreateXDevListMNDX)(XrSession session, const XrCreateXDevListInfoMNDX *info, XrXDevListMNDX *xdevList); +typedef XrResult (XRAPI_PTR *PFN_xrGetXDevListGenerationNumberMNDX)(XrXDevListMNDX xdevList, uint64_t *outGeneration); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateXDevsMNDX)(XrXDevListMNDX xdevList, uint32_t xdevCapacityInput, uint32_t* xdevCountOutput, XrXDevIdMNDX* xdevs); +typedef XrResult (XRAPI_PTR *PFN_xrGetXDevPropertiesMNDX)(XrXDevListMNDX xdevList, const XrGetXDevInfoMNDX *info, XrXDevPropertiesMNDX *properties); +typedef XrResult (XRAPI_PTR *PFN_xrDestroyXDevListMNDX)(XrXDevListMNDX xdevList); +typedef XrResult (XRAPI_PTR *PFN_xrCreateXDevSpaceMNDX)(XrSession session, const XrCreateXDevSpaceInfoMNDX *createInfo, XrSpace *space); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/external/openxr_includes/openxr/openxr_extension_helpers.h b/src/external/openxr_includes/openxr/openxr_extension_helpers.h new file mode 100644 index 000000000..ccebf0582 --- /dev/null +++ b/src/external/openxr_includes/openxr/openxr_extension_helpers.h @@ -0,0 +1,18 @@ +/* +** Copyright (c) 2017-2022, The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +#pragma once + +#include + +// These are just convenience macros for defining enums that would +// normally be declared in the body of the enum, but can't be declared +// that way easily for experimental extensions. + +#define XR_ENUM(type, enm, constant) static const type enm = (type)constant +#define XR_STRUCT_ENUM(enm, constant) XR_ENUM(XrStructureType, enm, constant) +#define XR_RESULT_ENUM(enm, constant) XR_ENUM(XrResult, enm, constant) +#define XR_REFSPACE_ENUM(enm, constant) XR_ENUM(XrReferenceSpaceType, enm, constant) diff --git a/src/xrt/include/xrt/xrt_openxr_includes.h b/src/xrt/include/xrt/xrt_openxr_includes.h index 801e42053..bf93d2806 100644 --- a/src/xrt/include/xrt/xrt_openxr_includes.h +++ b/src/xrt/include/xrt/xrt_openxr_includes.h @@ -1,4 +1,4 @@ -// Copyright 2018-2023, Collabora, Ltd. +// Copyright 2018-2024, Collabora, Ltd. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -62,5 +62,6 @@ typedef __eglMustCastToProperFunctionPointerType (*PFNEGLGETPROCADDRESSPROC)(con #include "openxr/openxr_loader_negotiation.h" // IWYU pragma: export #include "openxr/XR_MNDX_hydra.h" +#include "openxr/XR_MNDX_xdev_space.h" #include "openxr/XR_MNDX_system_buttons.h" #include "openxr/XR_MNDX_ball_on_a_stick_controller.h"