From e88a58eed8111e618626c7cad86379342adf4b27 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 22 Jun 2020 13:01:25 -0700 Subject: [PATCH 1/9] [openxr-loader] Update to latest version, official repo --- ports/openxr-loader/CONTROL | 2 +- ports/openxr-loader/openxr.hpp | 24739 +++++++++++++++++++++++++++ ports/openxr-loader/portfile.cmake | 11 +- 3 files changed, 24748 insertions(+), 4 deletions(-) create mode 100644 ports/openxr-loader/openxr.hpp diff --git a/ports/openxr-loader/CONTROL b/ports/openxr-loader/CONTROL index 632fadab740b55..59afa2cdd5a29b 100644 --- a/ports/openxr-loader/CONTROL +++ b/ports/openxr-loader/CONTROL @@ -1,5 +1,5 @@ Source: openxr-loader -Version: 1.0.3.0 +Version: 1.0.9 Description: Khronos API for abstracting VR/MR/AR hardware Supports: !(arm|uwp) diff --git a/ports/openxr-loader/openxr.hpp b/ports/openxr-loader/openxr.hpp new file mode 100644 index 00000000000000..1f11eac3eaf887 --- /dev/null +++ b/ports/openxr-loader/openxr.hpp @@ -0,0 +1,24739 @@ +// *********** THIS FILE IS GENERATED - DO NOT EDIT *********** +// See cpp_generator.py for modifications +// ************************************************************ + +#ifndef OPENXR_HPP_ +#define OPENXR_HPP_ 1 + +/* +** Copyright (c) 2017-2019 The Khronos Group Inc. +** Copyright (c) 2019 Collabora, Ltd. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** ---- Exceptions to the Apache 2.0 License: ---- +** +** As an exception, if you use this Software to generate code and portions of +** this Software are embedded into the generated code as a result, you may +** redistribute such product without providing attribution as would otherwise +** be required by Sections 4(a), 4(b) and 4(d) of the License. +** +** In addition, if you combine or link code generated by this Software with +** software that is licensed under the GPLv2 or the LGPL v2.0 or 2.1 +** ("`Combined Software`") and if a court of competent jurisdiction determines +** that the patent provision (Section 3), the indemnity provision (Section 9) +** or other Section of the License conflicts with the conditions of the +** applicable GPL or LGPL license, you may retroactively and prospectively +** choose to deem waived or otherwise exclude such Section(s) of the License, +** but only in their entirety and only with respect to the Combined Software. +** +*/ + +/* +** This header is generated from the Khronos OpenXR XML API Registry. +** +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE +#include +#include +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +// Fix name collisions from noisy includes +#ifdef Success +#undef Success +#endif +#ifdef None +#undef None +#endif + +#if !defined(OPENXR_HPP_ASSERT) +#include +#define OPENXR_HPP_ASSERT assert +#endif + +// 32-bit OpenXR is not typesafe for handles, so don't allow copy constructors +// on this platform by default. To enable this feature on 32-bit platforms +// please define OPENXR_HPP_TYPESAFE_CONVERSION +#if defined(__LP64__) || defined(_WIN64) || \ + (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || \ + defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) || \ + defined(__powerpc64__) +#if !defined(OPENXR_HPP_TYPESAFE_CONVERSION) +#define OPENXR_HPP_TYPESAFE_CONVERSION +#endif +#endif + +#if !defined(OPENXR_HPP_INLINE) +#if defined(__clang___) +#if __has_attribute(always_inline) +#define OPENXR_HPP_INLINE __attribute__((always_inline)) __inline__ +#else +#define OPENXR_HPP_INLINE inline +#endif +#elif defined(__GNUC__) +#define OPENXR_HPP_INLINE __attribute__((always_inline)) __inline__ +#elif defined(_MSC_VER) +#define OPENXR_HPP_INLINE inline +#else +#define OPENXR_HPP_INLINE inline +#endif +#endif + +#if defined(OPENXR_HPP_TYPESAFE_CONVERSION) +#define OPENXR_HPP_TYPESAFE_EXPLICIT +#else +#define OPENXR_HPP_TYPESAFE_EXPLICIT explicit +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1800) +#define OPENXR_HPP_CONSTEXPR +#else +#define OPENXR_HPP_CONSTEXPR constexpr +#endif + +//! @todo set this to constexpr in c++14 +#define OPENXR_HPP_SWITCH_CONSTEXPR + +#if !defined(OPENXR_HPP_NAMESPACE) +#define OPENXR_HPP_NAMESPACE xr +#endif + +#define OPENXR_HPP_STRINGIFY2(text) #text +#define OPENXR_HPP_STRINGIFY(text) OPENXR_HPP_STRINGIFY2(text) +#define OPENXR_HPP_NAMESPACE_STRING OPENXR_HPP_STRINGIFY(OPENXR_HPP_NAMESPACE) + +/*! + * @brief Namespace containing all openxr.hpp entities. + * + * If the default namespace `xr` isn't suitable, you can define + * OPENXR_HPP_NAMESPACE to a different name before including this header. + */ +namespace OPENXR_HPP_NAMESPACE { +// Forward declaration +class DispatchLoaderDynamic; + +// The generalization of std::string with user-specifiable allocator types. +template > +using string_with_allocator = + std::basic_string, Allocator>; + +using Bool32 = XrBool32; + +enum Side : uint32_t { + Left = 0, + Right = 1, +}; + +constexpr uint32_t SIDE_COUNT = 2; + +constexpr char const *const reserved_paths[] = { + "/user/hand/left", "/user/hand/right", "/user/head", + "/user/gamepad", "/user/treadmill", +}; + +constexpr char const *const interaction_profiles[] = { + "/interaction_profiles/khr/simple_controller", + "/interaction_profiles/google/daydream_controller", + "/interaction_profiles/htc/vive_controller", + "/interaction_profiles/htc/vive_pro", + "/interaction_profiles/microsoft/motion_controller", + "/interaction_profiles/microsoft/xbox_controller", + "/interaction_profiles/oculus/go_controller", + "/interaction_profiles/oculus/touch_controller", + "/interaction_profiles/valve/index_controller", +}; + +template +static inline void for_each_side(SideHandler &&handler) { + handler(Left); + handler(Right); +} + +template +static inline void for_each_side_index(IndexHandler &&handler) { + handler(0); + handler(1); +} + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +//! XrVersion wrapper class +//! +//! See the related specification text at +//! +class Version { +public: + /*! + * @name Constructors, assignment, and conversions + * @{ + */ + //! Default constructor. + OPENXR_HPP_CONSTEXPR Version() = default; + //! Explicit constructor from raw XrVersion + OPENXR_HPP_CONSTEXPR explicit Version(XrVersion v) noexcept : val_(v) {} + //! Constructor from version components + Version(uint16_t major_, uint16_t minor_, uint32_t patch_) noexcept { + major(major_); + minor(minor_); + patch(patch_); + } + + //! @} + + //! @name Raw XrVersion manipulation + //! @{ + + //! Gets the raw XrVersion type. + OPENXR_HPP_CONSTEXPR XrVersion get() const noexcept { return val_; } + //! @brief Clears this value, then returns the address of the raw XrVersion + //! type, for use in creation/assignment. + XrVersion *put() noexcept { + val_ = 0; + return &val_; + } + //! @} + + //! Get the major component. + OPENXR_HPP_CONSTEXPR uint16_t major() const noexcept { + return static_cast(val_ >> 48); + } + //! Set the major component. + void major(uint16_t val) noexcept { + // blank the top 16 bits + val_ &= 0x0000ffffffffffff; + val_ |= uint64_t(val) << 48; + } + + //! Get the minor component. + OPENXR_HPP_CONSTEXPR uint16_t minor() const noexcept { + return static_cast((val_ >> 32) & 0xffff); + } + //! Set the minor component. + void minor(uint16_t val) noexcept { + // blank the correct 16 bits + val_ &= 0xffff0000ffffffff; + val_ |= uint64_t(val) << 32; + } + + //! Get the patch component. + OPENXR_HPP_CONSTEXPR uint32_t patch() const noexcept { + return static_cast(val_ & 0xffffffff); + } + //! Set the patch component. + void patch(uint32_t val) noexcept { + // blank the least-significant 32 bits + val_ &= 0xffffffff00000000; + val_ |= val; + } + + //! Get the current version. + static OPENXR_HPP_CONSTEXPR Version current() noexcept { + return Version{XR_CURRENT_API_VERSION}; + } + +private: + XrVersion val_{}; +}; + +static_assert(sizeof(Version) == sizeof(XrVersion), + "raw type and wrapper have different size!"); +//! @brief Free function for getting the raw XrVersion from Version. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Version::get() +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE XrVersion get(Version v) noexcept { + return v.get(); +} +//! @brief Free function for clearing and getting the raw XrVersion from +//! Version. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Version::put() +//! @relates Version +OPENXR_HPP_INLINE XrVersion *put(Version &v) noexcept { return v.put(); } +//! @brief `<` comparison between Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Version lhs, + Version rhs) noexcept { + return lhs.get() < rhs.get(); +} +//! @brief `>` comparison between Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Version lhs, + Version rhs) noexcept { + return lhs.get() > rhs.get(); +} +//! @brief `<=` comparison between Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(Version lhs, + Version rhs) noexcept { + return lhs.get() <= rhs.get(); +} +//! @brief `>=` comparison between Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(Version lhs, + Version rhs) noexcept { + return lhs.get() >= rhs.get(); +} +//! @brief `==` comparison between Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Version lhs, + Version rhs) noexcept { + return lhs.get() == rhs.get(); +} +//! @brief `!=` comparison between Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Version lhs, + Version rhs) noexcept { + return lhs.get() != rhs.get(); +} +//! @brief `<` comparison between Version and raw XrVersion. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Version lhs, + XrVersion rhs) noexcept { + return lhs.get() < rhs; +} +//! @brief `<` comparison between raw XrVersion and Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(XrVersion lhs, + Version rhs) noexcept { + return lhs < rhs.get(); +} +//! @brief `>` comparison between Version and raw XrVersion. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Version lhs, + XrVersion rhs) noexcept { + return lhs.get() > rhs; +} +//! @brief `>` comparison between raw XrVersion and Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(XrVersion lhs, + Version rhs) noexcept { + return lhs > rhs.get(); +} +//! @brief `<=` comparison between Version and raw XrVersion. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(Version lhs, + XrVersion rhs) noexcept { + return lhs.get() <= rhs; +} +//! @brief `<=` comparison between raw XrVersion and Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(XrVersion lhs, + Version rhs) noexcept { + return lhs <= rhs.get(); +} +//! @brief `>=` comparison between Version and raw XrVersion. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(Version lhs, + XrVersion rhs) noexcept { + return lhs.get() >= rhs; +} +//! @brief `>=` comparison between raw XrVersion and Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(XrVersion lhs, + Version rhs) noexcept { + return lhs >= rhs.get(); +} +//! @brief `==` comparison between Version and raw XrVersion. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Version lhs, + XrVersion rhs) noexcept { + return lhs.get() == rhs; +} +//! @brief `==` comparison between raw XrVersion and Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(XrVersion lhs, + Version rhs) noexcept { + return lhs == rhs.get(); +} +//! @brief `!=` comparison between Version and raw XrVersion. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Version lhs, + XrVersion rhs) noexcept { + return lhs.get() != rhs; +} +//! @brief `!=` comparison between raw XrVersion and Version. +//! @relates Version +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(XrVersion lhs, + Version rhs) noexcept { + return lhs != rhs.get(); +} + +//! XrDuration wrapper class +//! +//! See the related specification text at +//! +class Duration { +public: + /*! + * @name Constructors, assignment, and conversions + * @{ + */ + //! Default constructor. + OPENXR_HPP_CONSTEXPR Duration() = default; + //! Explicit constructor from raw XrDuration + OPENXR_HPP_CONSTEXPR explicit Duration(XrDuration v) noexcept : val_(v) {} + //! @} + + //! @name Raw XrDuration manipulation + //! @{ + + //! Gets the raw XrDuration type. + OPENXR_HPP_CONSTEXPR XrDuration get() const noexcept { return val_; } + //! @brief Clears this value, then returns the address of the raw XrDuration + //! type, for use in creation/assignment. + XrDuration *put() noexcept { + val_ = 0; + return &val_; + } + //! @} + + //! Add a Duration to the current Duration + Duration &operator+=(Duration d) noexcept { + val_ += d.val_; + return *this; + } + + //! Subtract a Duration from the current Duration + Duration &operator-=(Duration d) noexcept { + val_ -= d.val_; + return *this; + } + + //! For timeouts, indicates the timeout is immediate + static OPENXR_HPP_CONSTEXPR Duration noDuration() noexcept { + return Duration{XR_NO_DURATION}; + } + + //! For timeouts, indicates the timeout never occurs. + static OPENXR_HPP_CONSTEXPR Duration infinite() noexcept { + return Duration{XR_INFINITE_DURATION}; + } + + //! For haptic vibration, the shortest pulse possible for the device + static OPENXR_HPP_CONSTEXPR Duration minHaptic() noexcept { + return Duration{XR_MIN_HAPTIC_DURATION}; + } + +private: + XrDuration val_{}; +}; + +static_assert(sizeof(Duration) == sizeof(XrDuration), + "raw type and wrapper have different size!"); +//! @brief Free function for getting the raw XrDuration from Duration. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Duration::get() +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE XrDuration get(Duration v) noexcept { + return v.get(); +} +//! @brief Free function for clearing and getting the raw XrDuration from +//! Duration. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Duration::put() +//! @relates Duration +OPENXR_HPP_INLINE XrDuration *put(Duration &v) noexcept { return v.put(); } +//! @brief `<` comparison between Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Duration lhs, + Duration rhs) noexcept { + return lhs.get() < rhs.get(); +} +//! @brief `>` comparison between Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Duration lhs, + Duration rhs) noexcept { + return lhs.get() > rhs.get(); +} +//! @brief `<=` comparison between Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(Duration lhs, + Duration rhs) noexcept { + return lhs.get() <= rhs.get(); +} +//! @brief `>=` comparison between Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(Duration lhs, + Duration rhs) noexcept { + return lhs.get() >= rhs.get(); +} +//! @brief `==` comparison between Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Duration lhs, + Duration rhs) noexcept { + return lhs.get() == rhs.get(); +} +//! @brief `!=` comparison between Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Duration lhs, + Duration rhs) noexcept { + return lhs.get() != rhs.get(); +} +//! @brief `<` comparison between Duration and raw XrDuration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Duration lhs, + XrDuration rhs) noexcept { + return lhs.get() < rhs; +} +//! @brief `<` comparison between raw XrDuration and Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(XrDuration lhs, + Duration rhs) noexcept { + return lhs < rhs.get(); +} +//! @brief `>` comparison between Duration and raw XrDuration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Duration lhs, + XrDuration rhs) noexcept { + return lhs.get() > rhs; +} +//! @brief `>` comparison between raw XrDuration and Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(XrDuration lhs, + Duration rhs) noexcept { + return lhs > rhs.get(); +} +//! @brief `<=` comparison between Duration and raw XrDuration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator<=(Duration lhs, XrDuration rhs) noexcept { + return lhs.get() <= rhs; +} +//! @brief `<=` comparison between raw XrDuration and Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(XrDuration lhs, + Duration rhs) noexcept { + return lhs <= rhs.get(); +} +//! @brief `>=` comparison between Duration and raw XrDuration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator>=(Duration lhs, XrDuration rhs) noexcept { + return lhs.get() >= rhs; +} +//! @brief `>=` comparison between raw XrDuration and Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(XrDuration lhs, + Duration rhs) noexcept { + return lhs >= rhs.get(); +} +//! @brief `==` comparison between Duration and raw XrDuration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator==(Duration lhs, XrDuration rhs) noexcept { + return lhs.get() == rhs; +} +//! @brief `==` comparison between raw XrDuration and Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(XrDuration lhs, + Duration rhs) noexcept { + return lhs == rhs.get(); +} +//! @brief `!=` comparison between Duration and raw XrDuration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator!=(Duration lhs, XrDuration rhs) noexcept { + return lhs.get() != rhs; +} +//! @brief `!=` comparison between raw XrDuration and Duration. +//! @relates Duration +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(XrDuration lhs, + Duration rhs) noexcept { + return lhs != rhs.get(); +} +//! Add two Duration values +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE Duration +operator+(Duration lhs, Duration rhs) noexcept { + return Duration{lhs.get() + rhs.get()}; +} + +//! Subtract two Duration values +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE Duration +operator-(Duration lhs, Duration rhs) noexcept { + return Duration{lhs.get() - rhs.get()}; +} + +//! XrTime wrapper class +//! +//! See the related specification text at +//! +class Time { +public: + /*! + * @name Constructors, assignment, and conversions + * @{ + */ + //! Default constructor. + OPENXR_HPP_CONSTEXPR Time() = default; + //! Explicit constructor from raw XrTime + OPENXR_HPP_CONSTEXPR explicit Time(XrTime v) noexcept : val_(v) {} + //! @} + + /*! + * @name Validity checking + * @{ + */ + //! True if this time is valid (positive) + OPENXR_HPP_CONSTEXPR explicit operator bool() const noexcept { + return val_ > 0; + } + //! Unary negation: True if this Time is invalid + OPENXR_HPP_CONSTEXPR bool operator!() const noexcept { return val_ <= 0; } + //! @} + //! @name Raw XrTime manipulation + //! @{ + + //! Gets the raw XrTime type. + OPENXR_HPP_CONSTEXPR XrTime get() const noexcept { return val_; } + //! @brief Clears this value, then returns the address of the raw XrTime type, + //! for use in creation/assignment. + XrTime *put() noexcept { + val_ = 0; + return &val_; + } + //! @} + + //! Add a Duration to the current Time + Time &operator+=(Duration d) noexcept { + val_ += d.get(); + return *this; + } + + //! Subtract a Duration from the current Time + Time &operator-=(Duration d) noexcept { + val_ -= d.get(); + return *this; + } + +private: + XrTime val_{}; +}; + +static_assert(sizeof(Time) == sizeof(XrTime), + "raw type and wrapper have different size!"); +//! @brief Free function for getting the raw XrTime from Time. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Time::get() +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE XrTime get(Time v) noexcept { + return v.get(); +} +//! @brief Free function for clearing and getting the raw XrTime from Time. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Time::put() +//! @relates Time +OPENXR_HPP_INLINE XrTime *put(Time &v) noexcept { return v.put(); } +//! @brief `<` comparison between Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Time lhs, + Time rhs) noexcept { + return lhs.get() < rhs.get(); +} +//! @brief `>` comparison between Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Time lhs, + Time rhs) noexcept { + return lhs.get() > rhs.get(); +} +//! @brief `<=` comparison between Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(Time lhs, + Time rhs) noexcept { + return lhs.get() <= rhs.get(); +} +//! @brief `>=` comparison between Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(Time lhs, + Time rhs) noexcept { + return lhs.get() >= rhs.get(); +} +//! @brief `==` comparison between Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Time lhs, + Time rhs) noexcept { + return lhs.get() == rhs.get(); +} +//! @brief `!=` comparison between Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Time lhs, + Time rhs) noexcept { + return lhs.get() != rhs.get(); +} +//! @brief `<` comparison between Time and raw XrTime. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Time lhs, + XrTime rhs) noexcept { + return lhs.get() < rhs; +} +//! @brief `<` comparison between raw XrTime and Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(XrTime lhs, + Time rhs) noexcept { + return lhs < rhs.get(); +} +//! @brief `>` comparison between Time and raw XrTime. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Time lhs, + XrTime rhs) noexcept { + return lhs.get() > rhs; +} +//! @brief `>` comparison between raw XrTime and Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(XrTime lhs, + Time rhs) noexcept { + return lhs > rhs.get(); +} +//! @brief `<=` comparison between Time and raw XrTime. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(Time lhs, + XrTime rhs) noexcept { + return lhs.get() <= rhs; +} +//! @brief `<=` comparison between raw XrTime and Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(XrTime lhs, + Time rhs) noexcept { + return lhs <= rhs.get(); +} +//! @brief `>=` comparison between Time and raw XrTime. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(Time lhs, + XrTime rhs) noexcept { + return lhs.get() >= rhs; +} +//! @brief `>=` comparison between raw XrTime and Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(XrTime lhs, + Time rhs) noexcept { + return lhs >= rhs.get(); +} +//! @brief `==` comparison between Time and raw XrTime. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Time lhs, + XrTime rhs) noexcept { + return lhs.get() == rhs; +} +//! @brief `==` comparison between raw XrTime and Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(XrTime lhs, + Time rhs) noexcept { + return lhs == rhs.get(); +} +//! @brief `!=` comparison between Time and raw XrTime. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Time lhs, + XrTime rhs) noexcept { + return lhs.get() != rhs; +} +//! @brief `!=` comparison between raw XrTime and Time. +//! @relates Time +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(XrTime lhs, + Time rhs) noexcept { + return lhs != rhs.get(); +} +//! The difference between two Time values is a Duration. +OPENXR_HPP_CONSTEXPR inline Duration operator-(Time lhs, Time rhs) noexcept { + return Duration{lhs.get() - rhs.get()}; +} + +//! Subtract a Duration from a Time to get another Time +OPENXR_HPP_CONSTEXPR inline Time operator-(Time lhs, Duration rhs) noexcept { + return Time{lhs.get() - rhs.get()}; +} + +//! Add a Duration to a Time to get another Time +OPENXR_HPP_CONSTEXPR inline Time operator+(Time lhs, Duration rhs) noexcept { + return Time{lhs.get() + rhs.get()}; +} + +//! XrSystemId wrapper class +//! +//! See the related specification text at +//! +class SystemId { +public: + /*! + * @name Constructors, assignment, and conversions + * @{ + */ + //! Default constructor. + OPENXR_HPP_CONSTEXPR SystemId() = default; + //! Explicit constructor from raw XrSystemId + OPENXR_HPP_CONSTEXPR explicit SystemId(XrSystemId v) noexcept : val_(v) {} + //! @} + + /*! + * @name Validity checking + * @{ + */ + //! Returns true in conditionals if this SystemId is valid + OPENXR_HPP_CONSTEXPR explicit operator bool() const noexcept { + return val_ != XR_NULL_SYSTEM_ID; + } + //! Unary negation: True if this SystemId is invalid + OPENXR_HPP_CONSTEXPR bool operator!() const noexcept { + return val_ == XR_NULL_SYSTEM_ID; + } + //! @} + //! @name Raw XrSystemId manipulation + //! @{ + + //! Gets the raw XrSystemId type. + OPENXR_HPP_CONSTEXPR XrSystemId get() const noexcept { return val_; } + //! @brief Clears this value, then returns the address of the raw XrSystemId + //! type, for use in creation/assignment. + XrSystemId *put() noexcept { + val_ = XR_NULL_SYSTEM_ID; + return &val_; + } + //! @} + +private: + XrSystemId val_{XR_NULL_SYSTEM_ID}; +}; + +static_assert(sizeof(SystemId) == sizeof(XrSystemId), + "raw type and wrapper have different size!"); +//! @brief Free function for getting the raw XrSystemId from SystemId. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see SystemId::get() +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE XrSystemId get(SystemId v) noexcept { + return v.get(); +} +//! @brief Free function for clearing and getting the raw XrSystemId from +//! SystemId. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see SystemId::put() +//! @relates SystemId +OPENXR_HPP_INLINE XrSystemId *put(SystemId &v) noexcept { return v.put(); } +//! @brief `==` comparison between SystemId. +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(SystemId lhs, + SystemId rhs) noexcept { + return lhs.get() == rhs.get(); +} +//! @brief `!=` comparison between SystemId. +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(SystemId lhs, + SystemId rhs) noexcept { + return lhs.get() != rhs.get(); +} +//! @brief `==` comparison between SystemId and raw XrSystemId. +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator==(SystemId lhs, XrSystemId rhs) noexcept { + return lhs.get() == rhs; +} +//! @brief `==` comparison between raw XrSystemId and SystemId. +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(XrSystemId lhs, + SystemId rhs) noexcept { + return lhs == rhs.get(); +} +//! @brief `!=` comparison between SystemId and raw XrSystemId. +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator!=(SystemId lhs, XrSystemId rhs) noexcept { + return lhs.get() != rhs; +} +//! @brief `!=` comparison between raw XrSystemId and SystemId. +//! @relates SystemId +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(XrSystemId lhs, + SystemId rhs) noexcept { + return lhs != rhs.get(); +} + +//! XrPath wrapper class +//! +//! See the related specification text at +//! +class Path { +public: + /*! + * @name Constructors, assignment, and conversions + * @{ + */ + //! Default constructor. + OPENXR_HPP_CONSTEXPR Path() = default; + //! Explicit constructor from raw XrPath + OPENXR_HPP_CONSTEXPR explicit Path(XrPath v) noexcept : val_(v) {} + //! @} + + /*! + * @name Validity checking + * @{ + */ + //! Returns true in conditionals if this Path is valid + OPENXR_HPP_CONSTEXPR explicit operator bool() const noexcept { + return val_ != XR_NULL_PATH; + } + //! Unary negation: True if this Path is invalid + OPENXR_HPP_CONSTEXPR bool operator!() const noexcept { + return val_ == XR_NULL_PATH; + } + //! @} + //! @name Raw XrPath manipulation + //! @{ + + //! Gets the raw XrPath type. + OPENXR_HPP_CONSTEXPR XrPath get() const noexcept { return val_; } + //! @brief Clears this value, then returns the address of the raw XrPath type, + //! for use in creation/assignment. + XrPath *put() noexcept { + val_ = XR_NULL_PATH; + return &val_; + } + //! @} + +private: + XrPath val_{XR_NULL_PATH}; +}; + +static_assert(sizeof(Path) == sizeof(XrPath), + "raw type and wrapper have different size!"); +//! @brief Free function for getting the raw XrPath from Path. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Path::get() +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE XrPath get(Path v) noexcept { + return v.get(); +} +//! @brief Free function for clearing and getting the raw XrPath from Path. +//! +//! Should be found via argument-dependent lookup and thus not need explicit +//! namespace qualification. +//! @see Path::put() +//! @relates Path +OPENXR_HPP_INLINE XrPath *put(Path &v) noexcept { return v.put(); } +//! @brief `==` comparison between Path. +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Path lhs, + Path rhs) noexcept { + return lhs.get() == rhs.get(); +} +//! @brief `!=` comparison between Path. +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Path lhs, + Path rhs) noexcept { + return lhs.get() != rhs.get(); +} +//! @brief `==` comparison between Path and raw XrPath. +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Path lhs, + XrPath rhs) noexcept { + return lhs.get() == rhs; +} +//! @brief `==` comparison between raw XrPath and Path. +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(XrPath lhs, + Path rhs) noexcept { + return lhs == rhs.get(); +} +//! @brief `!=` comparison between Path and raw XrPath. +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Path lhs, + XrPath rhs) noexcept { + return lhs.get() != rhs; +} +//! @brief `!=` comparison between raw XrPath and Path. +//! @relates Path +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(XrPath lhs, + Path rhs) noexcept { + return lhs != rhs.get(); +} +using BilateralPaths = std::array; + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +/*! + * @defgroup dispatch Dispatch classes + * @brief Classes providing a method or function pointer member for OpenXR APIs. + * + * The classes provided here are useful basic classes, but all places that can + * take a dispatch class are templated to be able to accept any class that meets + * the requirements. + */ + +/*! + * @brief Dispatch class for OpenXR core functions that uses exported, + * statically-available symbols. + * + * Not for use in game engines or other multi-module software where different + * modules might want newer OpenXR APIs. If this is used, all parts of an + * application must build against and use the same loader library. + * + * Does not provide extension functions because those are not exported from the + * loader library. + * + * @ingroup dispatch + */ +class DispatchLoaderStatic { +public: + /*! + * @name Core Commands + * @{ + */ + + XrResult xrGetInstanceProcAddr(XrInstance instance, const char *name, + PFN_xrVoidFunction *function) const { + return ::xrGetInstanceProcAddr(instance, name, function); + } + XrResult + xrEnumerateApiLayerProperties(uint32_t propertyCapacityInput, + uint32_t *propertyCountOutput, + XrApiLayerProperties *properties) const { + return ::xrEnumerateApiLayerProperties(propertyCapacityInput, + propertyCountOutput, properties); + } + XrResult xrEnumerateInstanceExtensionProperties( + const char *layerName, uint32_t propertyCapacityInput, + uint32_t *propertyCountOutput, XrExtensionProperties *properties) const { + return ::xrEnumerateInstanceExtensionProperties( + layerName, propertyCapacityInput, propertyCountOutput, properties); + } + XrResult xrCreateInstance(const XrInstanceCreateInfo *createInfo, + XrInstance *instance) const { + return ::xrCreateInstance(createInfo, instance); + } + XrResult xrDestroyInstance(XrInstance instance) const { + return ::xrDestroyInstance(instance); + } + XrResult + xrGetInstanceProperties(XrInstance instance, + XrInstanceProperties *instanceProperties) const { + return ::xrGetInstanceProperties(instance, instanceProperties); + } + XrResult xrPollEvent(XrInstance instance, + XrEventDataBuffer *eventData) const { + return ::xrPollEvent(instance, eventData); + } + XrResult xrResultToString(XrInstance instance, XrResult value, + char buffer[XR_MAX_RESULT_STRING_SIZE]) const { + return ::xrResultToString(instance, value, buffer); + } + XrResult + xrStructureTypeToString(XrInstance instance, XrStructureType value, + char buffer[XR_MAX_STRUCTURE_NAME_SIZE]) const { + return ::xrStructureTypeToString(instance, value, buffer); + } + XrResult xrGetSystem(XrInstance instance, const XrSystemGetInfo *getInfo, + XrSystemId *systemId) const { + return ::xrGetSystem(instance, getInfo, systemId); + } + XrResult xrGetSystemProperties(XrInstance instance, XrSystemId systemId, + XrSystemProperties *properties) const { + return ::xrGetSystemProperties(instance, systemId, properties); + } + XrResult xrEnumerateEnvironmentBlendModes( + XrInstance instance, XrSystemId systemId, + XrViewConfigurationType viewConfigurationType, + uint32_t environmentBlendModeCapacityInput, + uint32_t *environmentBlendModeCountOutput, + XrEnvironmentBlendMode *environmentBlendModes) const { + return ::xrEnumerateEnvironmentBlendModes( + instance, systemId, viewConfigurationType, + environmentBlendModeCapacityInput, environmentBlendModeCountOutput, + environmentBlendModes); + } + XrResult xrCreateSession(XrInstance instance, + const XrSessionCreateInfo *createInfo, + XrSession *session) const { + return ::xrCreateSession(instance, createInfo, session); + } + XrResult xrDestroySession(XrSession session) const { + return ::xrDestroySession(session); + } + XrResult xrEnumerateReferenceSpaces(XrSession session, + uint32_t spaceCapacityInput, + uint32_t *spaceCountOutput, + XrReferenceSpaceType *spaces) const { + return ::xrEnumerateReferenceSpaces(session, spaceCapacityInput, + spaceCountOutput, spaces); + } + XrResult xrCreateReferenceSpace(XrSession session, + const XrReferenceSpaceCreateInfo *createInfo, + XrSpace *space) const { + return ::xrCreateReferenceSpace(session, createInfo, space); + } + XrResult + xrGetReferenceSpaceBoundsRect(XrSession session, + XrReferenceSpaceType referenceSpaceType, + XrExtent2Df *bounds) const { + return ::xrGetReferenceSpaceBoundsRect(session, referenceSpaceType, bounds); + } + XrResult xrCreateActionSpace(XrSession session, + const XrActionSpaceCreateInfo *createInfo, + XrSpace *space) const { + return ::xrCreateActionSpace(session, createInfo, space); + } + XrResult xrLocateSpace(XrSpace space, XrSpace baseSpace, XrTime time, + XrSpaceLocation *location) const { + return ::xrLocateSpace(space, baseSpace, time, location); + } + XrResult xrDestroySpace(XrSpace space) const { + return ::xrDestroySpace(space); + } + XrResult xrEnumerateViewConfigurations( + XrInstance instance, XrSystemId systemId, + uint32_t viewConfigurationTypeCapacityInput, + uint32_t *viewConfigurationTypeCountOutput, + XrViewConfigurationType *viewConfigurationTypes) const { + return ::xrEnumerateViewConfigurations( + instance, systemId, viewConfigurationTypeCapacityInput, + viewConfigurationTypeCountOutput, viewConfigurationTypes); + } + XrResult xrGetViewConfigurationProperties( + XrInstance instance, XrSystemId systemId, + XrViewConfigurationType viewConfigurationType, + XrViewConfigurationProperties *configurationProperties) const { + return ::xrGetViewConfigurationProperties( + instance, systemId, viewConfigurationType, configurationProperties); + } + XrResult xrEnumerateViewConfigurationViews( + XrInstance instance, XrSystemId systemId, + XrViewConfigurationType viewConfigurationType, uint32_t viewCapacityInput, + uint32_t *viewCountOutput, XrViewConfigurationView *views) const { + return ::xrEnumerateViewConfigurationViews( + instance, systemId, viewConfigurationType, viewCapacityInput, + viewCountOutput, views); + } + XrResult xrEnumerateSwapchainFormats(XrSession session, + uint32_t formatCapacityInput, + uint32_t *formatCountOutput, + int64_t *formats) const { + return ::xrEnumerateSwapchainFormats(session, formatCapacityInput, + formatCountOutput, formats); + } + XrResult xrCreateSwapchain(XrSession session, + const XrSwapchainCreateInfo *createInfo, + XrSwapchain *swapchain) const { + return ::xrCreateSwapchain(session, createInfo, swapchain); + } + XrResult xrDestroySwapchain(XrSwapchain swapchain) const { + return ::xrDestroySwapchain(swapchain); + } + XrResult + xrEnumerateSwapchainImages(XrSwapchain swapchain, uint32_t imageCapacityInput, + uint32_t *imageCountOutput, + XrSwapchainImageBaseHeader *images) const { + return ::xrEnumerateSwapchainImages(swapchain, imageCapacityInput, + imageCountOutput, images); + } + XrResult + xrAcquireSwapchainImage(XrSwapchain swapchain, + const XrSwapchainImageAcquireInfo *acquireInfo, + uint32_t *index) const { + return ::xrAcquireSwapchainImage(swapchain, acquireInfo, index); + } + XrResult + xrWaitSwapchainImage(XrSwapchain swapchain, + const XrSwapchainImageWaitInfo *waitInfo) const { + return ::xrWaitSwapchainImage(swapchain, waitInfo); + } + XrResult xrReleaseSwapchainImage( + XrSwapchain swapchain, + const XrSwapchainImageReleaseInfo *releaseInfo) const { + return ::xrReleaseSwapchainImage(swapchain, releaseInfo); + } + XrResult xrBeginSession(XrSession session, + const XrSessionBeginInfo *beginInfo) const { + return ::xrBeginSession(session, beginInfo); + } + XrResult xrEndSession(XrSession session) const { + return ::xrEndSession(session); + } + XrResult xrRequestExitSession(XrSession session) const { + return ::xrRequestExitSession(session); + } + XrResult xrWaitFrame(XrSession session, const XrFrameWaitInfo *frameWaitInfo, + XrFrameState *frameState) const { + return ::xrWaitFrame(session, frameWaitInfo, frameState); + } + XrResult xrBeginFrame(XrSession session, + const XrFrameBeginInfo *frameBeginInfo) const { + return ::xrBeginFrame(session, frameBeginInfo); + } + XrResult xrEndFrame(XrSession session, + const XrFrameEndInfo *frameEndInfo) const { + return ::xrEndFrame(session, frameEndInfo); + } + XrResult xrLocateViews(XrSession session, + const XrViewLocateInfo *viewLocateInfo, + XrViewState *viewState, uint32_t viewCapacityInput, + uint32_t *viewCountOutput, XrView *views) const { + return ::xrLocateViews(session, viewLocateInfo, viewState, + viewCapacityInput, viewCountOutput, views); + } + XrResult xrStringToPath(XrInstance instance, const char *pathString, + XrPath *path) const { + return ::xrStringToPath(instance, pathString, path); + } + XrResult xrPathToString(XrInstance instance, XrPath path, + uint32_t bufferCapacityInput, + uint32_t *bufferCountOutput, char *buffer) const { + return ::xrPathToString(instance, path, bufferCapacityInput, + bufferCountOutput, buffer); + } + XrResult xrCreateActionSet(XrInstance instance, + const XrActionSetCreateInfo *createInfo, + XrActionSet *actionSet) const { + return ::xrCreateActionSet(instance, createInfo, actionSet); + } + XrResult xrDestroyActionSet(XrActionSet actionSet) const { + return ::xrDestroyActionSet(actionSet); + } + XrResult xrCreateAction(XrActionSet actionSet, + const XrActionCreateInfo *createInfo, + XrAction *action) const { + return ::xrCreateAction(actionSet, createInfo, action); + } + XrResult xrDestroyAction(XrAction action) const { + return ::xrDestroyAction(action); + } + XrResult xrSuggestInteractionProfileBindings( + XrInstance instance, + const XrInteractionProfileSuggestedBinding *suggestedBindings) const { + return ::xrSuggestInteractionProfileBindings(instance, suggestedBindings); + } + XrResult xrAttachSessionActionSets( + XrSession session, + const XrSessionActionSetsAttachInfo *attachInfo) const { + return ::xrAttachSessionActionSets(session, attachInfo); + } + XrResult xrGetCurrentInteractionProfile( + XrSession session, XrPath topLevelUserPath, + XrInteractionProfileState *interactionProfile) const { + return ::xrGetCurrentInteractionProfile(session, topLevelUserPath, + interactionProfile); + } + XrResult xrGetActionStateBoolean(XrSession session, + const XrActionStateGetInfo *getInfo, + XrActionStateBoolean *state) const { + return ::xrGetActionStateBoolean(session, getInfo, state); + } + XrResult xrGetActionStateFloat(XrSession session, + const XrActionStateGetInfo *getInfo, + XrActionStateFloat *state) const { + return ::xrGetActionStateFloat(session, getInfo, state); + } + XrResult xrGetActionStateVector2f(XrSession session, + const XrActionStateGetInfo *getInfo, + XrActionStateVector2f *state) const { + return ::xrGetActionStateVector2f(session, getInfo, state); + } + XrResult xrGetActionStatePose(XrSession session, + const XrActionStateGetInfo *getInfo, + XrActionStatePose *state) const { + return ::xrGetActionStatePose(session, getInfo, state); + } + XrResult xrSyncActions(XrSession session, + const XrActionsSyncInfo *syncInfo) const { + return ::xrSyncActions(session, syncInfo); + } + XrResult xrEnumerateBoundSourcesForAction( + XrSession session, + const XrBoundSourcesForActionEnumerateInfo *enumerateInfo, + uint32_t sourceCapacityInput, uint32_t *sourceCountOutput, + XrPath *sources) const { + return ::xrEnumerateBoundSourcesForAction(session, enumerateInfo, + sourceCapacityInput, + sourceCountOutput, sources); + } + XrResult xrGetInputSourceLocalizedName( + XrSession session, const XrInputSourceLocalizedNameGetInfo *getInfo, + uint32_t bufferCapacityInput, uint32_t *bufferCountOutput, + char *buffer) const { + return ::xrGetInputSourceLocalizedName( + session, getInfo, bufferCapacityInput, bufferCountOutput, buffer); + } + XrResult + xrApplyHapticFeedback(XrSession session, + const XrHapticActionInfo *hapticActionInfo, + const XrHapticBaseHeader *hapticFeedback) const { + return ::xrApplyHapticFeedback(session, hapticActionInfo, hapticFeedback); + } + XrResult + xrStopHapticFeedback(XrSession session, + const XrHapticActionInfo *hapticActionInfo) const { + return ::xrStopHapticFeedback(session, hapticActionInfo); + } + //! @} +}; + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +template struct FlagTraits { + enum { allFlags = 0 }; +}; + +template class Flags { +public: + OPENXR_HPP_CONSTEXPR Flags() : m_mask(0) {} + + Flags(BitType bit) : m_mask(static_cast(bit)) {} + + Flags(Flags const &rhs) : m_mask(rhs.m_mask) {} + + explicit Flags(MaskType flags) : m_mask(flags) {} + + Flags &operator=(Flags const &rhs) { + m_mask = rhs.m_mask; + return *this; + } + + Flags &operator|=(Flags const &rhs) { + m_mask |= rhs.m_mask; + return *this; + } + + Flags &operator&=(Flags const &rhs) { + m_mask &= rhs.m_mask; + return *this; + } + + Flags &operator^=(Flags const &rhs) { + m_mask ^= rhs.m_mask; + return *this; + } + + Flags operator|(Flags const &rhs) const { + Flags result(*this); + result |= rhs; + return result; + } + + Flags operator&(Flags const &rhs) const { + Flags result(*this); + result &= rhs; + return result; + } + + Flags operator^(Flags const &rhs) const { + Flags result(*this); + result ^= rhs; + return result; + } + + bool operator!() const { return !m_mask; } + + Flags operator~() const { + Flags result(*this); + result.m_mask ^= FlagTraits::allFlags; + return result; + } + + bool operator==(Flags const &rhs) const { + return m_mask == rhs.m_mask; + } + + bool operator!=(Flags const &rhs) const { + return m_mask != rhs.m_mask; + } + + explicit operator bool() const { return !!m_mask; } + + explicit operator MaskType() const { return m_mask; } + +private: + MaskType m_mask; +}; + +template +Flags operator|(BitType bit, Flags const &flags) { + return flags | bit; +} + +template +Flags operator&(BitType bit, Flags const &flags) { + return flags & bit; +} + +template +Flags operator^(BitType bit, Flags const &flags) { + return flags ^ bit; +} + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +#ifndef OPENXR_HPP_NO_SMART_HANDLE + +namespace traits { + +template class UniqueHandleTraits; + +} // namespace traits + +namespace impl { + +// Used when returning unique handles. +template +using RemoveRefConst = + typename std::remove_const::type>::type; +} // namespace impl + +/*! + * Template class for holding a handle with unique ownership, much like + * unique_ptr. + * + * Note that this does not keep track of children or parents, though OpenXR + * specifies that destruction of a handle also destroys its children + * automatically. + */ +template +class UniqueHandle + : public traits::UniqueHandleTraits::deleter { +private: + using Deleter = typename traits::UniqueHandleTraits::deleter; + +public: + explicit UniqueHandle(Type const &value = Type(), + Deleter const &deleter = Deleter()) + : Deleter(deleter), m_value(value) {} + + UniqueHandle(UniqueHandle const &) = delete; + + UniqueHandle(UniqueHandle &&other) + : Deleter(std::move(static_cast(other))), + m_value(other.release()) {} + + ~UniqueHandle() { + if (m_value) + this->destroy(m_value); + } + + UniqueHandle &operator=(UniqueHandle const &) = delete; + + UniqueHandle &operator=(UniqueHandle &&other) { + reset(other.release()); + *static_cast(this) = std::move(static_cast(other)); + return *this; + } + + explicit operator bool() const { return m_value.operator bool(); } + + Type const *operator->() const { return &m_value; } + + Type *operator->() { return &m_value; } + + Type const &operator*() const { return m_value; } + + Type &operator*() { return m_value; } + + const Type &get() const { return m_value; } + + Type &get() { return m_value; } + + void reset(Type const &value = Type()) { + if (m_value != value) { + if (m_value) + this->destroy(m_value); + m_value = value; + } + } + + typename Type::RawHandleType *put() { + reset(); + return m_value.put(); + } + + Type release() { + Type value = m_value; + m_value = nullptr; + return value; + } + + void swap(UniqueHandle &rhs) { + std::swap(m_value, rhs.m_value); + std::swap(static_cast(*this), static_cast(rhs)); + } + +private: + Type m_value; +}; +template +class UniqueHandle : public UniqueHandle {}; + +template +class UniqueHandle : public UniqueHandle { +}; + +//! @relates UniqueHandle +template +OPENXR_HPP_INLINE void swap(UniqueHandle &lhs, + UniqueHandle &rhs) { + lhs.swap(rhs); +} + +//! @brief Equality comparison between two UniqueHandles, potentially of +//! different dispatch. +//! @relates UniqueHandle +template +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator==(UniqueHandle const &lhs, + UniqueHandle const &rhs) { + return lhs.get() == rhs.get(); +} +//! @brief Inequality comparison between two UniqueHandles, potentially of +//! different dispatch. +//! @relates UniqueHandle +template +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator!=(UniqueHandle const &lhs, + UniqueHandle const &rhs) { + return lhs.get() != rhs.get(); +} +//! @brief Equality comparison between UniqueHandle and nullptr: true if the +//! handle is null. +//! @relates UniqueHandle +template +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator==(UniqueHandle const &lhs, + std::nullptr_t /* unused */) { + return lhs.get() == XR_NULL_HANDLE; +} +//! @brief Equality comparison between nullptr and UniqueHandle: true if the +//! handle is null. +//! @relates UniqueHandle +template +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator==(std::nullptr_t /* unused */, + UniqueHandle const &rhs) { + return rhs.get() == XR_NULL_HANDLE; +} +//! @brief Inequality comparison between UniqueHandle and nullptr: true if the +//! handle is not null. +//! @relates UniqueHandle +template +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator!=(UniqueHandle const &lhs, + std::nullptr_t /* unused */) { + return lhs.get() != XR_NULL_HANDLE; +} +//! @brief Inequality comparison between nullptr and UniqueHandle: true if the +//! handle is not null. +//! @relates UniqueHandle +template +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool +operator!=(std::nullptr_t /* unused */, + UniqueHandle const &rhs) { + return rhs.get() != XR_NULL_HANDLE; +} +#endif + +template class ObjectDestroy { +public: + ObjectDestroy(Dispatch const &dispatch = Dispatch()) + : m_dispatch(&dispatch) {} + +protected: + template void destroy(T t) { t.destroy(*m_dispatch); } + +private: + Dispatch const *m_dispatch; +}; +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { +/*! + * @defgroup enums Enumerations + * @brief C++ enum classes corresponding to OpenXR C enumerations, plus + * associated utility functions. + * + * All enumerations have three utility functions defined: + * + * - get() - returns the raw C enum value + * - to_string_literal() - returns a const char* containing the C++ name + * - to_string() - wraps to_string_literal(), returning a std::string + * + * @{ + */ + +//! @brief Enum class associated with XrResult +//! +//! See the related specification text at +//! +enum class Result : int32_t { + + Success = XR_SUCCESS, + + TimeoutExpired = XR_TIMEOUT_EXPIRED, + + SessionLossPending = XR_SESSION_LOSS_PENDING, + + EventUnavailable = XR_EVENT_UNAVAILABLE, + + SpaceBoundsUnavailable = XR_SPACE_BOUNDS_UNAVAILABLE, + + SessionNotFocused = XR_SESSION_NOT_FOCUSED, + + FrameDiscarded = XR_FRAME_DISCARDED, + + ErrorValidationFailure = XR_ERROR_VALIDATION_FAILURE, + + ErrorRuntimeFailure = XR_ERROR_RUNTIME_FAILURE, + + ErrorOutOfMemory = XR_ERROR_OUT_OF_MEMORY, + + ErrorApiVersionUnsupported = XR_ERROR_API_VERSION_UNSUPPORTED, + + ErrorInitializationFailed = XR_ERROR_INITIALIZATION_FAILED, + + ErrorFunctionUnsupported = XR_ERROR_FUNCTION_UNSUPPORTED, + + ErrorFeatureUnsupported = XR_ERROR_FEATURE_UNSUPPORTED, + + ErrorExtensionNotPresent = XR_ERROR_EXTENSION_NOT_PRESENT, + + ErrorLimitReached = XR_ERROR_LIMIT_REACHED, + + ErrorSizeInsufficient = XR_ERROR_SIZE_INSUFFICIENT, + + ErrorHandleInvalid = XR_ERROR_HANDLE_INVALID, + + ErrorInstanceLost = XR_ERROR_INSTANCE_LOST, + + ErrorSessionRunning = XR_ERROR_SESSION_RUNNING, + + ErrorSessionNotRunning = XR_ERROR_SESSION_NOT_RUNNING, + + ErrorSessionLost = XR_ERROR_SESSION_LOST, + + ErrorSystemInvalid = XR_ERROR_SYSTEM_INVALID, + + ErrorPathInvalid = XR_ERROR_PATH_INVALID, + + ErrorPathCountExceeded = XR_ERROR_PATH_COUNT_EXCEEDED, + + ErrorPathFormatInvalid = XR_ERROR_PATH_FORMAT_INVALID, + + ErrorPathUnsupported = XR_ERROR_PATH_UNSUPPORTED, + + ErrorLayerInvalid = XR_ERROR_LAYER_INVALID, + + ErrorLayerLimitExceeded = XR_ERROR_LAYER_LIMIT_EXCEEDED, + + ErrorSwapchainRectInvalid = XR_ERROR_SWAPCHAIN_RECT_INVALID, + + ErrorSwapchainFormatUnsupported = XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED, + + ErrorActionTypeMismatch = XR_ERROR_ACTION_TYPE_MISMATCH, + + ErrorSessionNotReady = XR_ERROR_SESSION_NOT_READY, + + ErrorSessionNotStopping = XR_ERROR_SESSION_NOT_STOPPING, + + ErrorTimeInvalid = XR_ERROR_TIME_INVALID, + + ErrorReferenceSpaceUnsupported = XR_ERROR_REFERENCE_SPACE_UNSUPPORTED, + + ErrorFileAccessError = XR_ERROR_FILE_ACCESS_ERROR, + + ErrorFileContentsInvalid = XR_ERROR_FILE_CONTENTS_INVALID, + + ErrorFormFactorUnsupported = XR_ERROR_FORM_FACTOR_UNSUPPORTED, + + ErrorFormFactorUnavailable = XR_ERROR_FORM_FACTOR_UNAVAILABLE, + + ErrorApiLayerNotPresent = XR_ERROR_API_LAYER_NOT_PRESENT, + + ErrorCallOrderInvalid = XR_ERROR_CALL_ORDER_INVALID, + + ErrorGraphicsDeviceInvalid = XR_ERROR_GRAPHICS_DEVICE_INVALID, + + ErrorPoseInvalid = XR_ERROR_POSE_INVALID, + + ErrorIndexOutOfRange = XR_ERROR_INDEX_OUT_OF_RANGE, + + ErrorViewConfigurationTypeUnsupported = + XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, + + ErrorEnvironmentBlendModeUnsupported = + XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED, + + ErrorNameDuplicated = XR_ERROR_NAME_DUPLICATED, + + ErrorNameInvalid = XR_ERROR_NAME_INVALID, + + ErrorActionsetNotAttached = XR_ERROR_ACTIONSET_NOT_ATTACHED, + + ErrorActionsetsAlreadyAttached = XR_ERROR_ACTIONSETS_ALREADY_ATTACHED, + + ErrorLocalizedNameDuplicated = XR_ERROR_LOCALIZED_NAME_DUPLICATED, + + ErrorLocalizedNameInvalid = XR_ERROR_LOCALIZED_NAME_INVALID, + + ErrorAndroidThreadSettingsIdInvalidKHR = + XR_ERROR_ANDROID_THREAD_SETTINGS_ID_INVALID_KHR, + + ErrorAndroidThreadSettingsFailureKHR = + XR_ERROR_ANDROID_THREAD_SETTINGS_FAILURE_KHR, + + ErrorCreateSpatialAnchorFailedMSFT = + XR_ERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFT, + + ErrorSecondaryViewConfigurationTypeNotEnabledMSFT = + XR_ERROR_SECONDARY_VIEW_CONFIGURATION_TYPE_NOT_ENABLED_MSFT, + +}; + +//! @brief Free function for retrieving the raw XrResult value from a Result +//! @relates Result +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrResult get(Result const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a Result value as a +//! const char * +//! @relates Result +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(Result value) { + switch (value) { + + case Result::Success: + return "Success"; + + case Result::TimeoutExpired: + return "TimeoutExpired"; + + case Result::SessionLossPending: + return "SessionLossPending"; + + case Result::EventUnavailable: + return "EventUnavailable"; + + case Result::SpaceBoundsUnavailable: + return "SpaceBoundsUnavailable"; + + case Result::SessionNotFocused: + return "SessionNotFocused"; + + case Result::FrameDiscarded: + return "FrameDiscarded"; + + case Result::ErrorValidationFailure: + return "ErrorValidationFailure"; + + case Result::ErrorRuntimeFailure: + return "ErrorRuntimeFailure"; + + case Result::ErrorOutOfMemory: + return "ErrorOutOfMemory"; + + case Result::ErrorApiVersionUnsupported: + return "ErrorApiVersionUnsupported"; + + case Result::ErrorInitializationFailed: + return "ErrorInitializationFailed"; + + case Result::ErrorFunctionUnsupported: + return "ErrorFunctionUnsupported"; + + case Result::ErrorFeatureUnsupported: + return "ErrorFeatureUnsupported"; + + case Result::ErrorExtensionNotPresent: + return "ErrorExtensionNotPresent"; + + case Result::ErrorLimitReached: + return "ErrorLimitReached"; + + case Result::ErrorSizeInsufficient: + return "ErrorSizeInsufficient"; + + case Result::ErrorHandleInvalid: + return "ErrorHandleInvalid"; + + case Result::ErrorInstanceLost: + return "ErrorInstanceLost"; + + case Result::ErrorSessionRunning: + return "ErrorSessionRunning"; + + case Result::ErrorSessionNotRunning: + return "ErrorSessionNotRunning"; + + case Result::ErrorSessionLost: + return "ErrorSessionLost"; + + case Result::ErrorSystemInvalid: + return "ErrorSystemInvalid"; + + case Result::ErrorPathInvalid: + return "ErrorPathInvalid"; + + case Result::ErrorPathCountExceeded: + return "ErrorPathCountExceeded"; + + case Result::ErrorPathFormatInvalid: + return "ErrorPathFormatInvalid"; + + case Result::ErrorPathUnsupported: + return "ErrorPathUnsupported"; + + case Result::ErrorLayerInvalid: + return "ErrorLayerInvalid"; + + case Result::ErrorLayerLimitExceeded: + return "ErrorLayerLimitExceeded"; + + case Result::ErrorSwapchainRectInvalid: + return "ErrorSwapchainRectInvalid"; + + case Result::ErrorSwapchainFormatUnsupported: + return "ErrorSwapchainFormatUnsupported"; + + case Result::ErrorActionTypeMismatch: + return "ErrorActionTypeMismatch"; + + case Result::ErrorSessionNotReady: + return "ErrorSessionNotReady"; + + case Result::ErrorSessionNotStopping: + return "ErrorSessionNotStopping"; + + case Result::ErrorTimeInvalid: + return "ErrorTimeInvalid"; + + case Result::ErrorReferenceSpaceUnsupported: + return "ErrorReferenceSpaceUnsupported"; + + case Result::ErrorFileAccessError: + return "ErrorFileAccessError"; + + case Result::ErrorFileContentsInvalid: + return "ErrorFileContentsInvalid"; + + case Result::ErrorFormFactorUnsupported: + return "ErrorFormFactorUnsupported"; + + case Result::ErrorFormFactorUnavailable: + return "ErrorFormFactorUnavailable"; + + case Result::ErrorApiLayerNotPresent: + return "ErrorApiLayerNotPresent"; + + case Result::ErrorCallOrderInvalid: + return "ErrorCallOrderInvalid"; + + case Result::ErrorGraphicsDeviceInvalid: + return "ErrorGraphicsDeviceInvalid"; + + case Result::ErrorPoseInvalid: + return "ErrorPoseInvalid"; + + case Result::ErrorIndexOutOfRange: + return "ErrorIndexOutOfRange"; + + case Result::ErrorViewConfigurationTypeUnsupported: + return "ErrorViewConfigurationTypeUnsupported"; + + case Result::ErrorEnvironmentBlendModeUnsupported: + return "ErrorEnvironmentBlendModeUnsupported"; + + case Result::ErrorNameDuplicated: + return "ErrorNameDuplicated"; + + case Result::ErrorNameInvalid: + return "ErrorNameInvalid"; + + case Result::ErrorActionsetNotAttached: + return "ErrorActionsetNotAttached"; + + case Result::ErrorActionsetsAlreadyAttached: + return "ErrorActionsetsAlreadyAttached"; + + case Result::ErrorLocalizedNameDuplicated: + return "ErrorLocalizedNameDuplicated"; + + case Result::ErrorLocalizedNameInvalid: + return "ErrorLocalizedNameInvalid"; + + case Result::ErrorAndroidThreadSettingsIdInvalidKHR: + return "ErrorAndroidThreadSettingsIdInvalidKHR"; + + case Result::ErrorAndroidThreadSettingsFailureKHR: + return "ErrorAndroidThreadSettingsFailureKHR"; + + case Result::ErrorCreateSpatialAnchorFailedMSFT: + return "ErrorCreateSpatialAnchorFailedMSFT"; + + case Result::ErrorSecondaryViewConfigurationTypeNotEnabledMSFT: + return "ErrorSecondaryViewConfigurationTypeNotEnabledMSFT"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a Result value as a +//! std::string +//! @relates Result +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(Result value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrStructureType +//! +//! See the related specification text at +//! +enum class StructureType : uint32_t { + + Unknown = XR_TYPE_UNKNOWN, + + ApiLayerProperties = XR_TYPE_API_LAYER_PROPERTIES, + + ExtensionProperties = XR_TYPE_EXTENSION_PROPERTIES, + + InstanceCreateInfo = XR_TYPE_INSTANCE_CREATE_INFO, + + SystemGetInfo = XR_TYPE_SYSTEM_GET_INFO, + + SystemProperties = XR_TYPE_SYSTEM_PROPERTIES, + + ViewLocateInfo = XR_TYPE_VIEW_LOCATE_INFO, + + View = XR_TYPE_VIEW, + + SessionCreateInfo = XR_TYPE_SESSION_CREATE_INFO, + + SwapchainCreateInfo = XR_TYPE_SWAPCHAIN_CREATE_INFO, + + SessionBeginInfo = XR_TYPE_SESSION_BEGIN_INFO, + + ViewState = XR_TYPE_VIEW_STATE, + + FrameEndInfo = XR_TYPE_FRAME_END_INFO, + + HapticVibration = XR_TYPE_HAPTIC_VIBRATION, + + EventDataBuffer = XR_TYPE_EVENT_DATA_BUFFER, + + EventDataInstanceLossPending = XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING, + + EventDataSessionStateChanged = XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED, + + ActionStateBoolean = XR_TYPE_ACTION_STATE_BOOLEAN, + + ActionStateFloat = XR_TYPE_ACTION_STATE_FLOAT, + + ActionStateVector2F = XR_TYPE_ACTION_STATE_VECTOR2F, + + ActionStatePose = XR_TYPE_ACTION_STATE_POSE, + + ActionSetCreateInfo = XR_TYPE_ACTION_SET_CREATE_INFO, + + ActionCreateInfo = XR_TYPE_ACTION_CREATE_INFO, + + InstanceProperties = XR_TYPE_INSTANCE_PROPERTIES, + + FrameWaitInfo = XR_TYPE_FRAME_WAIT_INFO, + + CompositionLayerProjection = XR_TYPE_COMPOSITION_LAYER_PROJECTION, + + CompositionLayerQuad = XR_TYPE_COMPOSITION_LAYER_QUAD, + + ReferenceSpaceCreateInfo = XR_TYPE_REFERENCE_SPACE_CREATE_INFO, + + ActionSpaceCreateInfo = XR_TYPE_ACTION_SPACE_CREATE_INFO, + + EventDataReferenceSpaceChangePending = + XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING, + + ViewConfigurationView = XR_TYPE_VIEW_CONFIGURATION_VIEW, + + SpaceLocation = XR_TYPE_SPACE_LOCATION, + + SpaceVelocity = XR_TYPE_SPACE_VELOCITY, + + FrameState = XR_TYPE_FRAME_STATE, + + ViewConfigurationProperties = XR_TYPE_VIEW_CONFIGURATION_PROPERTIES, + + FrameBeginInfo = XR_TYPE_FRAME_BEGIN_INFO, + + CompositionLayerProjectionView = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW, + + EventDataEventsLost = XR_TYPE_EVENT_DATA_EVENTS_LOST, + + InteractionProfileSuggestedBinding = + XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING, + + EventDataInteractionProfileChanged = + XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED, + + InteractionProfileState = XR_TYPE_INTERACTION_PROFILE_STATE, + + SwapchainImageAcquireInfo = XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO, + + SwapchainImageWaitInfo = XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO, + + SwapchainImageReleaseInfo = XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO, + + ActionStateGetInfo = XR_TYPE_ACTION_STATE_GET_INFO, + + HapticActionInfo = XR_TYPE_HAPTIC_ACTION_INFO, + + SessionActionSetsAttachInfo = XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO, + + ActionsSyncInfo = XR_TYPE_ACTIONS_SYNC_INFO, + + BoundSourcesForActionEnumerateInfo = + XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO, + + InputSourceLocalizedNameGetInfo = + XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO, + + CompositionLayerCubeKHR = XR_TYPE_COMPOSITION_LAYER_CUBE_KHR, + + InstanceCreateInfoAndroidKHR = XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR, + + CompositionLayerDepthInfoKHR = XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR, + + VulkanSwapchainFormatListCreateInfoKHR = + XR_TYPE_VULKAN_SWAPCHAIN_FORMAT_LIST_CREATE_INFO_KHR, + + EventDataPerfSettingsEXT = XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT, + + CompositionLayerCylinderKHR = XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR, + + CompositionLayerEquirectKHR = XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR, + + DebugUtilsObjectNameInfoEXT = XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, + + DebugUtilsMessengerCallbackDataEXT = + XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT, + + DebugUtilsMessengerCreateInfoEXT = + XR_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT, + + DebugUtilsLabelEXT = XR_TYPE_DEBUG_UTILS_LABEL_EXT, + + GraphicsBindingOpenglWin32KHR = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR, + + GraphicsBindingOpenglXlibKHR = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR, + + GraphicsBindingOpenglXcbKHR = XR_TYPE_GRAPHICS_BINDING_OPENGL_XCB_KHR, + + GraphicsBindingOpenglWaylandKHR = XR_TYPE_GRAPHICS_BINDING_OPENGL_WAYLAND_KHR, + + SwapchainImageOpenglKHR = XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR, + + GraphicsRequirementsOpenglKHR = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR, + + GraphicsBindingOpenglEsAndroidKHR = + XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR, + + SwapchainImageOpenglEsKHR = XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_ES_KHR, + + GraphicsRequirementsOpenglEsKHR = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR, + + GraphicsBindingVulkanKHR = XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR, + + SwapchainImageVulkanKHR = XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR, + + GraphicsRequirementsVulkanKHR = XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR, + + GraphicsBindingD3D11KHR = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR, + + SwapchainImageD3D11KHR = XR_TYPE_SWAPCHAIN_IMAGE_D3D11_KHR, + + GraphicsRequirementsD3D11KHR = XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR, + + GraphicsBindingD3D12KHR = XR_TYPE_GRAPHICS_BINDING_D3D12_KHR, + + SwapchainImageD3D12KHR = XR_TYPE_SWAPCHAIN_IMAGE_D3D12_KHR, + + GraphicsRequirementsD3D12KHR = XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR, + + SystemEyeGazeInteractionPropertiesEXT = + XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT, + + EyeGazeSampleTimeEXT = XR_TYPE_EYE_GAZE_SAMPLE_TIME_EXT, + + VisibilityMaskKHR = XR_TYPE_VISIBILITY_MASK_KHR, + + EventDataVisibilityMaskChangedKHR = + XR_TYPE_EVENT_DATA_VISIBILITY_MASK_CHANGED_KHR, + + SessionCreateInfoOverlayEXTX = XR_TYPE_SESSION_CREATE_INFO_OVERLAY_EXTX, + + EventDataMainSessionVisibilityChangedEXTX = + XR_TYPE_EVENT_DATA_MAIN_SESSION_VISIBILITY_CHANGED_EXTX, + + SpatialAnchorCreateInfoMSFT = XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT, + + SpatialAnchorSpaceCreateInfoMSFT = + XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT, + + ViewConfigurationDepthRangeEXT = XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT, + + GraphicsBindingEglMNDX = XR_TYPE_GRAPHICS_BINDING_EGL_MNDX, + + SpatialGraphNodeSpaceCreateInfoMSFT = + XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT, + + SystemHandTrackingPropertiesEXT = XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT, + + HandTrackerCreateInfoEXT = XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT, + + HandJointsLocateInfoEXT = XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT, + + HandJointLocationsEXT = XR_TYPE_HAND_JOINT_LOCATIONS_EXT, + + HandJointVelocitiesEXT = XR_TYPE_HAND_JOINT_VELOCITIES_EXT, + + SystemHandTrackingMeshPropertiesMSFT = + XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT, + + HandMeshSpaceCreateInfoMSFT = XR_TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT, + + HandMeshUpdateInfoMSFT = XR_TYPE_HAND_MESH_UPDATE_INFO_MSFT, + + HandMeshMSFT = XR_TYPE_HAND_MESH_MSFT, + + HandPoseTypeInfoMSFT = XR_TYPE_HAND_POSE_TYPE_INFO_MSFT, + + SecondaryViewConfigurationSessionBeginInfoMSFT = + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SESSION_BEGIN_INFO_MSFT, + + SecondaryViewConfigurationStateMSFT = + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_STATE_MSFT, + + SecondaryViewConfigurationFrameStateMSFT = + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_STATE_MSFT, + + SecondaryViewConfigurationFrameEndInfoMSFT = + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_END_INFO_MSFT, + + SecondaryViewConfigurationLayerInfoMSFT = + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_LAYER_INFO_MSFT, + + SecondaryViewConfigurationSwapchainCreateInfoMSFT = + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SWAPCHAIN_CREATE_INFO_MSFT, + + ViewConfigurationViewFovEPIC = XR_TYPE_VIEW_CONFIGURATION_VIEW_FOV_EPIC, + +}; + +//! @brief Free function for retrieving the raw XrStructureType value from a +//! StructureType +//! @relates StructureType +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrStructureType +get(StructureType const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a StructureType value +//! as a const char * +//! @relates StructureType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(StructureType value) { + switch (value) { + + case StructureType::Unknown: + return "Unknown"; + + case StructureType::ApiLayerProperties: + return "ApiLayerProperties"; + + case StructureType::ExtensionProperties: + return "ExtensionProperties"; + + case StructureType::InstanceCreateInfo: + return "InstanceCreateInfo"; + + case StructureType::SystemGetInfo: + return "SystemGetInfo"; + + case StructureType::SystemProperties: + return "SystemProperties"; + + case StructureType::ViewLocateInfo: + return "ViewLocateInfo"; + + case StructureType::View: + return "View"; + + case StructureType::SessionCreateInfo: + return "SessionCreateInfo"; + + case StructureType::SwapchainCreateInfo: + return "SwapchainCreateInfo"; + + case StructureType::SessionBeginInfo: + return "SessionBeginInfo"; + + case StructureType::ViewState: + return "ViewState"; + + case StructureType::FrameEndInfo: + return "FrameEndInfo"; + + case StructureType::HapticVibration: + return "HapticVibration"; + + case StructureType::EventDataBuffer: + return "EventDataBuffer"; + + case StructureType::EventDataInstanceLossPending: + return "EventDataInstanceLossPending"; + + case StructureType::EventDataSessionStateChanged: + return "EventDataSessionStateChanged"; + + case StructureType::ActionStateBoolean: + return "ActionStateBoolean"; + + case StructureType::ActionStateFloat: + return "ActionStateFloat"; + + case StructureType::ActionStateVector2F: + return "ActionStateVector2F"; + + case StructureType::ActionStatePose: + return "ActionStatePose"; + + case StructureType::ActionSetCreateInfo: + return "ActionSetCreateInfo"; + + case StructureType::ActionCreateInfo: + return "ActionCreateInfo"; + + case StructureType::InstanceProperties: + return "InstanceProperties"; + + case StructureType::FrameWaitInfo: + return "FrameWaitInfo"; + + case StructureType::CompositionLayerProjection: + return "CompositionLayerProjection"; + + case StructureType::CompositionLayerQuad: + return "CompositionLayerQuad"; + + case StructureType::ReferenceSpaceCreateInfo: + return "ReferenceSpaceCreateInfo"; + + case StructureType::ActionSpaceCreateInfo: + return "ActionSpaceCreateInfo"; + + case StructureType::EventDataReferenceSpaceChangePending: + return "EventDataReferenceSpaceChangePending"; + + case StructureType::ViewConfigurationView: + return "ViewConfigurationView"; + + case StructureType::SpaceLocation: + return "SpaceLocation"; + + case StructureType::SpaceVelocity: + return "SpaceVelocity"; + + case StructureType::FrameState: + return "FrameState"; + + case StructureType::ViewConfigurationProperties: + return "ViewConfigurationProperties"; + + case StructureType::FrameBeginInfo: + return "FrameBeginInfo"; + + case StructureType::CompositionLayerProjectionView: + return "CompositionLayerProjectionView"; + + case StructureType::EventDataEventsLost: + return "EventDataEventsLost"; + + case StructureType::InteractionProfileSuggestedBinding: + return "InteractionProfileSuggestedBinding"; + + case StructureType::EventDataInteractionProfileChanged: + return "EventDataInteractionProfileChanged"; + + case StructureType::InteractionProfileState: + return "InteractionProfileState"; + + case StructureType::SwapchainImageAcquireInfo: + return "SwapchainImageAcquireInfo"; + + case StructureType::SwapchainImageWaitInfo: + return "SwapchainImageWaitInfo"; + + case StructureType::SwapchainImageReleaseInfo: + return "SwapchainImageReleaseInfo"; + + case StructureType::ActionStateGetInfo: + return "ActionStateGetInfo"; + + case StructureType::HapticActionInfo: + return "HapticActionInfo"; + + case StructureType::SessionActionSetsAttachInfo: + return "SessionActionSetsAttachInfo"; + + case StructureType::ActionsSyncInfo: + return "ActionsSyncInfo"; + + case StructureType::BoundSourcesForActionEnumerateInfo: + return "BoundSourcesForActionEnumerateInfo"; + + case StructureType::InputSourceLocalizedNameGetInfo: + return "InputSourceLocalizedNameGetInfo"; + + case StructureType::CompositionLayerCubeKHR: + return "CompositionLayerCubeKHR"; + + case StructureType::InstanceCreateInfoAndroidKHR: + return "InstanceCreateInfoAndroidKHR"; + + case StructureType::CompositionLayerDepthInfoKHR: + return "CompositionLayerDepthInfoKHR"; + + case StructureType::VulkanSwapchainFormatListCreateInfoKHR: + return "VulkanSwapchainFormatListCreateInfoKHR"; + + case StructureType::EventDataPerfSettingsEXT: + return "EventDataPerfSettingsEXT"; + + case StructureType::CompositionLayerCylinderKHR: + return "CompositionLayerCylinderKHR"; + + case StructureType::CompositionLayerEquirectKHR: + return "CompositionLayerEquirectKHR"; + + case StructureType::DebugUtilsObjectNameInfoEXT: + return "DebugUtilsObjectNameInfoEXT"; + + case StructureType::DebugUtilsMessengerCallbackDataEXT: + return "DebugUtilsMessengerCallbackDataEXT"; + + case StructureType::DebugUtilsMessengerCreateInfoEXT: + return "DebugUtilsMessengerCreateInfoEXT"; + + case StructureType::DebugUtilsLabelEXT: + return "DebugUtilsLabelEXT"; + + case StructureType::GraphicsBindingOpenglWin32KHR: + return "GraphicsBindingOpenglWin32KHR"; + + case StructureType::GraphicsBindingOpenglXlibKHR: + return "GraphicsBindingOpenglXlibKHR"; + + case StructureType::GraphicsBindingOpenglXcbKHR: + return "GraphicsBindingOpenglXcbKHR"; + + case StructureType::GraphicsBindingOpenglWaylandKHR: + return "GraphicsBindingOpenglWaylandKHR"; + + case StructureType::SwapchainImageOpenglKHR: + return "SwapchainImageOpenglKHR"; + + case StructureType::GraphicsRequirementsOpenglKHR: + return "GraphicsRequirementsOpenglKHR"; + + case StructureType::GraphicsBindingOpenglEsAndroidKHR: + return "GraphicsBindingOpenglEsAndroidKHR"; + + case StructureType::SwapchainImageOpenglEsKHR: + return "SwapchainImageOpenglEsKHR"; + + case StructureType::GraphicsRequirementsOpenglEsKHR: + return "GraphicsRequirementsOpenglEsKHR"; + + case StructureType::GraphicsBindingVulkanKHR: + return "GraphicsBindingVulkanKHR"; + + case StructureType::SwapchainImageVulkanKHR: + return "SwapchainImageVulkanKHR"; + + case StructureType::GraphicsRequirementsVulkanKHR: + return "GraphicsRequirementsVulkanKHR"; + + case StructureType::GraphicsBindingD3D11KHR: + return "GraphicsBindingD3D11KHR"; + + case StructureType::SwapchainImageD3D11KHR: + return "SwapchainImageD3D11KHR"; + + case StructureType::GraphicsRequirementsD3D11KHR: + return "GraphicsRequirementsD3D11KHR"; + + case StructureType::GraphicsBindingD3D12KHR: + return "GraphicsBindingD3D12KHR"; + + case StructureType::SwapchainImageD3D12KHR: + return "SwapchainImageD3D12KHR"; + + case StructureType::GraphicsRequirementsD3D12KHR: + return "GraphicsRequirementsD3D12KHR"; + + case StructureType::SystemEyeGazeInteractionPropertiesEXT: + return "SystemEyeGazeInteractionPropertiesEXT"; + + case StructureType::EyeGazeSampleTimeEXT: + return "EyeGazeSampleTimeEXT"; + + case StructureType::VisibilityMaskKHR: + return "VisibilityMaskKHR"; + + case StructureType::EventDataVisibilityMaskChangedKHR: + return "EventDataVisibilityMaskChangedKHR"; + + case StructureType::SessionCreateInfoOverlayEXTX: + return "SessionCreateInfoOverlayEXTX"; + + case StructureType::EventDataMainSessionVisibilityChangedEXTX: + return "EventDataMainSessionVisibilityChangedEXTX"; + + case StructureType::SpatialAnchorCreateInfoMSFT: + return "SpatialAnchorCreateInfoMSFT"; + + case StructureType::SpatialAnchorSpaceCreateInfoMSFT: + return "SpatialAnchorSpaceCreateInfoMSFT"; + + case StructureType::ViewConfigurationDepthRangeEXT: + return "ViewConfigurationDepthRangeEXT"; + + case StructureType::GraphicsBindingEglMNDX: + return "GraphicsBindingEglMNDX"; + + case StructureType::SpatialGraphNodeSpaceCreateInfoMSFT: + return "SpatialGraphNodeSpaceCreateInfoMSFT"; + + case StructureType::SystemHandTrackingPropertiesEXT: + return "SystemHandTrackingPropertiesEXT"; + + case StructureType::HandTrackerCreateInfoEXT: + return "HandTrackerCreateInfoEXT"; + + case StructureType::HandJointsLocateInfoEXT: + return "HandJointsLocateInfoEXT"; + + case StructureType::HandJointLocationsEXT: + return "HandJointLocationsEXT"; + + case StructureType::HandJointVelocitiesEXT: + return "HandJointVelocitiesEXT"; + + case StructureType::SystemHandTrackingMeshPropertiesMSFT: + return "SystemHandTrackingMeshPropertiesMSFT"; + + case StructureType::HandMeshSpaceCreateInfoMSFT: + return "HandMeshSpaceCreateInfoMSFT"; + + case StructureType::HandMeshUpdateInfoMSFT: + return "HandMeshUpdateInfoMSFT"; + + case StructureType::HandMeshMSFT: + return "HandMeshMSFT"; + + case StructureType::HandPoseTypeInfoMSFT: + return "HandPoseTypeInfoMSFT"; + + case StructureType::SecondaryViewConfigurationSessionBeginInfoMSFT: + return "SecondaryViewConfigurationSessionBeginInfoMSFT"; + + case StructureType::SecondaryViewConfigurationStateMSFT: + return "SecondaryViewConfigurationStateMSFT"; + + case StructureType::SecondaryViewConfigurationFrameStateMSFT: + return "SecondaryViewConfigurationFrameStateMSFT"; + + case StructureType::SecondaryViewConfigurationFrameEndInfoMSFT: + return "SecondaryViewConfigurationFrameEndInfoMSFT"; + + case StructureType::SecondaryViewConfigurationLayerInfoMSFT: + return "SecondaryViewConfigurationLayerInfoMSFT"; + + case StructureType::SecondaryViewConfigurationSwapchainCreateInfoMSFT: + return "SecondaryViewConfigurationSwapchainCreateInfoMSFT"; + + case StructureType::ViewConfigurationViewFovEPIC: + return "ViewConfigurationViewFovEPIC"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a StructureType value +//! as a std::string +//! @relates StructureType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(StructureType value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrFormFactor +//! +//! See the related specification text at +//! +enum class FormFactor : uint32_t { + + HeadMountedDisplay = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, + + HandheldDisplay = XR_FORM_FACTOR_HANDHELD_DISPLAY, + +}; + +//! @brief Free function for retrieving the raw XrFormFactor value from a +//! FormFactor +//! @relates FormFactor +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrFormFactor get(FormFactor const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a FormFactor value as +//! a const char * +//! @relates FormFactor +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(FormFactor value) { + switch (value) { + + case FormFactor::HeadMountedDisplay: + return "HeadMountedDisplay"; + + case FormFactor::HandheldDisplay: + return "HandheldDisplay"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a FormFactor value as +//! a std::string +//! @relates FormFactor +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(FormFactor value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrViewConfigurationType +//! +//! See the related specification text at +//! +enum class ViewConfigurationType : uint32_t { + + PrimaryMono = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO, + + PrimaryStereo = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, + + PrimaryQuadVARJO = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_QUAD_VARJO, + + SecondaryMonoFirstPersonObserverMSFT = + XR_VIEW_CONFIGURATION_TYPE_SECONDARY_MONO_FIRST_PERSON_OBSERVER_MSFT, + +}; + +//! @brief Free function for retrieving the raw XrViewConfigurationType value +//! from a ViewConfigurationType +//! @relates ViewConfigurationType +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrViewConfigurationType +get(ViewConfigurationType const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! ViewConfigurationType value as a const char * +//! @relates ViewConfigurationType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(ViewConfigurationType value) { + switch (value) { + + case ViewConfigurationType::PrimaryMono: + return "PrimaryMono"; + + case ViewConfigurationType::PrimaryStereo: + return "PrimaryStereo"; + + case ViewConfigurationType::PrimaryQuadVARJO: + return "PrimaryQuadVARJO"; + + case ViewConfigurationType::SecondaryMonoFirstPersonObserverMSFT: + return "SecondaryMonoFirstPersonObserverMSFT"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! ViewConfigurationType value as a std::string +//! @relates ViewConfigurationType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(ViewConfigurationType value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrEnvironmentBlendMode +//! +//! See the related specification text at +//! +enum class EnvironmentBlendMode : uint32_t { + + Opaque = XR_ENVIRONMENT_BLEND_MODE_OPAQUE, + + Additive = XR_ENVIRONMENT_BLEND_MODE_ADDITIVE, + + AlphaBlend = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND, + +}; + +//! @brief Free function for retrieving the raw XrEnvironmentBlendMode value +//! from a EnvironmentBlendMode +//! @relates EnvironmentBlendMode +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrEnvironmentBlendMode +get(EnvironmentBlendMode const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! EnvironmentBlendMode value as a const char * +//! @relates EnvironmentBlendMode +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(EnvironmentBlendMode value) { + switch (value) { + + case EnvironmentBlendMode::Opaque: + return "Opaque"; + + case EnvironmentBlendMode::Additive: + return "Additive"; + + case EnvironmentBlendMode::AlphaBlend: + return "AlphaBlend"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! EnvironmentBlendMode value as a std::string +//! @relates EnvironmentBlendMode +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(EnvironmentBlendMode value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrReferenceSpaceType +//! +//! See the related specification text at +//! +enum class ReferenceSpaceType : uint32_t { + + View = XR_REFERENCE_SPACE_TYPE_VIEW, + + Local = XR_REFERENCE_SPACE_TYPE_LOCAL, + + Stage = XR_REFERENCE_SPACE_TYPE_STAGE, + + UnboundedMSFT = XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT, + +}; + +//! @brief Free function for retrieving the raw XrReferenceSpaceType value from +//! a ReferenceSpaceType +//! @relates ReferenceSpaceType +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrReferenceSpaceType +get(ReferenceSpaceType const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a ReferenceSpaceType +//! value as a const char * +//! @relates ReferenceSpaceType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(ReferenceSpaceType value) { + switch (value) { + + case ReferenceSpaceType::View: + return "View"; + + case ReferenceSpaceType::Local: + return "Local"; + + case ReferenceSpaceType::Stage: + return "Stage"; + + case ReferenceSpaceType::UnboundedMSFT: + return "UnboundedMSFT"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a ReferenceSpaceType +//! value as a std::string +//! @relates ReferenceSpaceType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(ReferenceSpaceType value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrActionType +//! +//! See the related specification text at +//! +enum class ActionType : uint32_t { + + BooleanInput = XR_ACTION_TYPE_BOOLEAN_INPUT, + + FloatInput = XR_ACTION_TYPE_FLOAT_INPUT, + + Vector2FInput = XR_ACTION_TYPE_VECTOR2F_INPUT, + + PoseInput = XR_ACTION_TYPE_POSE_INPUT, + + VibrationOutput = XR_ACTION_TYPE_VIBRATION_OUTPUT, + +}; + +//! @brief Free function for retrieving the raw XrActionType value from a +//! ActionType +//! @relates ActionType +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrActionType get(ActionType const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a ActionType value as +//! a const char * +//! @relates ActionType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(ActionType value) { + switch (value) { + + case ActionType::BooleanInput: + return "BooleanInput"; + + case ActionType::FloatInput: + return "FloatInput"; + + case ActionType::Vector2FInput: + return "Vector2FInput"; + + case ActionType::PoseInput: + return "PoseInput"; + + case ActionType::VibrationOutput: + return "VibrationOutput"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a ActionType value as +//! a std::string +//! @relates ActionType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(ActionType value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrEyeVisibility +//! +//! See the related specification text at +//! +enum class EyeVisibility : uint32_t { + + Both = XR_EYE_VISIBILITY_BOTH, + + Left = XR_EYE_VISIBILITY_LEFT, + + Right = XR_EYE_VISIBILITY_RIGHT, + +}; + +//! @brief Free function for retrieving the raw XrEyeVisibility value from a +//! EyeVisibility +//! @relates EyeVisibility +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrEyeVisibility +get(EyeVisibility const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a EyeVisibility value +//! as a const char * +//! @relates EyeVisibility +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(EyeVisibility value) { + switch (value) { + + case EyeVisibility::Both: + return "Both"; + + case EyeVisibility::Left: + return "Left"; + + case EyeVisibility::Right: + return "Right"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a EyeVisibility value +//! as a std::string +//! @relates EyeVisibility +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(EyeVisibility value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrSessionState +//! +//! See the related specification text at +//! +enum class SessionState : uint32_t { + + Unknown = XR_SESSION_STATE_UNKNOWN, + + Idle = XR_SESSION_STATE_IDLE, + + Ready = XR_SESSION_STATE_READY, + + Synchronized = XR_SESSION_STATE_SYNCHRONIZED, + + Visible = XR_SESSION_STATE_VISIBLE, + + Focused = XR_SESSION_STATE_FOCUSED, + + Stopping = XR_SESSION_STATE_STOPPING, + + LossPending = XR_SESSION_STATE_LOSS_PENDING, + + Exiting = XR_SESSION_STATE_EXITING, + +}; + +//! @brief Free function for retrieving the raw XrSessionState value from a +//! SessionState +//! @relates SessionState +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrSessionState +get(SessionState const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a SessionState value +//! as a const char * +//! @relates SessionState +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(SessionState value) { + switch (value) { + + case SessionState::Unknown: + return "Unknown"; + + case SessionState::Idle: + return "Idle"; + + case SessionState::Ready: + return "Ready"; + + case SessionState::Synchronized: + return "Synchronized"; + + case SessionState::Visible: + return "Visible"; + + case SessionState::Focused: + return "Focused"; + + case SessionState::Stopping: + return "Stopping"; + + case SessionState::LossPending: + return "LossPending"; + + case SessionState::Exiting: + return "Exiting"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a SessionState value +//! as a std::string +//! @relates SessionState +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(SessionState value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrObjectType +//! +//! See the related specification text at +//! +enum class ObjectType : uint32_t { + + Unknown = XR_OBJECT_TYPE_UNKNOWN, + + Instance = XR_OBJECT_TYPE_INSTANCE, + + Session = XR_OBJECT_TYPE_SESSION, + + Swapchain = XR_OBJECT_TYPE_SWAPCHAIN, + + Space = XR_OBJECT_TYPE_SPACE, + + ActionSet = XR_OBJECT_TYPE_ACTION_SET, + + Action = XR_OBJECT_TYPE_ACTION, + + DebugUtilsMessengerEXT = XR_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT, + + SpatialAnchorMSFT = XR_OBJECT_TYPE_SPATIAL_ANCHOR_MSFT, + + HandTrackerEXT = XR_OBJECT_TYPE_HAND_TRACKER_EXT, + +}; + +//! @brief Free function for retrieving the raw XrObjectType value from a +//! ObjectType +//! @relates ObjectType +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrObjectType get(ObjectType const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a ObjectType value as +//! a const char * +//! @relates ObjectType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(ObjectType value) { + switch (value) { + + case ObjectType::Unknown: + return "Unknown"; + + case ObjectType::Instance: + return "Instance"; + + case ObjectType::Session: + return "Session"; + + case ObjectType::Swapchain: + return "Swapchain"; + + case ObjectType::Space: + return "Space"; + + case ObjectType::ActionSet: + return "ActionSet"; + + case ObjectType::Action: + return "Action"; + + case ObjectType::DebugUtilsMessengerEXT: + return "DebugUtilsMessengerEXT"; + + case ObjectType::SpatialAnchorMSFT: + return "SpatialAnchorMSFT"; + + case ObjectType::HandTrackerEXT: + return "HandTrackerEXT"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a ObjectType value as +//! a std::string +//! @relates ObjectType +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(ObjectType value) { + return {to_string_literal(value)}; +} + +#if defined(XR_USE_PLATFORM_ANDROID) +//! @brief Enum class associated with XrAndroidThreadTypeKHR +//! +//! See the related specification text at +//! +enum class AndroidThreadTypeKHR : uint32_t { + + ApplicationMain = XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, + + ApplicationWorker = XR_ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR, + + RendererMain = XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, + + RendererWorker = XR_ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR, + +}; + +//! @brief Free function for retrieving the raw XrAndroidThreadTypeKHR value +//! from a AndroidThreadTypeKHR +//! @relates AndroidThreadTypeKHR +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrAndroidThreadTypeKHR +get(AndroidThreadTypeKHR const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! AndroidThreadTypeKHR value as a const char * +//! @relates AndroidThreadTypeKHR +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(AndroidThreadTypeKHR value) { + switch (value) { + + case AndroidThreadTypeKHR::ApplicationMain: + return "ApplicationMain"; + + case AndroidThreadTypeKHR::ApplicationWorker: + return "ApplicationWorker"; + + case AndroidThreadTypeKHR::RendererMain: + return "RendererMain"; + + case AndroidThreadTypeKHR::RendererWorker: + return "RendererWorker"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! AndroidThreadTypeKHR value as a std::string +//! @relates AndroidThreadTypeKHR +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(AndroidThreadTypeKHR value) { + return {to_string_literal(value)}; +} + +#endif // defined(XR_USE_PLATFORM_ANDROID) + +//! @brief Enum class associated with XrVisibilityMaskTypeKHR +//! +//! See the related specification text at +//! +enum class VisibilityMaskTypeKHR : uint32_t { + + HiddenTriangleMesh = XR_VISIBILITY_MASK_TYPE_HIDDEN_TRIANGLE_MESH_KHR, + + VisibleTriangleMesh = XR_VISIBILITY_MASK_TYPE_VISIBLE_TRIANGLE_MESH_KHR, + + LineLoop = XR_VISIBILITY_MASK_TYPE_LINE_LOOP_KHR, + +}; + +//! @brief Free function for retrieving the raw XrVisibilityMaskTypeKHR value +//! from a VisibilityMaskTypeKHR +//! @relates VisibilityMaskTypeKHR +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrVisibilityMaskTypeKHR +get(VisibilityMaskTypeKHR const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! VisibilityMaskTypeKHR value as a const char * +//! @relates VisibilityMaskTypeKHR +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(VisibilityMaskTypeKHR value) { + switch (value) { + + case VisibilityMaskTypeKHR::HiddenTriangleMesh: + return "HiddenTriangleMesh"; + + case VisibilityMaskTypeKHR::VisibleTriangleMesh: + return "VisibleTriangleMesh"; + + case VisibilityMaskTypeKHR::LineLoop: + return "LineLoop"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! VisibilityMaskTypeKHR value as a std::string +//! @relates VisibilityMaskTypeKHR +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(VisibilityMaskTypeKHR value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrPerfSettingsDomainEXT +//! +//! See the related specification text at +//! +enum class PerfSettingsDomainEXT : uint32_t { + + Cpu = XR_PERF_SETTINGS_DOMAIN_CPU_EXT, + + Gpu = XR_PERF_SETTINGS_DOMAIN_GPU_EXT, + +}; + +//! @brief Free function for retrieving the raw XrPerfSettingsDomainEXT value +//! from a PerfSettingsDomainEXT +//! @relates PerfSettingsDomainEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrPerfSettingsDomainEXT +get(PerfSettingsDomainEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsDomainEXT value as a const char * +//! @relates PerfSettingsDomainEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(PerfSettingsDomainEXT value) { + switch (value) { + + case PerfSettingsDomainEXT::Cpu: + return "Cpu"; + + case PerfSettingsDomainEXT::Gpu: + return "Gpu"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsDomainEXT value as a std::string +//! @relates PerfSettingsDomainEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(PerfSettingsDomainEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrPerfSettingsSubDomainEXT +//! +//! See the related specification text at +//! +enum class PerfSettingsSubDomainEXT : uint32_t { + + Compositing = XR_PERF_SETTINGS_SUB_DOMAIN_COMPOSITING_EXT, + + Rendering = XR_PERF_SETTINGS_SUB_DOMAIN_RENDERING_EXT, + + Thermal = XR_PERF_SETTINGS_SUB_DOMAIN_THERMAL_EXT, + +}; + +//! @brief Free function for retrieving the raw XrPerfSettingsSubDomainEXT value +//! from a PerfSettingsSubDomainEXT +//! @relates PerfSettingsSubDomainEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrPerfSettingsSubDomainEXT +get(PerfSettingsSubDomainEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsSubDomainEXT value as a const char * +//! @relates PerfSettingsSubDomainEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(PerfSettingsSubDomainEXT value) { + switch (value) { + + case PerfSettingsSubDomainEXT::Compositing: + return "Compositing"; + + case PerfSettingsSubDomainEXT::Rendering: + return "Rendering"; + + case PerfSettingsSubDomainEXT::Thermal: + return "Thermal"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsSubDomainEXT value as a std::string +//! @relates PerfSettingsSubDomainEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(PerfSettingsSubDomainEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrPerfSettingsLevelEXT +//! +//! See the related specification text at +//! +enum class PerfSettingsLevelEXT : uint32_t { + + PowerSavings = XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT, + + SustainedLow = XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT, + + SustainedHigh = XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT, + + Boost = XR_PERF_SETTINGS_LEVEL_BOOST_EXT, + +}; + +//! @brief Free function for retrieving the raw XrPerfSettingsLevelEXT value +//! from a PerfSettingsLevelEXT +//! @relates PerfSettingsLevelEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrPerfSettingsLevelEXT +get(PerfSettingsLevelEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsLevelEXT value as a const char * +//! @relates PerfSettingsLevelEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(PerfSettingsLevelEXT value) { + switch (value) { + + case PerfSettingsLevelEXT::PowerSavings: + return "PowerSavings"; + + case PerfSettingsLevelEXT::SustainedLow: + return "SustainedLow"; + + case PerfSettingsLevelEXT::SustainedHigh: + return "SustainedHigh"; + + case PerfSettingsLevelEXT::Boost: + return "Boost"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsLevelEXT value as a std::string +//! @relates PerfSettingsLevelEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(PerfSettingsLevelEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrPerfSettingsNotificationLevelEXT +//! +//! See the related specification text at +//! +enum class PerfSettingsNotificationLevelEXT : uint32_t { + + XrPerfSettingsNotifLevelNormal = XR_PERF_SETTINGS_NOTIF_LEVEL_NORMAL_EXT, + + XrPerfSettingsNotifLevelWarning = XR_PERF_SETTINGS_NOTIF_LEVEL_WARNING_EXT, + + XrPerfSettingsNotifLevelImpaired = XR_PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED_EXT, + +}; + +//! @brief Free function for retrieving the raw +//! XrPerfSettingsNotificationLevelEXT value from a +//! PerfSettingsNotificationLevelEXT +//! @relates PerfSettingsNotificationLevelEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrPerfSettingsNotificationLevelEXT +get(PerfSettingsNotificationLevelEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsNotificationLevelEXT value as a const char * +//! @relates PerfSettingsNotificationLevelEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(PerfSettingsNotificationLevelEXT value) { + switch (value) { + + case PerfSettingsNotificationLevelEXT::XrPerfSettingsNotifLevelNormal: + return "XrPerfSettingsNotifLevelNormal"; + + case PerfSettingsNotificationLevelEXT::XrPerfSettingsNotifLevelWarning: + return "XrPerfSettingsNotifLevelWarning"; + + case PerfSettingsNotificationLevelEXT::XrPerfSettingsNotifLevelImpaired: + return "XrPerfSettingsNotifLevelImpaired"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! PerfSettingsNotificationLevelEXT value as a std::string +//! @relates PerfSettingsNotificationLevelEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(PerfSettingsNotificationLevelEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrSpatialGraphNodeTypeMSFT +//! +//! See the related specification text at +//! +enum class SpatialGraphNodeTypeMSFT : uint32_t { + + Static = XR_SPATIAL_GRAPH_NODE_TYPE_STATIC_MSFT, + + Dynamic = XR_SPATIAL_GRAPH_NODE_TYPE_DYNAMIC_MSFT, + +}; + +//! @brief Free function for retrieving the raw XrSpatialGraphNodeTypeMSFT value +//! from a SpatialGraphNodeTypeMSFT +//! @relates SpatialGraphNodeTypeMSFT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrSpatialGraphNodeTypeMSFT +get(SpatialGraphNodeTypeMSFT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a +//! SpatialGraphNodeTypeMSFT value as a const char * +//! @relates SpatialGraphNodeTypeMSFT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(SpatialGraphNodeTypeMSFT value) { + switch (value) { + + case SpatialGraphNodeTypeMSFT::Static: + return "Static"; + + case SpatialGraphNodeTypeMSFT::Dynamic: + return "Dynamic"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a +//! SpatialGraphNodeTypeMSFT value as a std::string +//! @relates SpatialGraphNodeTypeMSFT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(SpatialGraphNodeTypeMSFT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrHandEXT +//! +//! See the related specification text at +//! +enum class HandEXT : uint32_t { + + Left = XR_HAND_LEFT_EXT, + + Right = XR_HAND_RIGHT_EXT, + +}; + +//! @brief Free function for retrieving the raw XrHandEXT value from a HandEXT +//! @relates HandEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrHandEXT get(HandEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a HandEXT value as a +//! const char * +//! @relates HandEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(HandEXT value) { + switch (value) { + + case HandEXT::Left: + return "Left"; + + case HandEXT::Right: + return "Right"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a HandEXT value as a +//! std::string +//! @relates HandEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(HandEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrHandJointEXT +//! +//! See the related specification text at +//! +enum class HandJointEXT : uint32_t { + + Palm = XR_HAND_JOINT_PALM_EXT, + + Wrist = XR_HAND_JOINT_WRIST_EXT, + + ThumbMetacarpal = XR_HAND_JOINT_THUMB_METACARPAL_EXT, + + ThumbProximal = XR_HAND_JOINT_THUMB_PROXIMAL_EXT, + + ThumbDistal = XR_HAND_JOINT_THUMB_DISTAL_EXT, + + ThumbTip = XR_HAND_JOINT_THUMB_TIP_EXT, + + IndexMetacarpal = XR_HAND_JOINT_INDEX_METACARPAL_EXT, + + IndexProximal = XR_HAND_JOINT_INDEX_PROXIMAL_EXT, + + IndexIntermediate = XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT, + + IndexDistal = XR_HAND_JOINT_INDEX_DISTAL_EXT, + + IndexTip = XR_HAND_JOINT_INDEX_TIP_EXT, + + MiddleMetacarpal = XR_HAND_JOINT_MIDDLE_METACARPAL_EXT, + + MiddleProximal = XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT, + + MiddleIntermediate = XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT, + + MiddleDistal = XR_HAND_JOINT_MIDDLE_DISTAL_EXT, + + MiddleTip = XR_HAND_JOINT_MIDDLE_TIP_EXT, + + RingMetacarpal = XR_HAND_JOINT_RING_METACARPAL_EXT, + + RingProximal = XR_HAND_JOINT_RING_PROXIMAL_EXT, + + RingIntermediate = XR_HAND_JOINT_RING_INTERMEDIATE_EXT, + + RingDistal = XR_HAND_JOINT_RING_DISTAL_EXT, + + RingTip = XR_HAND_JOINT_RING_TIP_EXT, + + LittleMetacarpal = XR_HAND_JOINT_LITTLE_METACARPAL_EXT, + + LittleProximal = XR_HAND_JOINT_LITTLE_PROXIMAL_EXT, + + LittleIntermediate = XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT, + + LittleDistal = XR_HAND_JOINT_LITTLE_DISTAL_EXT, + + LittleTip = XR_HAND_JOINT_LITTLE_TIP_EXT, + +}; + +//! @brief Free function for retrieving the raw XrHandJointEXT value from a +//! HandJointEXT +//! @relates HandJointEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrHandJointEXT +get(HandJointEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a HandJointEXT value +//! as a const char * +//! @relates HandJointEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(HandJointEXT value) { + switch (value) { + + case HandJointEXT::Palm: + return "Palm"; + + case HandJointEXT::Wrist: + return "Wrist"; + + case HandJointEXT::ThumbMetacarpal: + return "ThumbMetacarpal"; + + case HandJointEXT::ThumbProximal: + return "ThumbProximal"; + + case HandJointEXT::ThumbDistal: + return "ThumbDistal"; + + case HandJointEXT::ThumbTip: + return "ThumbTip"; + + case HandJointEXT::IndexMetacarpal: + return "IndexMetacarpal"; + + case HandJointEXT::IndexProximal: + return "IndexProximal"; + + case HandJointEXT::IndexIntermediate: + return "IndexIntermediate"; + + case HandJointEXT::IndexDistal: + return "IndexDistal"; + + case HandJointEXT::IndexTip: + return "IndexTip"; + + case HandJointEXT::MiddleMetacarpal: + return "MiddleMetacarpal"; + + case HandJointEXT::MiddleProximal: + return "MiddleProximal"; + + case HandJointEXT::MiddleIntermediate: + return "MiddleIntermediate"; + + case HandJointEXT::MiddleDistal: + return "MiddleDistal"; + + case HandJointEXT::MiddleTip: + return "MiddleTip"; + + case HandJointEXT::RingMetacarpal: + return "RingMetacarpal"; + + case HandJointEXT::RingProximal: + return "RingProximal"; + + case HandJointEXT::RingIntermediate: + return "RingIntermediate"; + + case HandJointEXT::RingDistal: + return "RingDistal"; + + case HandJointEXT::RingTip: + return "RingTip"; + + case HandJointEXT::LittleMetacarpal: + return "LittleMetacarpal"; + + case HandJointEXT::LittleProximal: + return "LittleProximal"; + + case HandJointEXT::LittleIntermediate: + return "LittleIntermediate"; + + case HandJointEXT::LittleDistal: + return "LittleDistal"; + + case HandJointEXT::LittleTip: + return "LittleTip"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a HandJointEXT value +//! as a std::string +//! @relates HandJointEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(HandJointEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrHandJointSetEXT +//! +//! See the related specification text at +//! +enum class HandJointSetEXT : uint32_t { + + Default = XR_HAND_JOINT_SET_DEFAULT_EXT, + +}; + +//! @brief Free function for retrieving the raw XrHandJointSetEXT value from a +//! HandJointSetEXT +//! @relates HandJointSetEXT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrHandJointSetEXT +get(HandJointSetEXT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a HandJointSetEXT +//! value as a const char * +//! @relates HandJointSetEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(HandJointSetEXT value) { + switch (value) { + + case HandJointSetEXT::Default: + return "Default"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a HandJointSetEXT +//! value as a std::string +//! @relates HandJointSetEXT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(HandJointSetEXT value) { + return {to_string_literal(value)}; +} + +//! @brief Enum class associated with XrHandPoseTypeMSFT +//! +//! See the related specification text at +//! +enum class HandPoseTypeMSFT : uint32_t { + + Tracked = XR_HAND_POSE_TYPE_TRACKED_MSFT, + + ReferenceOpenPalm = XR_HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT, + +}; + +//! @brief Free function for retrieving the raw XrHandPoseTypeMSFT value from a +//! HandPoseTypeMSFT +//! @relates HandPoseTypeMSFT +OPENXR_HPP_INLINE OPENXR_HPP_CONSTEXPR XrHandPoseTypeMSFT +get(HandPoseTypeMSFT const &v) { + return static_cast(v); +} + +//! @brief Free function for retrieving the string name of a HandPoseTypeMSFT +//! value as a const char * +//! @relates HandPoseTypeMSFT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR const char * +to_string_literal(HandPoseTypeMSFT value) { + switch (value) { + + case HandPoseTypeMSFT::Tracked: + return "Tracked"; + + case HandPoseTypeMSFT::ReferenceOpenPalm: + return "ReferenceOpenPalm"; + + default: + return "invalid"; + } +} + +//! @brief Free function for retrieving the string name of a HandPoseTypeMSFT +//! value as a std::string +//! @relates HandPoseTypeMSFT +OPENXR_HPP_INLINE OPENXR_HPP_SWITCH_CONSTEXPR std::string +to_string(HandPoseTypeMSFT value) { + return {to_string_literal(value)}; +} + +//! @} + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +/*! + * @defgroup enums Flags + * @brief C++ flags classes corresponding to OpenXR C flags and flagbits, plus + * associated utility functions. + * @{ + */ + +//! @brief Flags class associated with XrInstanceCreateFlags +//! +//! See the related specification text at +//! +enum class InstanceCreateFlagBits : XrFlags64 { None = 0, AllBits = 0 }; + +using InstanceCreateFlags = + Flags; + +OPENXR_HPP_INLINE InstanceCreateFlags operator|(InstanceCreateFlagBits bit0, + InstanceCreateFlagBits bit1) { + return InstanceCreateFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE InstanceCreateFlags operator~(InstanceCreateFlagBits bits) { + return ~(InstanceCreateFlags(bits)); +} + +//! @brief Flags class associated with XrSessionCreateFlags +//! +//! See the related specification text at +//! +enum class SessionCreateFlagBits : XrFlags64 { None = 0, AllBits = 0 }; + +using SessionCreateFlags = Flags; + +OPENXR_HPP_INLINE SessionCreateFlags operator|(SessionCreateFlagBits bit0, + SessionCreateFlagBits bit1) { + return SessionCreateFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE SessionCreateFlags operator~(SessionCreateFlagBits bits) { + return ~(SessionCreateFlags(bits)); +} + +//! @brief Flags class associated with XrSpaceVelocityFlags +//! +//! See the related specification text at +//! +enum class SpaceVelocityFlagBits : XrFlags64 { + None = 0, + LinearValid = XR_SPACE_VELOCITY_LINEAR_VALID_BIT, + AngularValid = XR_SPACE_VELOCITY_ANGULAR_VALID_BIT, + AllBits = 0 | XR_SPACE_VELOCITY_LINEAR_VALID_BIT | + XR_SPACE_VELOCITY_ANGULAR_VALID_BIT +}; + +using SpaceVelocityFlags = Flags; + +OPENXR_HPP_INLINE SpaceVelocityFlags operator|(SpaceVelocityFlagBits bit0, + SpaceVelocityFlagBits bit1) { + return SpaceVelocityFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE SpaceVelocityFlags operator~(SpaceVelocityFlagBits bits) { + return ~(SpaceVelocityFlags(bits)); +} + +//! @brief Flags class associated with XrSpaceLocationFlags +//! +//! See the related specification text at +//! +enum class SpaceLocationFlagBits : XrFlags64 { + None = 0, + OrientationValid = XR_SPACE_LOCATION_ORIENTATION_VALID_BIT, + PositionValid = XR_SPACE_LOCATION_POSITION_VALID_BIT, + OrientationTracked = XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT, + PositionTracked = XR_SPACE_LOCATION_POSITION_TRACKED_BIT, + AllBits = 0 | XR_SPACE_LOCATION_ORIENTATION_VALID_BIT | + XR_SPACE_LOCATION_POSITION_VALID_BIT | + XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT | + XR_SPACE_LOCATION_POSITION_TRACKED_BIT +}; + +using SpaceLocationFlags = Flags; + +OPENXR_HPP_INLINE SpaceLocationFlags operator|(SpaceLocationFlagBits bit0, + SpaceLocationFlagBits bit1) { + return SpaceLocationFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE SpaceLocationFlags operator~(SpaceLocationFlagBits bits) { + return ~(SpaceLocationFlags(bits)); +} + +//! @brief Flags class associated with XrSwapchainCreateFlags +//! +//! See the related specification text at +//! +enum class SwapchainCreateFlagBits : XrFlags64 { + None = 0, + ProtectedContent = XR_SWAPCHAIN_CREATE_PROTECTED_CONTENT_BIT, + StaticImage = XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT, + AllBits = 0 | XR_SWAPCHAIN_CREATE_PROTECTED_CONTENT_BIT | + XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT +}; + +using SwapchainCreateFlags = + Flags; + +OPENXR_HPP_INLINE SwapchainCreateFlags operator|(SwapchainCreateFlagBits bit0, + SwapchainCreateFlagBits bit1) { + return SwapchainCreateFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE SwapchainCreateFlags operator~(SwapchainCreateFlagBits bits) { + return ~(SwapchainCreateFlags(bits)); +} + +//! @brief Flags class associated with XrSwapchainUsageFlags +//! +//! See the related specification text at +//! +enum class SwapchainUsageFlagBits : XrFlags64 { + None = 0, + ColorAttachment = XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT, + DepthStencilAttachment = XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, + UnorderedAccess = XR_SWAPCHAIN_USAGE_UNORDERED_ACCESS_BIT, + TransferSrc = XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT, + TransferDst = XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT, + Sampled = XR_SWAPCHAIN_USAGE_SAMPLED_BIT, + MutableFormat = XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT, + AllBits = 0 | XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT | + XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | + XR_SWAPCHAIN_USAGE_UNORDERED_ACCESS_BIT | + XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT | + XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT | + XR_SWAPCHAIN_USAGE_SAMPLED_BIT | + XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT +}; + +using SwapchainUsageFlags = + Flags; + +OPENXR_HPP_INLINE SwapchainUsageFlags operator|(SwapchainUsageFlagBits bit0, + SwapchainUsageFlagBits bit1) { + return SwapchainUsageFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE SwapchainUsageFlags operator~(SwapchainUsageFlagBits bits) { + return ~(SwapchainUsageFlags(bits)); +} + +//! @brief Flags class associated with XrCompositionLayerFlags +//! +//! See the related specification text at +//! +enum class CompositionLayerFlagBits : XrFlags64 { + None = 0, + CorrectChromaticAberration = + XR_COMPOSITION_LAYER_CORRECT_CHROMATIC_ABERRATION_BIT, + BlendTextureSourceAlpha = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT, + UnpremultipliedAlpha = XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT, + AllBits = 0 | XR_COMPOSITION_LAYER_CORRECT_CHROMATIC_ABERRATION_BIT | + XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT | + XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT +}; + +using CompositionLayerFlags = + Flags; + +OPENXR_HPP_INLINE CompositionLayerFlags +operator|(CompositionLayerFlagBits bit0, CompositionLayerFlagBits bit1) { + return CompositionLayerFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE CompositionLayerFlags +operator~(CompositionLayerFlagBits bits) { + return ~(CompositionLayerFlags(bits)); +} + +//! @brief Flags class associated with XrViewStateFlags +//! +//! See the related specification text at +//! +enum class ViewStateFlagBits : XrFlags64 { + None = 0, + OrientationValid = XR_VIEW_STATE_ORIENTATION_VALID_BIT, + PositionValid = XR_VIEW_STATE_POSITION_VALID_BIT, + OrientationTracked = XR_VIEW_STATE_ORIENTATION_TRACKED_BIT, + PositionTracked = XR_VIEW_STATE_POSITION_TRACKED_BIT, + AllBits = 0 | XR_VIEW_STATE_ORIENTATION_VALID_BIT | + XR_VIEW_STATE_POSITION_VALID_BIT | + XR_VIEW_STATE_ORIENTATION_TRACKED_BIT | + XR_VIEW_STATE_POSITION_TRACKED_BIT +}; + +using ViewStateFlags = Flags; + +OPENXR_HPP_INLINE ViewStateFlags operator|(ViewStateFlagBits bit0, + ViewStateFlagBits bit1) { + return ViewStateFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE ViewStateFlags operator~(ViewStateFlagBits bits) { + return ~(ViewStateFlags(bits)); +} + +//! @brief Flags class associated with XrInputSourceLocalizedNameFlags +//! +//! See the related specification text at +//! +enum class InputSourceLocalizedNameFlagBits : XrFlags64 { + None = 0, + UserPath = XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT, + InteractionProfile = XR_INPUT_SOURCE_LOCALIZED_NAME_INTERACTION_PROFILE_BIT, + Component = XR_INPUT_SOURCE_LOCALIZED_NAME_COMPONENT_BIT, + AllBits = 0 | XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT | + XR_INPUT_SOURCE_LOCALIZED_NAME_INTERACTION_PROFILE_BIT | + XR_INPUT_SOURCE_LOCALIZED_NAME_COMPONENT_BIT +}; + +using InputSourceLocalizedNameFlags = + Flags; + +OPENXR_HPP_INLINE InputSourceLocalizedNameFlags +operator|(InputSourceLocalizedNameFlagBits bit0, + InputSourceLocalizedNameFlagBits bit1) { + return InputSourceLocalizedNameFlags(bit0) | bit1; +} + +OPENXR_HPP_INLINE InputSourceLocalizedNameFlags +operator~(InputSourceLocalizedNameFlagBits bits) { + return ~(InputSourceLocalizedNameFlags(bits)); +} + +//! @brief Flags class associated with XrDebugUtilsMessageSeverityFlagsEXT +//! +//! See the related specification text at +//! +enum class DebugUtilsMessageSeverityFlagBitsEXT : XrFlags64 { + None = 0, + Verbose = XR_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT, + Info = XR_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT, + Warning = XR_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT, + Error = XR_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT, + AllBits = 0 | XR_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | + XR_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | + XR_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | + XR_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT +}; + +using DebugUtilsMessageSeverityFlagsEXT = + Flags; + +OPENXR_HPP_INLINE DebugUtilsMessageSeverityFlagsEXT +operator|(DebugUtilsMessageSeverityFlagBitsEXT bit0, + DebugUtilsMessageSeverityFlagBitsEXT bit1) { + return DebugUtilsMessageSeverityFlagsEXT(bit0) | bit1; +} + +OPENXR_HPP_INLINE DebugUtilsMessageSeverityFlagsEXT +operator~(DebugUtilsMessageSeverityFlagBitsEXT bits) { + return ~(DebugUtilsMessageSeverityFlagsEXT(bits)); +} + +//! @brief Flags class associated with XrDebugUtilsMessageTypeFlagsEXT +//! +//! See the related specification text at +//! +enum class DebugUtilsMessageTypeFlagBitsEXT : XrFlags64 { + None = 0, + General = XR_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT, + Validation = XR_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT, + Performance = XR_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, + Conformance = XR_DEBUG_UTILS_MESSAGE_TYPE_CONFORMANCE_BIT_EXT, + AllBits = 0 | XR_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | + XR_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | + XR_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT | + XR_DEBUG_UTILS_MESSAGE_TYPE_CONFORMANCE_BIT_EXT +}; + +using DebugUtilsMessageTypeFlagsEXT = + Flags; + +OPENXR_HPP_INLINE DebugUtilsMessageTypeFlagsEXT +operator|(DebugUtilsMessageTypeFlagBitsEXT bit0, + DebugUtilsMessageTypeFlagBitsEXT bit1) { + return DebugUtilsMessageTypeFlagsEXT(bit0) | bit1; +} + +OPENXR_HPP_INLINE DebugUtilsMessageTypeFlagsEXT +operator~(DebugUtilsMessageTypeFlagBitsEXT bits) { + return ~(DebugUtilsMessageTypeFlagsEXT(bits)); +} + +//! @brief Flags class associated with XrOverlaySessionCreateFlagsEXTX +//! +//! See the related specification text at +//! +enum class OverlaySessionCreateFlagBitsEXTX : XrFlags64 { + None = 0, + RelaxedDisplayTime = XR_OVERLAY_SESSION_CREATE_RELAXED_DISPLAY_TIME_BIT_EXTX, + AllBits = 0 | XR_OVERLAY_SESSION_CREATE_RELAXED_DISPLAY_TIME_BIT_EXTX +}; + +using OverlaySessionCreateFlagsEXTX = + Flags; + +OPENXR_HPP_INLINE OverlaySessionCreateFlagsEXTX +operator|(OverlaySessionCreateFlagBitsEXTX bit0, + OverlaySessionCreateFlagBitsEXTX bit1) { + return OverlaySessionCreateFlagsEXTX(bit0) | bit1; +} + +OPENXR_HPP_INLINE OverlaySessionCreateFlagsEXTX +operator~(OverlaySessionCreateFlagBitsEXTX bits) { + return ~(OverlaySessionCreateFlagsEXTX(bits)); +} + +//! @brief Flags class associated with XrOverlayMainSessionFlagsEXTX +//! +//! See the related specification text at +//! +enum class OverlayMainSessionFlagBitsEXTX : XrFlags64 { + None = 0, + EnabledCompositionLayerInfoDepth = + XR_OVERLAY_MAIN_SESSION_ENABLED_COMPOSITION_LAYER_INFO_DEPTH_BIT_EXTX, + AllBits = + 0 | XR_OVERLAY_MAIN_SESSION_ENABLED_COMPOSITION_LAYER_INFO_DEPTH_BIT_EXTX +}; + +using OverlayMainSessionFlagsEXTX = + Flags; + +OPENXR_HPP_INLINE OverlayMainSessionFlagsEXTX operator|( + OverlayMainSessionFlagBitsEXTX bit0, OverlayMainSessionFlagBitsEXTX bit1) { + return OverlayMainSessionFlagsEXTX(bit0) | bit1; +} + +OPENXR_HPP_INLINE OverlayMainSessionFlagsEXTX +operator~(OverlayMainSessionFlagBitsEXTX bits) { + return ~(OverlayMainSessionFlagsEXTX(bits)); +} + +//! @} + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +/*! + * @defgroup result_helpers Result helper free functions + * @{ + */ +//! @brief Return true if the Result is negative, indicating a failure. +//! Equivalent of XR_FAILED() +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool failed(Result v) { + return static_cast(v) < 0; +} + +//! @brief Return true if the result is non-negative, indicating a success or +//! non-error result. Equivalent of XR_SUCCEEDED() +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool succeeded(Result v) { + return static_cast(v) >= 0; +} + +//! @brief Return true if the result is exactly equal to Result::Success. +//! Equivalent of XR_UNQUALIFIED_SUCCESS() +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool unqualifiedSuccess(Result v) { + return v == Result::Success; +} +//! @} + +//! @brief `<` comparison between Result and integer, for compatibility with the +//! XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(Result lhs, int rhs) { + return get(lhs) < rhs; +} + +//! @brief `<` comparison between integer and Result, for compatibility with the +//! XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<(int lhs, Result rhs) { + return lhs < get(rhs); +} + +//! @brief `>` comparison between Result and integer, for compatibility with the +//! XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(Result lhs, int rhs) { + return get(lhs) > rhs; +} + +//! @brief `>` comparison between integer and Result, for compatibility with the +//! XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>(int lhs, Result rhs) { + return lhs > get(rhs); +} + +//! @brief `<=` comparison between Result and integer, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(Result lhs, int rhs) { + return get(lhs) <= rhs; +} + +//! @brief `<=` comparison between integer and Result, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator<=(int lhs, Result rhs) { + return lhs <= get(rhs); +} + +//! @brief `>=` comparison between Result and integer, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(Result lhs, int rhs) { + return get(lhs) >= rhs; +} + +//! @brief `>=` comparison between integer and Result, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator>=(int lhs, Result rhs) { + return lhs >= get(rhs); +} + +//! @brief `==` comparison between Result and integer, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(Result lhs, int rhs) { + return get(lhs) == rhs; +} + +//! @brief `==` comparison between integer and Result, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator==(int lhs, Result rhs) { + return lhs == get(rhs); +} + +//! @brief `!=` comparison between Result and integer, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(Result lhs, int rhs) { + return get(lhs) != rhs; +} + +//! @brief `!=` comparison between integer and Result, for compatibility with +//! the XR_ function-type macros and XrResult. +//! @relates Result +OPENXR_HPP_CONSTEXPR OPENXR_HPP_INLINE bool operator!=(int lhs, Result rhs) { + return lhs != get(rhs); +} + +} // namespace OPENXR_HPP_NAMESPACE + +#if !defined(OPENXR_HPP_NO_EXCEPTIONS) + +namespace OPENXR_HPP_NAMESPACE { + +//! Implementation details +namespace impl { +#if defined(_MSC_VER) && (_MSC_VER == 1800) +#define noexcept _NOEXCEPT +#endif + +class ErrorCategoryImpl : public std::error_category { +public: + virtual const char *name() const noexcept override { + return OPENXR_HPP_NAMESPACE_STRING "::Result"; + } + virtual std::string message(int ev) const override { + return to_string(static_cast(ev)); + } +}; + +#if defined(_MSC_VER) && (_MSC_VER == 1800) +#undef noexcept +#endif + +OPENXR_HPP_INLINE const std::error_category &errorCategory() { + static impl::ErrorCategoryImpl instance; + return instance; +} + +OPENXR_HPP_INLINE std::error_code make_error_code(Result e) { + return std::error_code(static_cast(e), errorCategory()); +} + +OPENXR_HPP_INLINE std::error_condition make_error_condition(Result e) { + return std::error_condition(static_cast(e), errorCategory()); +} + +#if defined(_MSC_VER) && (_MSC_VER == 1800) +#define noexcept _NOEXCEPT +#endif +} // namespace impl + +//! OpenXR exceptions +namespace exceptions { +/*! + * @defgroup exceptions Exceptions + * + * @{ + */ +/*! + * @defgroup base_exceptions Exception base classes + * @{ + */ +//! @brief Base class for all OpenXR exceptions. +//! +//! Only used for catching all OpenXR exceptions. +class Error { +public: + virtual ~Error() = default; + + virtual const char *what() const noexcept = 0; +}; + +//! @brief OpenXR logic error base exception class. +//! +//! Derives from both Error and std::logic_error for flexibility in catching. +class LogicError : public Error, public std::logic_error { +public: + explicit LogicError(const std::string &what) + : Error(), std::logic_error(what) {} + explicit LogicError(char const *what) : Error(), std::logic_error(what) {} + virtual ~LogicError() = default; + + virtual const char *what() const noexcept { return std::logic_error::what(); } +}; + +//! @brief OpenXR system error exception class - may be derived from or thrown +//! directly. +//! +//! Derives from both Error and std::system_error for flexibility in catching. +class SystemError : public Error, public std::system_error { +public: + SystemError(std::error_code ec) : Error(), std::system_error(ec) {} + SystemError(std::error_code ec, std::string const &what) + : Error(), std::system_error(ec, what) {} + SystemError(std::error_code ec, char const *what) + : Error(), std::system_error(ec, what) {} + SystemError(int ev, std::error_category const &ecat) + : Error(), std::system_error(ev, ecat) {} + SystemError(int ev, std::error_category const &ecat, std::string const &what) + : Error(), std::system_error(ev, ecat, what) {} + SystemError(int ev, std::error_category const &ecat, char const *what) + : Error(), std::system_error(ev, ecat, what) {} + virtual ~SystemError() = default; + + virtual const char *what() const noexcept { + return std::system_error::what(); + } +}; + +// end of base_exceptions +//! @} +#if defined(_MSC_VER) && (_MSC_VER == 1800) +#undef noexcept +#endif + +/*! + * @defgroup result_exceptions Result-specific exceptions + * @{ + */ +//! @todo identify which errors would be considered LogicError and subclass that +//! instead. Add to XML? + +//! @brief Exception class associated with the Result::ErrorValidationFailure +//! aka XR_ERROR_VALIDATION_FAILURE result code. +class ValidationFailureError : public SystemError { +public: + ValidationFailureError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorValidationFailure), + message) {} + + ValidationFailureError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorValidationFailure), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorRuntimeFailure aka +//! XR_ERROR_RUNTIME_FAILURE result code. +class RuntimeFailureError : public SystemError { +public: + RuntimeFailureError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorRuntimeFailure), + message) {} + + RuntimeFailureError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorRuntimeFailure), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorOutOfMemory aka +//! XR_ERROR_OUT_OF_MEMORY result code. +class OutOfMemoryError : public SystemError { +public: + OutOfMemoryError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorOutOfMemory), message) {} + + OutOfMemoryError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorOutOfMemory), message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorApiVersionUnsupported aka XR_ERROR_API_VERSION_UNSUPPORTED +//! result code. +class ApiVersionUnsupportedError : public SystemError { +public: + ApiVersionUnsupportedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorApiVersionUnsupported), + message) {} + + ApiVersionUnsupportedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorApiVersionUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorInitializationFailed +//! aka XR_ERROR_INITIALIZATION_FAILED result code. +class InitializationFailedError : public SystemError { +public: + InitializationFailedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorInitializationFailed), + message) {} + + InitializationFailedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorInitializationFailed), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorFunctionUnsupported +//! aka XR_ERROR_FUNCTION_UNSUPPORTED result code. +class FunctionUnsupportedError : public SystemError { +public: + FunctionUnsupportedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorFunctionUnsupported), + message) {} + + FunctionUnsupportedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorFunctionUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorFeatureUnsupported +//! aka XR_ERROR_FEATURE_UNSUPPORTED result code. +class FeatureUnsupportedError : public SystemError { +public: + FeatureUnsupportedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorFeatureUnsupported), + message) {} + + FeatureUnsupportedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorFeatureUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorExtensionNotPresent +//! aka XR_ERROR_EXTENSION_NOT_PRESENT result code. +class ExtensionNotPresentError : public SystemError { +public: + ExtensionNotPresentError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorExtensionNotPresent), + message) {} + + ExtensionNotPresentError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorExtensionNotPresent), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorLimitReached aka +//! XR_ERROR_LIMIT_REACHED result code. +class LimitReachedError : public SystemError { +public: + LimitReachedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorLimitReached), message) { + } + + LimitReachedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorLimitReached), message) { + } +}; + +//! @brief Exception class associated with the Result::ErrorSizeInsufficient aka +//! XR_ERROR_SIZE_INSUFFICIENT result code. +class SizeInsufficientError : public SystemError { +public: + SizeInsufficientError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSizeInsufficient), + message) {} + + SizeInsufficientError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSizeInsufficient), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorHandleInvalid aka +//! XR_ERROR_HANDLE_INVALID result code. +class HandleInvalidError : public SystemError { +public: + HandleInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorHandleInvalid), + message) {} + + HandleInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorHandleInvalid), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorInstanceLost aka +//! XR_ERROR_INSTANCE_LOST result code. +class InstanceLostError : public SystemError { +public: + InstanceLostError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorInstanceLost), message) { + } + + InstanceLostError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorInstanceLost), message) { + } +}; + +//! @brief Exception class associated with the Result::ErrorSessionRunning aka +//! XR_ERROR_SESSION_RUNNING result code. +class SessionRunningError : public SystemError { +public: + SessionRunningError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSessionRunning), + message) {} + + SessionRunningError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSessionRunning), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorSessionNotRunning +//! aka XR_ERROR_SESSION_NOT_RUNNING result code. +class SessionNotRunningError : public SystemError { +public: + SessionNotRunningError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSessionNotRunning), + message) {} + + SessionNotRunningError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSessionNotRunning), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorSessionLost aka +//! XR_ERROR_SESSION_LOST result code. +class SessionLostError : public SystemError { +public: + SessionLostError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSessionLost), message) {} + + SessionLostError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSessionLost), message) {} +}; + +//! @brief Exception class associated with the Result::ErrorSystemInvalid aka +//! XR_ERROR_SYSTEM_INVALID result code. +class SystemInvalidError : public SystemError { +public: + SystemInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSystemInvalid), + message) {} + + SystemInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSystemInvalid), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorPathInvalid aka +//! XR_ERROR_PATH_INVALID result code. +class PathInvalidError : public SystemError { +public: + PathInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorPathInvalid), message) {} + + PathInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorPathInvalid), message) {} +}; + +//! @brief Exception class associated with the Result::ErrorPathCountExceeded +//! aka XR_ERROR_PATH_COUNT_EXCEEDED result code. +class PathCountExceededError : public SystemError { +public: + PathCountExceededError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorPathCountExceeded), + message) {} + + PathCountExceededError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorPathCountExceeded), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorPathFormatInvalid +//! aka XR_ERROR_PATH_FORMAT_INVALID result code. +class PathFormatInvalidError : public SystemError { +public: + PathFormatInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorPathFormatInvalid), + message) {} + + PathFormatInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorPathFormatInvalid), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorPathUnsupported aka +//! XR_ERROR_PATH_UNSUPPORTED result code. +class PathUnsupportedError : public SystemError { +public: + PathUnsupportedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorPathUnsupported), + message) {} + + PathUnsupportedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorPathUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorLayerInvalid aka +//! XR_ERROR_LAYER_INVALID result code. +class LayerInvalidError : public SystemError { +public: + LayerInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorLayerInvalid), message) { + } + + LayerInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorLayerInvalid), message) { + } +}; + +//! @brief Exception class associated with the Result::ErrorLayerLimitExceeded +//! aka XR_ERROR_LAYER_LIMIT_EXCEEDED result code. +class LayerLimitExceededError : public SystemError { +public: + LayerLimitExceededError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorLayerLimitExceeded), + message) {} + + LayerLimitExceededError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorLayerLimitExceeded), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorSwapchainRectInvalid +//! aka XR_ERROR_SWAPCHAIN_RECT_INVALID result code. +class SwapchainRectInvalidError : public SystemError { +public: + SwapchainRectInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSwapchainRectInvalid), + message) {} + + SwapchainRectInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSwapchainRectInvalid), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorSwapchainFormatUnsupported aka +//! XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED result code. +class SwapchainFormatUnsupportedError : public SystemError { +public: + SwapchainFormatUnsupportedError(std::string const &message) + : SystemError( + impl::make_error_code(Result::ErrorSwapchainFormatUnsupported), + message) {} + + SwapchainFormatUnsupportedError(char const *message) + : SystemError( + impl::make_error_code(Result::ErrorSwapchainFormatUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorActionTypeMismatch +//! aka XR_ERROR_ACTION_TYPE_MISMATCH result code. +class ActionTypeMismatchError : public SystemError { +public: + ActionTypeMismatchError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorActionTypeMismatch), + message) {} + + ActionTypeMismatchError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorActionTypeMismatch), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorSessionNotReady aka +//! XR_ERROR_SESSION_NOT_READY result code. +class SessionNotReadyError : public SystemError { +public: + SessionNotReadyError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSessionNotReady), + message) {} + + SessionNotReadyError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSessionNotReady), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorSessionNotStopping +//! aka XR_ERROR_SESSION_NOT_STOPPING result code. +class SessionNotStoppingError : public SystemError { +public: + SessionNotStoppingError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorSessionNotStopping), + message) {} + + SessionNotStoppingError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorSessionNotStopping), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorTimeInvalid aka +//! XR_ERROR_TIME_INVALID result code. +class TimeInvalidError : public SystemError { +public: + TimeInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorTimeInvalid), message) {} + + TimeInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorTimeInvalid), message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorReferenceSpaceUnsupported aka +//! XR_ERROR_REFERENCE_SPACE_UNSUPPORTED result code. +class ReferenceSpaceUnsupportedError : public SystemError { +public: + ReferenceSpaceUnsupportedError(std::string const &message) + : SystemError( + impl::make_error_code(Result::ErrorReferenceSpaceUnsupported), + message) {} + + ReferenceSpaceUnsupportedError(char const *message) + : SystemError( + impl::make_error_code(Result::ErrorReferenceSpaceUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorFileAccessError aka +//! XR_ERROR_FILE_ACCESS_ERROR result code. +class FileAccessError : public SystemError { +public: + FileAccessError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorFileAccessError), + message) {} + + FileAccessError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorFileAccessError), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorFileContentsInvalid +//! aka XR_ERROR_FILE_CONTENTS_INVALID result code. +class FileContentsInvalidError : public SystemError { +public: + FileContentsInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorFileContentsInvalid), + message) {} + + FileContentsInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorFileContentsInvalid), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorFormFactorUnsupported aka XR_ERROR_FORM_FACTOR_UNSUPPORTED +//! result code. +class FormFactorUnsupportedError : public SystemError { +public: + FormFactorUnsupportedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorFormFactorUnsupported), + message) {} + + FormFactorUnsupportedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorFormFactorUnsupported), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorFormFactorUnavailable aka XR_ERROR_FORM_FACTOR_UNAVAILABLE +//! result code. +class FormFactorUnavailableError : public SystemError { +public: + FormFactorUnavailableError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorFormFactorUnavailable), + message) {} + + FormFactorUnavailableError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorFormFactorUnavailable), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorApiLayerNotPresent +//! aka XR_ERROR_API_LAYER_NOT_PRESENT result code. +class ApiLayerNotPresentError : public SystemError { +public: + ApiLayerNotPresentError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorApiLayerNotPresent), + message) {} + + ApiLayerNotPresentError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorApiLayerNotPresent), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorCallOrderInvalid aka +//! XR_ERROR_CALL_ORDER_INVALID result code. +class CallOrderInvalidError : public SystemError { +public: + CallOrderInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorCallOrderInvalid), + message) {} + + CallOrderInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorCallOrderInvalid), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorGraphicsDeviceInvalid aka XR_ERROR_GRAPHICS_DEVICE_INVALID +//! result code. +class GraphicsDeviceInvalidError : public SystemError { +public: + GraphicsDeviceInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorGraphicsDeviceInvalid), + message) {} + + GraphicsDeviceInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorGraphicsDeviceInvalid), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorPoseInvalid aka +//! XR_ERROR_POSE_INVALID result code. +class PoseInvalidError : public SystemError { +public: + PoseInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorPoseInvalid), message) {} + + PoseInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorPoseInvalid), message) {} +}; + +//! @brief Exception class associated with the Result::ErrorIndexOutOfRange aka +//! XR_ERROR_INDEX_OUT_OF_RANGE result code. +class IndexOutOfRangeError : public SystemError { +public: + IndexOutOfRangeError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorIndexOutOfRange), + message) {} + + IndexOutOfRangeError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorIndexOutOfRange), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorViewConfigurationTypeUnsupported aka +//! XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED result code. +class ViewConfigurationTypeUnsupportedError : public SystemError { +public: + ViewConfigurationTypeUnsupportedError(std::string const &message) + : SystemError(impl::make_error_code( + Result::ErrorViewConfigurationTypeUnsupported), + message) {} + + ViewConfigurationTypeUnsupportedError(char const *message) + : SystemError(impl::make_error_code( + Result::ErrorViewConfigurationTypeUnsupported), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorEnvironmentBlendModeUnsupported aka +//! XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED result code. +class EnvironmentBlendModeUnsupportedError : public SystemError { +public: + EnvironmentBlendModeUnsupportedError(std::string const &message) + : SystemError( + impl::make_error_code(Result::ErrorEnvironmentBlendModeUnsupported), + message) {} + + EnvironmentBlendModeUnsupportedError(char const *message) + : SystemError( + impl::make_error_code(Result::ErrorEnvironmentBlendModeUnsupported), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorNameDuplicated aka +//! XR_ERROR_NAME_DUPLICATED result code. +class NameDuplicatedError : public SystemError { +public: + NameDuplicatedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorNameDuplicated), + message) {} + + NameDuplicatedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorNameDuplicated), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorNameInvalid aka +//! XR_ERROR_NAME_INVALID result code. +class NameInvalidError : public SystemError { +public: + NameInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorNameInvalid), message) {} + + NameInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorNameInvalid), message) {} +}; + +//! @brief Exception class associated with the Result::ErrorActionsetNotAttached +//! aka XR_ERROR_ACTIONSET_NOT_ATTACHED result code. +class ActionsetNotAttachedError : public SystemError { +public: + ActionsetNotAttachedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorActionsetNotAttached), + message) {} + + ActionsetNotAttachedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorActionsetNotAttached), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorActionsetsAlreadyAttached aka +//! XR_ERROR_ACTIONSETS_ALREADY_ATTACHED result code. +class ActionsetsAlreadyAttachedError : public SystemError { +public: + ActionsetsAlreadyAttachedError(std::string const &message) + : SystemError( + impl::make_error_code(Result::ErrorActionsetsAlreadyAttached), + message) {} + + ActionsetsAlreadyAttachedError(char const *message) + : SystemError( + impl::make_error_code(Result::ErrorActionsetsAlreadyAttached), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorLocalizedNameDuplicated aka XR_ERROR_LOCALIZED_NAME_DUPLICATED +//! result code. +class LocalizedNameDuplicatedError : public SystemError { +public: + LocalizedNameDuplicatedError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorLocalizedNameDuplicated), + message) {} + + LocalizedNameDuplicatedError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorLocalizedNameDuplicated), + message) {} +}; + +//! @brief Exception class associated with the Result::ErrorLocalizedNameInvalid +//! aka XR_ERROR_LOCALIZED_NAME_INVALID result code. +class LocalizedNameInvalidError : public SystemError { +public: + LocalizedNameInvalidError(std::string const &message) + : SystemError(impl::make_error_code(Result::ErrorLocalizedNameInvalid), + message) {} + + LocalizedNameInvalidError(char const *message) + : SystemError(impl::make_error_code(Result::ErrorLocalizedNameInvalid), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorAndroidThreadSettingsIdInvalidKHR aka +//! XR_ERROR_ANDROID_THREAD_SETTINGS_ID_INVALID_KHR result code. +class AndroidThreadSettingsIdInvalidKHRError : public SystemError { +public: + AndroidThreadSettingsIdInvalidKHRError(std::string const &message) + : SystemError(impl::make_error_code( + Result::ErrorAndroidThreadSettingsIdInvalidKHR), + message) {} + + AndroidThreadSettingsIdInvalidKHRError(char const *message) + : SystemError(impl::make_error_code( + Result::ErrorAndroidThreadSettingsIdInvalidKHR), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorAndroidThreadSettingsFailureKHR aka +//! XR_ERROR_ANDROID_THREAD_SETTINGS_FAILURE_KHR result code. +class AndroidThreadSettingsFailureKHRError : public SystemError { +public: + AndroidThreadSettingsFailureKHRError(std::string const &message) + : SystemError( + impl::make_error_code(Result::ErrorAndroidThreadSettingsFailureKHR), + message) {} + + AndroidThreadSettingsFailureKHRError(char const *message) + : SystemError( + impl::make_error_code(Result::ErrorAndroidThreadSettingsFailureKHR), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorCreateSpatialAnchorFailedMSFT aka +//! XR_ERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFT result code. +class CreateSpatialAnchorFailedMSFTError : public SystemError { +public: + CreateSpatialAnchorFailedMSFTError(std::string const &message) + : SystemError( + impl::make_error_code(Result::ErrorCreateSpatialAnchorFailedMSFT), + message) {} + + CreateSpatialAnchorFailedMSFTError(char const *message) + : SystemError( + impl::make_error_code(Result::ErrorCreateSpatialAnchorFailedMSFT), + message) {} +}; + +//! @brief Exception class associated with the +//! Result::ErrorSecondaryViewConfigurationTypeNotEnabledMSFT aka +//! XR_ERROR_SECONDARY_VIEW_CONFIGURATION_TYPE_NOT_ENABLED_MSFT result code. +class SecondaryViewConfigurationTypeNotEnabledMSFTError : public SystemError { +public: + SecondaryViewConfigurationTypeNotEnabledMSFTError(std::string const &message) + : SystemError( + impl::make_error_code( + Result::ErrorSecondaryViewConfigurationTypeNotEnabledMSFT), + message) {} + + SecondaryViewConfigurationTypeNotEnabledMSFTError(char const *message) + : SystemError( + impl::make_error_code( + Result::ErrorSecondaryViewConfigurationTypeNotEnabledMSFT), + message) {} +}; + +// end of result_exceptions +//! @} + +/*! + * @brief Throws the best exception for a result code. + * + * Takes a result code and a message (usually the method triggering the + * exception) and throws the most-specific exception available for that result + * code. As a fallback, it will throw a SystemError directly. + */ +OPENXR_HPP_INLINE void throwResultException(Result result, + char const *message) { + switch (result) { + + case Result::Success: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::TimeoutExpired: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::SessionLossPending: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::EventUnavailable: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::SpaceBoundsUnavailable: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::SessionNotFocused: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::FrameDiscarded: + // Not actually an error! + throw SystemError(impl::make_error_code(result)); + + case Result::ErrorValidationFailure: + throw ValidationFailureError(message); + + case Result::ErrorRuntimeFailure: + throw RuntimeFailureError(message); + + case Result::ErrorOutOfMemory: + throw OutOfMemoryError(message); + + case Result::ErrorApiVersionUnsupported: + throw ApiVersionUnsupportedError(message); + + case Result::ErrorInitializationFailed: + throw InitializationFailedError(message); + + case Result::ErrorFunctionUnsupported: + throw FunctionUnsupportedError(message); + + case Result::ErrorFeatureUnsupported: + throw FeatureUnsupportedError(message); + + case Result::ErrorExtensionNotPresent: + throw ExtensionNotPresentError(message); + + case Result::ErrorLimitReached: + throw LimitReachedError(message); + + case Result::ErrorSizeInsufficient: + throw SizeInsufficientError(message); + + case Result::ErrorHandleInvalid: + throw HandleInvalidError(message); + + case Result::ErrorInstanceLost: + throw InstanceLostError(message); + + case Result::ErrorSessionRunning: + throw SessionRunningError(message); + + case Result::ErrorSessionNotRunning: + throw SessionNotRunningError(message); + + case Result::ErrorSessionLost: + throw SessionLostError(message); + + case Result::ErrorSystemInvalid: + throw SystemInvalidError(message); + + case Result::ErrorPathInvalid: + throw PathInvalidError(message); + + case Result::ErrorPathCountExceeded: + throw PathCountExceededError(message); + + case Result::ErrorPathFormatInvalid: + throw PathFormatInvalidError(message); + + case Result::ErrorPathUnsupported: + throw PathUnsupportedError(message); + + case Result::ErrorLayerInvalid: + throw LayerInvalidError(message); + + case Result::ErrorLayerLimitExceeded: + throw LayerLimitExceededError(message); + + case Result::ErrorSwapchainRectInvalid: + throw SwapchainRectInvalidError(message); + + case Result::ErrorSwapchainFormatUnsupported: + throw SwapchainFormatUnsupportedError(message); + + case Result::ErrorActionTypeMismatch: + throw ActionTypeMismatchError(message); + + case Result::ErrorSessionNotReady: + throw SessionNotReadyError(message); + + case Result::ErrorSessionNotStopping: + throw SessionNotStoppingError(message); + + case Result::ErrorTimeInvalid: + throw TimeInvalidError(message); + + case Result::ErrorReferenceSpaceUnsupported: + throw ReferenceSpaceUnsupportedError(message); + + case Result::ErrorFileAccessError: + throw FileAccessError(message); + + case Result::ErrorFileContentsInvalid: + throw FileContentsInvalidError(message); + + case Result::ErrorFormFactorUnsupported: + throw FormFactorUnsupportedError(message); + + case Result::ErrorFormFactorUnavailable: + throw FormFactorUnavailableError(message); + + case Result::ErrorApiLayerNotPresent: + throw ApiLayerNotPresentError(message); + + case Result::ErrorCallOrderInvalid: + throw CallOrderInvalidError(message); + + case Result::ErrorGraphicsDeviceInvalid: + throw GraphicsDeviceInvalidError(message); + + case Result::ErrorPoseInvalid: + throw PoseInvalidError(message); + + case Result::ErrorIndexOutOfRange: + throw IndexOutOfRangeError(message); + + case Result::ErrorViewConfigurationTypeUnsupported: + throw ViewConfigurationTypeUnsupportedError(message); + + case Result::ErrorEnvironmentBlendModeUnsupported: + throw EnvironmentBlendModeUnsupportedError(message); + + case Result::ErrorNameDuplicated: + throw NameDuplicatedError(message); + + case Result::ErrorNameInvalid: + throw NameInvalidError(message); + + case Result::ErrorActionsetNotAttached: + throw ActionsetNotAttachedError(message); + + case Result::ErrorActionsetsAlreadyAttached: + throw ActionsetsAlreadyAttachedError(message); + + case Result::ErrorLocalizedNameDuplicated: + throw LocalizedNameDuplicatedError(message); + + case Result::ErrorLocalizedNameInvalid: + throw LocalizedNameInvalidError(message); + + case Result::ErrorAndroidThreadSettingsIdInvalidKHR: + throw AndroidThreadSettingsIdInvalidKHRError(message); + + case Result::ErrorAndroidThreadSettingsFailureKHR: + throw AndroidThreadSettingsFailureKHRError(message); + + case Result::ErrorCreateSpatialAnchorFailedMSFT: + throw CreateSpatialAnchorFailedMSFTError(message); + + case Result::ErrorSecondaryViewConfigurationTypeNotEnabledMSFT: + throw SecondaryViewConfigurationTypeNotEnabledMSFTError(message); + + default: + throw SystemError(impl::make_error_code(result)); + } +} +//! @} +} // namespace exceptions +} // namespace OPENXR_HPP_NAMESPACE + +#if !defined(OPENXR_HPP_DOXYGEN) +namespace std { +template <> +struct is_error_code_enum : public true_type {}; +} // namespace std +#endif // !defined(OPENXR_HPP_DOXYGEN) +#endif // !defined(OPENXR_HPP_NO_EXCEPTIONS) + +namespace OPENXR_HPP_NAMESPACE { + +/*! + * @defgroup return_results Returning results + * @brief Types and functions used by API call wrappers to return output in a + * friendly, C++ manner. + * + * A user of openxr.hpp will not typically call the functions here directly, + * but knowing how they work could be useful. + * @{ + */ + +/*! + * @brief Contains a Result enumerant and a returned value. + * + * Implicitly convertible to std::tuple<> so you can do `std::tie(result, value) + * = callThatReturnsResultValue()` + * + * @ingroup utilities + */ +template struct ResultValue { + ResultValue(Result r, T const &v) : result(r), value(v) {} + + ResultValue(Result r, T &&v) : result(r), value(std::move(v)) {} + + Result result; + T value; + + operator std::tuple() { + return std::tuple(result, value); + } +}; + +/*! + * @brief Computes the return type of a function (in enhanced mode) with no + * non-Result::Success success codes and potentially an output value of type T. + * + * The behavior differs based on whether or not you have + * OPENXR_HPP_NO_EXCEPTIONS defined. If it is defined, then all functions return + * either a Result (for T=void) or a ResultValue. Otherwise, with exceptions + * enabled, the Result does not need to be returned in these cases, so the + * return type is T (which may be void). + */ +template struct ResultValueType; + +#ifdef OPENXR_HPP_NO_EXCEPTIONS +template struct ResultValueType { typedef ResultValue type; }; +template <> struct ResultValueType { typedef Result type; }; +#else +template struct ResultValueType { typedef T type; }; +template <> struct ResultValueType { typedef void type; }; +#endif + +namespace impl { +/*! + * @brief Returned by enhanced-mode functions with no output value and no + * non-Result::Success success codes. + * + * On failure: + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns nothing (void) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result == Result::Success. + * - Returns Result. + */ +OPENXR_HPP_INLINE ResultValueType::type +createResultValue(Result result, char const *message) { +#ifdef OPENXR_HPP_NO_EXCEPTIONS + (void)message; + OPENXR_HPP_ASSERT(result == Result::Success); + return result; +#else + if (failed(result)) { + exceptions::throwResultException(result, message); + } +#endif +} + +/*! + * @brief Returned by enhanced-mode functions with output value of type T and no + * non-Result::Success success codes. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type T + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result == Result::Success. + * - Returns ResultValue containing both the result (which may be an error or + * Result::Success) and the value. + */ +template +OPENXR_HPP_INLINE typename ResultValueType::type +createResultValue(Result result, T &data, char const *message) { +#ifdef OPENXR_HPP_NO_EXCEPTIONS + (void)message; + OPENXR_HPP_ASSERT(result == Result::Success); + return ResultValue(result, std::move(data)); +#else + if (failed(result)) { + exceptions::throwResultException(result, message); + } + return std::move(data); +#endif +} + +/*! + * @brief Returned by enhanced-mode functions with no output value and at least + * one success code specified that is not Result::Success. + * + * Return type is always Result. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns Result (which may be Result::Success, or a non-Result::Success + * success code) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is one of the expected success codes. + * - Returns Result (which may be an error, Result::Success, or a + * non-Result::Success success code). + */ +OPENXR_HPP_INLINE Result +createResultValue(Result result, char const *message, + std::initializer_list successCodes) { +#ifdef OPENXR_HPP_NO_EXCEPTIONS + (void)message; + OPENXR_HPP_ASSERT(std::find(successCodes.begin(), successCodes.end(), + result) != successCodes.end()); +#else + if (std::find(successCodes.begin(), successCodes.end(), result) == + successCodes.end()) { + exceptions::throwResultException(result, message); + } +#endif + return result; +} + +/*! + * @brief Returned by enhanced-mode functions with an output value of type T and + * at least one success code specified that is not Result::Success. + * + * Return type is always ResultValue, containing both a Result and the output + * of type T. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns ResultValue, containing both a Result (which may be + * Result::Success, or a non-Result::Success success code) and the output of + * type T. + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result == Result::Success. + * - Returns ResultValue, containing both a Result (which may be an error, + * Result::Success, or a non-Result::Success success code) and the output of + * type T. + */ +template +OPENXR_HPP_INLINE ResultValue::type> +createResultValue(Result result, T &&data, char const *message, + std::initializer_list successCodes) { +#ifdef OPENXR_HPP_NO_EXCEPTIONS + (void)message; + OPENXR_HPP_ASSERT(std::find(successCodes.begin(), successCodes.end(), + result) != successCodes.end()); +#else + if (std::find(successCodes.begin(), successCodes.end(), result) == + successCodes.end()) { + exceptions::throwResultException(result, message); + } +#endif + return {result, std::move(data)}; +} + +#ifndef OPENXR_HPP_NO_SMART_HANDLE +/*! + * @brief Returned by enhanced-mode functions that create a UniqueHandle + * (a handle of type T, with deleter using dispatch type D) and + * no non-Result::Success success codes. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns UniqueHandle. + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result == Result::Success. + * - Returns ResultValue>, containing both a Result (which + * may be an error, or Result::Success) and the UniqueHandle. + */ +template +OPENXR_HPP_INLINE typename ResultValueType>::type +createResultValue( + Result result, T &data, + typename traits::UniqueHandleTraits::deleter const &deleter, + char const *message) { +#ifdef OPENXR_HPP_NO_EXCEPTIONS + (void)message; + OPENXR_HPP_ASSERT(result == Result::Success); + return ResultValue>( + result, UniqueHandle(std::move(data), deleter)); +#else + if (failed(result)) { + exceptions::throwResultException(result, message); + } + return UniqueHandle(data, deleter); +#endif +} + +/*! + * @brief Returned by enhanced-mode functions that create a UniqueHandle + * (a handle of type T, with deleter using dispatch type D) and + * at least one success code specified that is not Result::Success. + * + * Return type is always ResultValue>, containing both a + * Result and the UniqueHandle (which may be null). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns ResultValue>, containing both a Result (which + * may be Result::Success, or a non-Result::Success success code) and the + * UniqueHandle. + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result == Result::Success. + * - Returns ResultValue, containing both a Result (which may be an error, + * Result::Success, or a non-Result::Success success code) and the + * UniqueHandle. + */ +template +OPENXR_HPP_INLINE ResultValue> createResultValue( + Result result, T &data, + typename traits::UniqueHandleTraits::deleter const &deleter, + char const *message, std::initializer_list successCodes) { +#ifdef OPENXR_HPP_NO_EXCEPTIONS + (void)message; + OPENXR_HPP_ASSERT(std::find(successCodes.begin(), successCodes.end(), + result) != successCodes.end()); + return ResultValue>( + result, UniqueHandle(std::move(data), deleter)); +#else + if (std::find(successCodes.begin(), successCodes.end(), result) == + successCodes.end()) { + exceptions::throwResultException(result, message); + } + return ResultValue>(result, + UniqueHandle{data, deleter}); +#endif +} +#endif + +} // namespace impl + +//! @} + +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +struct ApiLayerProperties; +struct ExtensionProperties; +struct ApplicationInfo; +struct InstanceCreateInfo; +struct InstanceProperties; +struct EventDataBuffer; +struct SystemGetInfo; +struct SystemGraphicsProperties; +struct SystemTrackingProperties; +struct SystemProperties; +struct SessionCreateInfo; +struct Vector3f; +struct SpaceVelocity; +struct Quaternionf; +struct Posef; +struct ReferenceSpaceCreateInfo; +struct Extent2Df; +struct ActionSpaceCreateInfo; +struct SpaceLocation; +struct ViewConfigurationProperties; +struct ViewConfigurationView; +struct SwapchainCreateInfo; +struct SwapchainImageBaseHeader; +struct SwapchainImageAcquireInfo; +struct SwapchainImageWaitInfo; +struct SwapchainImageReleaseInfo; +struct SessionBeginInfo; +struct FrameWaitInfo; +struct FrameState; +struct FrameBeginInfo; +struct CompositionLayerBaseHeader; +struct FrameEndInfo; +struct ViewLocateInfo; +struct ViewState; +struct Fovf; +struct View; +struct ActionSetCreateInfo; +struct ActionCreateInfo; +struct ActionSuggestedBinding; +struct InteractionProfileSuggestedBinding; +struct SessionActionSetsAttachInfo; +struct InteractionProfileState; +struct ActionStateGetInfo; +struct ActionStateBoolean; +struct ActionStateFloat; +struct Vector2f; +struct ActionStateVector2f; +struct ActionStatePose; +struct ActiveActionSet; +struct ActionsSyncInfo; +struct BoundSourcesForActionEnumerateInfo; +struct InputSourceLocalizedNameGetInfo; +struct HapticActionInfo; +struct HapticBaseHeader; +struct BaseInStructure; +struct BaseOutStructure; +struct Offset2Di; +struct Extent2Di; +struct Rect2Di; +struct SwapchainSubImage; +struct CompositionLayerProjectionView; +struct CompositionLayerProjection; +struct CompositionLayerQuad; +struct EventDataBaseHeader; +struct EventDataEventsLost; +struct EventDataInstanceLossPending; +struct EventDataSessionStateChanged; +struct EventDataReferenceSpaceChangePending; +struct EventDataInteractionProfileChanged; +struct HapticVibration; +struct Offset2Df; +struct Rect2Df; +struct Vector4f; +struct Color4f; +struct CompositionLayerCubeKHR; +struct InstanceCreateInfoAndroidKHR; +struct CompositionLayerDepthInfoKHR; +struct VulkanSwapchainFormatListCreateInfoKHR; +struct CompositionLayerCylinderKHR; +struct CompositionLayerEquirectKHR; +struct GraphicsBindingOpenGLWin32KHR; +struct GraphicsBindingOpenGLXlibKHR; +struct GraphicsBindingOpenGLXcbKHR; +struct GraphicsBindingOpenGLWaylandKHR; +struct SwapchainImageOpenGLKHR; +struct GraphicsRequirementsOpenGLKHR; +struct GraphicsBindingOpenGLESAndroidKHR; +struct SwapchainImageOpenGLESKHR; +struct GraphicsRequirementsOpenGLESKHR; +struct GraphicsBindingVulkanKHR; +struct SwapchainImageVulkanKHR; +struct GraphicsRequirementsVulkanKHR; +struct GraphicsBindingD3D11KHR; +struct SwapchainImageD3D11KHR; +struct GraphicsRequirementsD3D11KHR; +struct GraphicsBindingD3D12KHR; +struct SwapchainImageD3D12KHR; +struct GraphicsRequirementsD3D12KHR; +struct VisibilityMaskKHR; +struct EventDataVisibilityMaskChangedKHR; +struct EventDataPerfSettingsEXT; +struct DebugUtilsObjectNameInfoEXT; +struct DebugUtilsLabelEXT; +struct DebugUtilsMessengerCallbackDataEXT; +struct DebugUtilsMessengerCreateInfoEXT; +struct SystemEyeGazeInteractionPropertiesEXT; +struct EyeGazeSampleTimeEXT; +struct SessionCreateInfoOverlayEXTX; +struct EventDataMainSessionVisibilityChangedEXTX; +struct SpatialAnchorCreateInfoMSFT; +struct SpatialAnchorSpaceCreateInfoMSFT; +struct ViewConfigurationDepthRangeEXT; +struct GraphicsBindingEGLMNDX; +struct SpatialGraphNodeSpaceCreateInfoMSFT; +struct SystemHandTrackingPropertiesEXT; +struct HandTrackerCreateInfoEXT; +struct HandJointsLocateInfoEXT; +struct HandJointLocationEXT; +struct HandJointVelocityEXT; +struct HandJointLocationsEXT; +struct HandJointVelocitiesEXT; +struct SystemHandTrackingMeshPropertiesMSFT; +struct HandMeshSpaceCreateInfoMSFT; +struct HandMeshUpdateInfoMSFT; +struct HandMeshIndexBufferMSFT; +struct HandMeshVertexMSFT; +struct HandMeshVertexBufferMSFT; +struct HandMeshMSFT; +struct HandPoseTypeInfoMSFT; +struct SecondaryViewConfigurationSessionBeginInfoMSFT; +struct SecondaryViewConfigurationStateMSFT; +struct SecondaryViewConfigurationFrameStateMSFT; +struct SecondaryViewConfigurationLayerInfoMSFT; +struct SecondaryViewConfigurationFrameEndInfoMSFT; +struct SecondaryViewConfigurationSwapchainCreateInfoMSFT; +struct ViewConfigurationViewFovEPIC; +} // namespace OPENXR_HPP_NAMESPACE + +namespace OPENXR_HPP_NAMESPACE { + +//! Type traits +namespace traits { +//! Type trait associating an ObjectType enum value with its C++ type. +template struct cpp_type; +} // namespace traits + +// forward declarations + +class Instance; +class Session; +class Space; +class Action; +class Swapchain; +class ActionSet; +class DebugUtilsMessengerEXT; +class SpatialAnchorMSFT; +class HandTrackerEXT; + +/*! + * @defgroup handles Handle types + * @brief Wrappers for OpenXR handle types, with associated functions mapped as + * methods. + * @{ + */ +/*! + * @defgroup unique_handle_aliases Aliases for UniqueHandle types + * @brief Convenience names for specializations of UniqueHandle<> + */ +//! @} + +#ifndef OPENXR_HPP_NO_SMART_HANDLE + +namespace traits { +//! Traits associating a deleter type with handles of type Instance +template class UniqueHandleTraits { +public: + using deleter = ObjectDestroy; +}; +} // namespace traits + +//! @addtogroup unique_handle_aliases +//! @{ + +//! Shorthand name for unique handles of type Instance, using a static dispatch. +using UniqueInstance = UniqueHandle; +//! Shorthand name for unique handles of type Instance, using a dynamic +//! dispatch. +using UniqueDynamicInstance = UniqueHandle; +//! @} +#endif /*OPENXR_HPP_NO_SMART_HANDLE*/ + +//! @brief Handle class - wrapping XrInstance +//! +//! See the related specification text at +//! +//! @ingroup handles +class Instance { +public: + using Type = Instance; + using RawHandleType = XrInstance; + /*! + * @name Constructors, assignment, and conversions + * @{ + */ + //! Default (empty/null) constructor + OPENXR_HPP_CONSTEXPR Instance() noexcept : val_(XR_NULL_HANDLE) {} + //! @brief Conversion constructor from the raw XrInstance type + //! + //! Explicit on 32-bit platforms by default unless + //! OPENXR_HPP_TYPESAFE_CONVERSION is defined. + OPENXR_HPP_TYPESAFE_EXPLICIT Instance(RawHandleType handle) noexcept + : val_(handle) {} + //! Constructor from nullptr - creates empty/null handle. + OPENXR_HPP_CONSTEXPR Instance(std::nullptr_t /* unused */) noexcept + : val_(XR_NULL_HANDLE) {} + +#if defined(OPENXR_HPP_TYPESAFE_CONVERSION) + //! @brief Assignment operator from the raw XrInstance + //! + //! Does *not* destroy any contained non-null handle first! For that, see + //! UniqueHandle<>. + //! + //! Only provided if OPENXR_HPP_TYPESAFE_CONVERSION is defined (defaults to + //! only on 64-bit). + Type &operator=(RawHandleType handle) noexcept { + val_ = handle; + return *this; + } +#endif + + //! @brief Assignment operator from nullptr - assigns to empty/null handle. + //! + //! Does *not* destroy any contained non-null handle first! For that, see + //! UniqueHandle<>. + Type &operator=(std::nullptr_t /* unused */) noexcept { + val_ = XR_NULL_HANDLE; + return *this; + } + + //! @brief Conversion operator to the raw XrInstance type + //! + //! Explicit on 32-bit platforms by default unless + //! OPENXR_HPP_TYPESAFE_CONVERSION is defined. + OPENXR_HPP_CONSTEXPR OPENXR_HPP_TYPESAFE_EXPLICIT + operator RawHandleType() const noexcept { + return val_; + } + //! @} + + /*! + * @name Validity checking + * @{ + */ + //! Returns true in conditionals if this Instance is valid + OPENXR_HPP_CONSTEXPR explicit operator bool() const noexcept { + return val_ != XR_NULL_HANDLE; + } + //! Unary negation: True if this Instance is invalid + OPENXR_HPP_CONSTEXPR bool operator!() const noexcept { + return val_ == XR_NULL_HANDLE; + } + //! @} + //! @name Raw XrInstance manipulation + //! @{ + + //! Gets the raw XrInstance type. + OPENXR_HPP_CONSTEXPR XrInstance get() const noexcept { return val_; } + //! @brief "Put" function for assigning as null then getting the address of + //! the raw pointer to pass to creation functions. + //! + //! e.g. + //! ``` + //! Instance yourHandle; + //! auto result = d.xrCreateInstance(..., yourHandle.put())); + //! ``` + //! + //! See also OPENXR_HPP_NAMESPACE::put() + RawHandleType *put() noexcept { + val_ = XR_NULL_HANDLE; + return &val_; + } + //! @} + + /*! + * @name OpenXR API calls as member functions + * @{ + */ + +#ifdef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetInstanceProcAddr wrapper (basic). + * + * See the related specification text at + * + */ + template + Result getInstanceProcAddr(const char *name, PFN_xrVoidFunction *function, + Dispatch &&d = Dispatch{}) const; + +#else /* OPENXR_HPP_DISABLE_ENHANCED_MODE */ + /*! + * @brief xrGetInstanceProcAddr wrapper - enhanced mode (hides basic wrapper + * unless OPENXR_HPP_DISABLE_ENHANCED_MODE defined). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns nothing (void) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns Result. + * + * See the related specification text at + * + */ + template + ResultValueType::type + getInstanceProcAddr(const char *name, PFN_xrVoidFunction *function, + Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrDestroyInstance wrapper (basic). + * + * See the related specification text at + * + */ + template + Result destroy(Dispatch &&d = Dispatch{}) const; + +#else /* OPENXR_HPP_DISABLE_ENHANCED_MODE */ + /*! + * @brief xrDestroyInstance wrapper - enhanced mode (hides basic wrapper + * unless OPENXR_HPP_DISABLE_ENHANCED_MODE defined). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns nothing (void) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns Result. + * + * See the related specification text at + * + */ + template + ResultValueType::type destroy(Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrGetInstanceProperties wrapper (basic). + * + * See the related specification text at + * + */ + template + Result getInstanceProperties(InstanceProperties &instanceProperties, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetInstanceProperties wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type InstanceProperties + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type InstanceProperties. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + getInstanceProperties(Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrPollEvent wrapper (basic). + * + * See the related specification text at + * + */ + template + Result pollEvent(EventDataBuffer &eventData, Dispatch &&d = Dispatch{}) const; + +#else /* OPENXR_HPP_DISABLE_ENHANCED_MODE */ + /*! + * @brief xrPollEvent wrapper - enhanced mode (hides basic wrapper unless + * OPENXR_HPP_DISABLE_ENHANCED_MODE defined). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns Result (which may be {Result::Success, Result::EventUnavailable}) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is one of the expected success codes. + * - Returns Result (which may be an error, Result::Success, or a + * non-Result::Success success code). + * + * See the related specification text at + * + */ + template + Result pollEvent(EventDataBuffer &eventData, Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef OPENXR_HPP_PROVIDE_DISCOURAGED_FUNCTIONS + +#ifdef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrResultToString wrapper (basic). + * + * See the related specification text at + * + */ + template + Result resultToString(Result value, char buffer[XR_MAX_RESULT_STRING_SIZE], + Dispatch &&d = Dispatch{}) const; + +#else /* OPENXR_HPP_DISABLE_ENHANCED_MODE */ + /*! + * @brief xrResultToString wrapper - enhanced mode (hides basic wrapper unless + * OPENXR_HPP_DISABLE_ENHANCED_MODE defined). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns nothing (void) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns Result. + * + * See the related specification text at + * + */ + template + ResultValueType::type + resultToString(Result value, char buffer[XR_MAX_RESULT_STRING_SIZE], + Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // OPENXR_HPP_PROVIDE_DISCOURAGED_FUNCTIONS + +#ifdef OPENXR_HPP_PROVIDE_DISCOURAGED_FUNCTIONS + +#ifdef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrStructureTypeToString wrapper (basic). + * + * See the related specification text at + * + */ + template + Result structureTypeToString(StructureType value, + char buffer[XR_MAX_STRUCTURE_NAME_SIZE], + Dispatch &&d = Dispatch{}) const; + +#else /* OPENXR_HPP_DISABLE_ENHANCED_MODE */ + /*! + * @brief xrStructureTypeToString wrapper - enhanced mode (hides basic wrapper + * unless OPENXR_HPP_DISABLE_ENHANCED_MODE defined). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns nothing (void) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns Result. + * + * See the related specification text at + * + */ + template + ResultValueType::type + structureTypeToString(StructureType value, + char buffer[XR_MAX_STRUCTURE_NAME_SIZE], + Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // OPENXR_HPP_PROVIDE_DISCOURAGED_FUNCTIONS + + /*! + * @brief xrGetSystem wrapper (basic). + * + * See the related specification text at + * + */ + template + Result getSystem(const SystemGetInfo &getInfo, const SystemId &systemId, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetSystem wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type SystemId + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type SystemId. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + getSystem(const SystemGetInfo &getInfo, Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrGetSystemProperties wrapper (basic). + * + * See the related specification text at + * + */ + template + Result getSystemProperties(const SystemId &systemId, + SystemProperties &properties, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetSystemProperties wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type SystemProperties + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type SystemProperties. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + getSystemProperties(const SystemId &systemId, + Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrEnumerateEnvironmentBlendModes wrapper (basic). + * + * See the related specification text at + * + */ + template + Result + enumerateEnvironmentBlendModes(const SystemId &systemId, + ViewConfigurationType viewConfigurationType, + uint32_t environmentBlendModeCapacityInput, + uint32_t *environmentBlendModeCountOutput, + XrEnvironmentBlendMode *environmentBlendModes, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrEnumerateEnvironmentBlendModes wrapper - enhanced mode. Performs + * two-call idiom. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type std::vector + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type std::vector. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + enumerateEnvironmentBlendModes(const SystemId &systemId, + ViewConfigurationType viewConfigurationType, + Dispatch &&d = Dispatch{}) const; + + /*! + * @brief xrEnumerateEnvironmentBlendModes wrapper - enhanced mode. Performs + * two-call idiom with a stateful allocator. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type std::vector + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type std::vector. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + enumerateEnvironmentBlendModes(const SystemId &systemId, + ViewConfigurationType viewConfigurationType, + Allocator const &vectorAllocator, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrCreateSession wrapper (basic). + * + * See the related specification text at + * + */ + template + Result createSession(const SessionCreateInfo &createInfo, Session &session, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrCreateSession wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type Session + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type Session. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + createSession(const SessionCreateInfo &createInfo, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_NO_SMART_HANDLE + + /*! + * @brief xrCreateSession wrapper returning a smart handle. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type UniqueHandle> + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type UniqueHandle>. + * + * See the related specification text at + * + */ + template + typename ResultValueType< + UniqueHandle>>::type + createSessionUnique(const SessionCreateInfo &createInfo, + Dispatch &&d = Dispatch{}) const; +#endif /*OPENXR_HPP_NO_SMART_HANDLE*/ +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrEnumerateViewConfigurations wrapper (basic). + * + * See the related specification text at + * + */ + template + Result + enumerateViewConfigurations(const SystemId &systemId, + uint32_t viewConfigurationTypeCapacityInput, + uint32_t *viewConfigurationTypeCountOutput, + XrViewConfigurationType *viewConfigurationTypes, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrEnumerateViewConfigurations wrapper - enhanced mode. Performs + * two-call idiom. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type std::vector + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type std::vector. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + enumerateViewConfigurations(const SystemId &systemId, + Dispatch &&d = Dispatch{}) const; + + /*! + * @brief xrEnumerateViewConfigurations wrapper - enhanced mode. Performs + * two-call idiom with a stateful allocator. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type std::vector + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type std::vector. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + enumerateViewConfigurations(const SystemId &systemId, + Allocator const &vectorAllocator, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrGetViewConfigurationProperties wrapper (basic). + * + * See the related specification text at + * + */ + template + Result getViewConfigurationProperties( + const SystemId &systemId, ViewConfigurationType viewConfigurationType, + ViewConfigurationProperties &configurationProperties, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetViewConfigurationProperties wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type ViewConfigurationProperties + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type ViewConfigurationProperties. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + getViewConfigurationProperties(const SystemId &systemId, + ViewConfigurationType viewConfigurationType, + Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrEnumerateViewConfigurationViews wrapper (basic). + * + * See the related specification text at + * + */ + template + Result enumerateViewConfigurationViews( + const SystemId &systemId, ViewConfigurationType viewConfigurationType, + uint32_t viewCapacityInput, uint32_t *viewCountOutput, + XrViewConfigurationView *views, Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrEnumerateViewConfigurationViews wrapper - enhanced mode. Performs + * two-call idiom. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type std::vector + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type std::vector. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + enumerateViewConfigurationViews(const SystemId &systemId, + ViewConfigurationType viewConfigurationType, + Dispatch &&d = Dispatch{}) const; + + /*! + * @brief xrEnumerateViewConfigurationViews wrapper - enhanced mode. Performs + * two-call idiom with a stateful allocator. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type std::vector + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type std::vector. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + enumerateViewConfigurationViews(const SystemId &systemId, + ViewConfigurationType viewConfigurationType, + Allocator const &vectorAllocator, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrStringToPath wrapper (basic). + * + * See the related specification text at + * + */ + template + Result stringToPath(const char *pathString, const Path &path, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrStringToPath wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type Path + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type Path. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + stringToPath(const char *pathString, Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrPathToString wrapper (basic). + * + * See the related specification text at + * + */ + template + Result pathToString(const Path &path, uint32_t bufferCapacityInput, + uint32_t *bufferCountOutput, char *buffer, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrPathToString wrapper - enhanced mode. Performs two-call idiom. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type string_with_allocator + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type string_with_allocator. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + pathToString(const Path &path, Dispatch &&d = Dispatch{}) const; + + /*! + * @brief xrPathToString wrapper - enhanced mode. Performs two-call idiom with + * a stateful allocator. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type string_with_allocator + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type string_with_allocator. + * + * See the related specification text at + * + */ + template , + typename Dispatch = DispatchLoaderStatic> + typename ResultValueType>::type + pathToString(const Path &path, Allocator const &vectorAllocator, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + + /*! + * @brief xrCreateActionSet wrapper (basic). + * + * See the related specification text at + * + */ + template + Result createActionSet(const ActionSetCreateInfo &createInfo, + ActionSet &actionSet, Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrCreateActionSet wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type ActionSet + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type ActionSet. + * + * See the related specification text at + * + */ + template + typename ResultValueType::type + createActionSet(const ActionSetCreateInfo &createInfo, + Dispatch &&d = Dispatch{}) const; + +#ifndef OPENXR_HPP_NO_SMART_HANDLE + + /*! + * @brief xrCreateActionSet wrapper returning a smart handle. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type UniqueHandle> + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type UniqueHandle>. + * + * See the related specification text at + * + */ + template + typename ResultValueType< + UniqueHandle>>::type + createActionSetUnique(const ActionSetCreateInfo &createInfo, + Dispatch &&d = Dispatch{}) const; +#endif /*OPENXR_HPP_NO_SMART_HANDLE*/ +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#ifdef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrSuggestInteractionProfileBindings wrapper (basic). + * + * See the related specification text at + * + */ + template + Result suggestInteractionProfileBindings( + const InteractionProfileSuggestedBinding &suggestedBindings, + Dispatch &&d = Dispatch{}) const; + +#else /* OPENXR_HPP_DISABLE_ENHANCED_MODE */ + /*! + * @brief xrSuggestInteractionProfileBindings wrapper - enhanced mode (hides + * basic wrapper unless OPENXR_HPP_DISABLE_ENHANCED_MODE defined). + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns nothing (void) + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns Result. + * + * See the related specification text at + * + */ + template + ResultValueType::type suggestInteractionProfileBindings( + const InteractionProfileSuggestedBinding &suggestedBindings, + Dispatch &&d = Dispatch{}) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#if defined(XR_USE_GRAPHICS_API_OPENGL) + + /*! + * @brief xrGetOpenGLGraphicsRequirementsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getOpenGLGraphicsRequirementsKHR( + const SystemId &systemId, + GraphicsRequirementsOpenGLKHR &graphicsRequirements, Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetOpenGLGraphicsRequirementsKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type GraphicsRequirementsOpenGLKHR + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type GraphicsRequirementsOpenGLKHR. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType::type + getOpenGLGraphicsRequirementsKHR(const SystemId &systemId, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_OPENGL) + +#if defined(XR_USE_GRAPHICS_API_OPENGL_ES) + + /*! + * @brief xrGetOpenGLESGraphicsRequirementsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getOpenGLESGraphicsRequirementsKHR( + const SystemId &systemId, + GraphicsRequirementsOpenGLESKHR &graphicsRequirements, + Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetOpenGLESGraphicsRequirementsKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type GraphicsRequirementsOpenGLESKHR + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type GraphicsRequirementsOpenGLESKHR. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType::type + getOpenGLESGraphicsRequirementsKHR(const SystemId &systemId, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_OPENGL_ES) + +#if defined(XR_USE_GRAPHICS_API_VULKAN) + + /*! + * @brief xrGetVulkanInstanceExtensionsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getVulkanInstanceExtensionsKHR(const SystemId &systemId, + uint32_t bufferCapacityInput, + uint32_t *bufferCountOutput, + char *buffer, Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetVulkanInstanceExtensionsKHR wrapper - enhanced mode. Performs + * two-call idiom. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type string_with_allocator + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type string_with_allocator. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template , typename Dispatch> + typename ResultValueType>::type + getVulkanInstanceExtensionsKHR(const SystemId &systemId, Dispatch &&d) const; + + /*! + * @brief xrGetVulkanInstanceExtensionsKHR wrapper - enhanced mode. Performs + * two-call idiom with a stateful allocator. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type string_with_allocator + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type string_with_allocator. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template , typename Dispatch> + typename ResultValueType>::type + getVulkanInstanceExtensionsKHR(const SystemId &systemId, + Allocator const &vectorAllocator, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_VULKAN) + +#if defined(XR_USE_GRAPHICS_API_VULKAN) + + /*! + * @brief xrGetVulkanDeviceExtensionsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getVulkanDeviceExtensionsKHR(const SystemId &systemId, + uint32_t bufferCapacityInput, + uint32_t *bufferCountOutput, char *buffer, + Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetVulkanDeviceExtensionsKHR wrapper - enhanced mode. Performs + * two-call idiom. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type string_with_allocator + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type string_with_allocator. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template , typename Dispatch> + typename ResultValueType>::type + getVulkanDeviceExtensionsKHR(const SystemId &systemId, Dispatch &&d) const; + + /*! + * @brief xrGetVulkanDeviceExtensionsKHR wrapper - enhanced mode. Performs + * two-call idiom with a stateful allocator. + * + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type string_with_allocator + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type string_with_allocator. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template , typename Dispatch> + typename ResultValueType>::type + getVulkanDeviceExtensionsKHR(const SystemId &systemId, + Allocator const &vectorAllocator, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_VULKAN) + +#if defined(XR_USE_GRAPHICS_API_VULKAN) + + /*! + * @brief xrGetVulkanGraphicsDeviceKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getVulkanGraphicsDeviceKHR(const SystemId &systemId, + VkInstance vkInstance, + VkPhysicalDevice *vkPhysicalDevice, + Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetVulkanGraphicsDeviceKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type VkPhysicalDevice + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type VkPhysicalDevice. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType::type + getVulkanGraphicsDeviceKHR(const SystemId &systemId, VkInstance vkInstance, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_VULKAN) + +#if defined(XR_USE_GRAPHICS_API_VULKAN) + + /*! + * @brief xrGetVulkanGraphicsRequirementsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getVulkanGraphicsRequirementsKHR( + const SystemId &systemId, + GraphicsRequirementsVulkanKHR &graphicsRequirements, Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetVulkanGraphicsRequirementsKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type GraphicsRequirementsVulkanKHR + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type GraphicsRequirementsVulkanKHR. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType::type + getVulkanGraphicsRequirementsKHR(const SystemId &systemId, + Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_VULKAN) + +#if defined(XR_USE_GRAPHICS_API_D3D11) + + /*! + * @brief xrGetD3D11GraphicsRequirementsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getD3D11GraphicsRequirementsKHR( + const SystemId &systemId, + GraphicsRequirementsD3D11KHR &graphicsRequirements, Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetD3D11GraphicsRequirementsKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type GraphicsRequirementsD3D11KHR + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type GraphicsRequirementsD3D11KHR. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType::type + getD3D11GraphicsRequirementsKHR(const SystemId &systemId, Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_D3D11) + +#if defined(XR_USE_GRAPHICS_API_D3D12) + + /*! + * @brief xrGetD3D12GraphicsRequirementsKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result getD3D12GraphicsRequirementsKHR( + const SystemId &systemId, + GraphicsRequirementsD3D12KHR &graphicsRequirements, Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrGetD3D12GraphicsRequirementsKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type GraphicsRequirementsD3D12KHR + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type GraphicsRequirementsD3D12KHR. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType::type + getD3D12GraphicsRequirementsKHR(const SystemId &systemId, Dispatch &&d) const; + +#endif /*OPENXR_HPP_DISABLE_ENHANCED_MODE*/ + +#endif // defined(XR_USE_GRAPHICS_API_D3D12) + +#if defined(XR_USE_PLATFORM_WIN32) + + /*! + * @brief xrConvertWin32PerformanceCounterToTimeKHR wrapper (basic). + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + Result convertWin32PerformanceCounterToTimeKHR( + const LARGE_INTEGER *performanceCounter, const Time &time, + Dispatch &&d) const; + +#ifndef OPENXR_HPP_DISABLE_ENHANCED_MODE + /*! + * @brief xrConvertWin32PerformanceCounterToTimeKHR wrapper - enhanced mode. + * + * If OPENXR_HPP_NO_EXCEPTIONS is not defined: + * + * - Throws an appropriate exception on failure. + * - Returns the value of type Time + * + * If OPENXR_HPP_NO_EXCEPTIONS is defined: + * + * - Asserts that result is Result::Success. + * - Returns the output of type Time. + * + * See the related specification text at + * + * + * @note No default dispatch is provided as this is a non-core function, + * and thus requires some dynamic dispatch class (like DispatchLoaderDynamic) + */ + template + typename ResultValueType