diff --git a/CHANGELOG.SDK.md b/CHANGELOG.SDK.md index e8049166d..2abb759e8 100644 --- a/CHANGELOG.SDK.md +++ b/CHANGELOG.SDK.md @@ -1,9 +1,10 @@ # Changelog for OpenXR-SDK-Source and OpenXR-SDK Repo -Update log for the OpenXR-SDK-Source and OpenXR-SDK repo on GitHub. -Updates are in reverse chronological order starting with the latest public release. +Update log for the OpenXR-SDK-Source and OpenXR-SDK repo on GitHub. Updates are +in reverse chronological order starting with the latest public release. -Note that only changes relating to the loader and some of the build changes will affect the OpenXR-SDK repository. +Note that only changes relating to the loader and some of the build changes will +affect the OpenXR-SDK repository. This summarizes the periodic public updates, not individual commits. Updates on GitHub are generally done as single large patches at the release point, @@ -12,6 +13,45 @@ along with any public pull requests that have been accepted. In this repository in particular, since it is primarily software, pull requests may be integrated as they are accepted even between periodic updates. +## OpenXR 1.0.4 release (21-November-2019) + +Patch release for the 1.0 series. + +This release includes some fixes, extensions, and a small build system change: +the build system is now configured to use C++14. No code changes in the loader +or layers have yet taken place that require C++14. **Please file an issue** in +OpenXR-SDK-Source if there is some deployment platform where you would be unable +to use a loader making use of C++14 features. + +### GitHub Pull Requests + +These had been integrated into the public repo incrementally. + +- General, Build, Other + - #141 - Support system libs better (permit system jsoncpp, etc. for easier + packaging) +- hello_xr + - #144 - Fix hello_xr when running under Linux OpenGL X11 +- Registry + - Reserve a Monado EGL extension + + +### Internal issues + +- General, Build, Other + - Switch C++ standard version to C++14 (internal MR 1602) + - Remove unused/unneeded files (internal MR 1609) +- Loader + - Fix typo in parameter/member names (internal MR 1607, internal issue 1233) + - Fix deprecated usage of JsonCpp (internal MR 1604, internal issue 1212) +- hello_xr + - Resolve misleading use of `xrLocateViews` before `xrWaitFrame` in helloXR + and spec (internal MR 1584, internal issue 1227, public issue + ) +- Registry + - Add `XR_EXT_conformance_automation` extension, for use **only** by + conformance testing (internal MR 1577, 1608) + ## OpenXR 1.0.3 release (7-October-2019) Patch release for the 1.0 series. diff --git a/include/openxr/openxr.h b/include/openxr/openxr.h index 33fb10142..80788889d 100644 --- a/include/openxr/openxr.h +++ b/include/openxr/openxr.h @@ -35,7 +35,7 @@ extern "C" { ((((major) & 0xffffULL) << 48) | (((minor) & 0xffffULL) << 32) | ((patch) & 0xffffffffULL)) // OpenXR current version number. -#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 3) +#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 4) #define XR_VERSION_MAJOR(version) (uint16_t)(((uint64_t)(version) >> 48)& 0xffffULL) #define XR_VERSION_MINOR(version) (uint16_t)(((uint64_t)(version) >> 32) & 0xffffULL) @@ -1583,7 +1583,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrDestroySpatialAnchorMSFT( #define XR_MND_headless 1 -#define XR_MND_headless_SPEC_VERSION 1 +#define XR_MND_headless_SPEC_VERSION 2 #define XR_MND_HEADLESS_EXTENSION_NAME "XR_MND_headless" @@ -1605,6 +1605,49 @@ typedef struct XrViewConfigurationDepthRangeEXT { } XrViewConfigurationDepthRangeEXT; + +#define XR_EXT_conformance_automation 1 +#define XR_EXT_conformance_automation_SPEC_VERSION 1 +#define XR_EXT_CONFORMANCE_AUTOMATION_EXTENSION_NAME "XR_EXT_conformance_automation" +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceActiveEXT)(XrSession session, XrPath interactionProfile, XrPath topLevelPath, XrBool32 isActive); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceStateBoolEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrBool32 state); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceStateFloatEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, float state); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceStateVector2fEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrVector2f state); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceLocationEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrSpace space, XrPosef pose); + +#ifndef XR_NO_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceActiveEXT( + XrSession session, + XrPath interactionProfile, + XrPath topLevelPath, + XrBool32 isActive); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateBoolEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrBool32 state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateFloatEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + float state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateVector2fEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrVector2f state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceLocationEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrSpace space, + XrPosef pose); +#endif + #ifdef __cplusplus } #endif diff --git a/specification/registry/xr.xml b/specification/registry/xr.xml index 0c1af7a79..14b13f95b 100644 --- a/specification/registry/xr.xml +++ b/specification/registry/xr.xml @@ -113,7 +113,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project. updates them automatically by processing a line at a time. --> // OpenXR current version number. -#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 3) +#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 4) + + XrResult xrSetInputDeviceActiveEXT + XrSession session + XrPath interactionProfile + XrPath topLevelPath + XrBool32 isActive + + + XrResult xrSetInputDeviceStateBoolEXT + XrSession session + XrPath topLevelPath + XrPath inputSourcePath + XrBool32 state + + + XrResult xrSetInputDeviceStateFloatEXT + XrSession session + XrPath topLevelPath + XrPath inputSourcePath + float state + + + XrResult xrSetInputDeviceStateVector2fEXT + XrSession session + XrPath topLevelPath + XrPath inputSourcePath + XrVector2f state + + + XrResult xrSetInputDeviceLocationEXT + XrSession session + XrPath topLevelPath + XrPath inputSourcePath + XrSpace space + XrPosef pose + + @@ -2352,7 +2395,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project. - + @@ -2387,5 +2430,23 @@ maintained in the master branch of the Khronos OpenXR GitHub project. + + + + + + + + + + + + + + + + + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13bab2cc1..827737a77 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,8 +15,8 @@ # Author: # -# Entire project uses C++11 -set(CMAKE_CXX_STANDARD 11) +# Entire project uses C++14 +set(CMAKE_CXX_STANDARD 14) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -38,6 +38,11 @@ endif() if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conformance" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") option(BUILD_CONFORMANCE_TESTS "Build conformance tests" ON) endif() +include(CMakeDependentOption) + +find_package(JsonCpp) +cmake_dependent_option(BUILD_WITH_SYSTEM_JSONCPP "Use system jsoncpp instead of vendored source" ON + "JSONCPP_FOUND" OFF) # Several files use these compile-time OS switches diff --git a/src/cmake/FindJsonCpp.cmake b/src/cmake/FindJsonCpp.cmake new file mode 100644 index 000000000..c3583f6c8 --- /dev/null +++ b/src/cmake/FindJsonCpp.cmake @@ -0,0 +1,392 @@ +# - Find jsoncpp - Overarching find module +# This is a over-arching find module to find older jsoncpp versions and those sadly built +# without JSONCPP_WITH_CMAKE_PACKAGE=ON, as well as those built with the cmake config file. +# It also wraps the different versions of the module. +# +# On CMake 3.0 and newer: +# JsonCpp::JsonCpp - Imported target (possibly an interface/alias) to use: +# if anything is populated, this is. If both shared and static are found, then +# this will be the static version on DLL platforms and shared on non-DLL platforms. +# JsonCpp::JsonCppShared - Imported target (possibly an interface/alias) for a +# shared library version. +# JsonCpp::JsonCppStatic - Imported target (possibly an interface/alias) for a +# static library version. +# +# On all CMake versions: (Note that on CMake 2.8.10 and earlier, you may need to use JSONCPP_INCLUDE_DIRS) +# JSONCPP_LIBRARY - wraps JsonCpp::JsonCpp or equiv. +# JSONCPP_LIBRARY_IS_SHARED - if we know for sure JSONCPP_LIBRARY is shared, this is true-ish. We try to "un-set" it if we don't know one way or another. +# JSONCPP_LIBRARY_SHARED - wraps JsonCpp::JsonCppShared or equiv. +# JSONCPP_LIBRARY_STATIC - wraps JsonCpp::JsonCppStatic or equiv. +# JSONCPP_INCLUDE_DIRS - Include directories - should (generally?) not needed if you require CMake 2.8.11+ since it handles target include directories. +# +# JSONCPP_FOUND - True if JsonCpp was found. +# +# Original Author: +# 2016 Ryan Pavlik +# Incorporates work from the module contributed to VRPN under the same license: +# 2011 Philippe Crassous (ENSAM ParisTech / Institut Image) p.crassous _at_ free.fr +# +# Copyright Philippe Crassous 2011. +# Copyright Sensics, Inc. 2016. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(__jsoncpp_have_namespaced_targets OFF) +set(__jsoncpp_have_interface_support OFF) +if(NOT ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 3.0)) + set(__jsoncpp_have_namespaced_targets ON) + set(__jsoncpp_have_interface_support ON) +elseif(("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" EQUAL 2.8) AND "${CMAKE_PATCH_VERSION}" GREATER 10) + set(__jsoncpp_have_interface_support ON) +endif() + +# sets __jsoncpp_have_jsoncpplib based on whether or not we have a real imported jsoncpp_lib target. +macro(_jsoncpp_check_for_real_jsoncpplib) + set(__jsoncpp_have_jsoncpplib FALSE) + if(TARGET jsoncpp_lib) + get_property(__jsoncpp_lib_type TARGET jsoncpp_lib PROPERTY TYPE) + # We make interface libraries. If an actual config module made it, it would be an imported library. + if(NOT __jsoncpp_lib_type STREQUAL "INTERFACE_LIBRARY") + set(__jsoncpp_have_jsoncpplib TRUE) + endif() + endif() + #message(STATUS "__jsoncpp_have_jsoncpplib ${__jsoncpp_have_jsoncpplib}") +endmacro() + +include(FindPackageHandleStandardArgs) +# Ensure that if this is TRUE later, it's because we set it. +set(JSONCPP_FOUND FALSE) +set(__jsoncpp_have_jsoncpplib FALSE) + +# See if we find a CMake config file - there is no harm in calling this more than once, +# and we need to call it at least once every CMake invocation to create the original +# imported targets, since those don't stick around like cache variables. +find_package(jsoncpp QUIET NO_MODULE) + +if(jsoncpp_FOUND) + # Build a string to help us figure out when to invalidate our cache variables. + # start with where we found jsoncpp + set(__jsoncpp_info_string "[${jsoncpp_DIR}]") + + # part of the string to indicate if we found a real jsoncpp_lib (and what kind) + _jsoncpp_check_for_real_jsoncpplib() + + macro(_jsoncpp_apply_map_config target) + if(MSVC) + # Can't do this - different runtimes, incompatible ABI, etc. + set(_jsoncpp_debug_fallback) + else() + set(_jsoncpp_debug_fallback DEBUG) + #osvr_stash_map_config(DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + # Appending, just in case using project or upstream fixes this. + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_RELEASE RELEASE RELWITHDEBINFO MINSIZEREL NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELWITHDEBINFO RELEASE MINSIZEREL NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_MINSIZEREL MINSIZEREL RELEASE RELWITHDEBINFO NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_NONE NONE RELEASE RELWITHDEBINFO MINSIZEREL ${_jsoncpp_debug_fallback}) + if(NOT MSVC) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + endmacro() + if(__jsoncpp_have_jsoncpplib) + list(APPEND __jsoncpp_info_string "[${__jsoncpp_lib_type}]") + _jsoncpp_apply_map_config(jsoncpp_lib) + else() + list(APPEND __jsoncpp_info_string "[]") + endif() + # part of the string to indicate if we found jsoncpp_lib_static + if(TARGET jsoncpp_lib_static) + list(APPEND __jsoncpp_info_string "[T]") + _jsoncpp_apply_map_config(jsoncpp_lib_static) + else() + list(APPEND __jsoncpp_info_string "[]") + endif() +endif() + + +# If we found something, and it's not the exact same as what we've found before... +# NOTE: The contents of this "if" block update only (internal) cache variables! +# (since this will only get run the first CMake pass that finds jsoncpp or that finds a different/updated install) +if(jsoncpp_FOUND AND NOT __jsoncpp_info_string STREQUAL "${JSONCPP_CACHED_JSONCPP_DIR_DETAILS}") + #message("Updating jsoncpp cache variables! ${__jsoncpp_info_string}") + set(JSONCPP_CACHED_JSONCPP_DIR_DETAILS "${__jsoncpp_info_string}" CACHE INTERNAL "" FORCE) + unset(JSONCPP_IMPORTED_LIBRARY_SHARED) + unset(JSONCPP_IMPORTED_LIBRARY_STATIC) + unset(JSONCPP_IMPORTED_LIBRARY) + unset(JSONCPP_IMPORTED_INCLUDE_DIRS) + unset(JSONCPP_IMPORTED_LIBRARY_IS_SHARED) + + # if(__jsoncpp_have_jsoncpplib) is equivalent to if(TARGET jsoncpp_lib) except it excludes our + # "invented" jsoncpp_lib interface targets, made for convenience purposes after this block. + + if(__jsoncpp_have_jsoncpplib AND TARGET jsoncpp_lib_static) + + # A veritable cache of riches - we have both shared and static! + set(JSONCPP_IMPORTED_LIBRARY_SHARED jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib_static CACHE INTERNAL "" FORCE) + if(WIN32 OR CYGWIN OR MINGW) + # DLL platforms: static library should be default + set(JSONCPP_IMPORTED_LIBRARY ${JSONCPP_IMPORTED_LIBRARY_STATIC} CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + else() + # Other platforms - might require PIC to be linked into shared libraries, so safest to prefer shared. + set(JSONCPP_IMPORTED_LIBRARY ${JSONCPP_IMPORTED_LIBRARY_SHARED} CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED TRUE CACHE INTERNAL "" FORCE) + endif() + + elseif(TARGET jsoncpp_lib_static) + # Well, only one variant, but we know for sure that it's static. + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib_static CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib_static CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib AND __jsoncpp_lib_type STREQUAL "STATIC_LIBRARY") + # We were able to figure out the mystery library is static! + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib AND __jsoncpp_lib_type STREQUAL "SHARED_LIBRARY") + # We were able to figure out the mystery library is shared! + set(JSONCPP_IMPORTED_LIBRARY_SHARED jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED TRUE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib) + # One variant, and we have no idea if this is just an old version or if + # this is shared based on the target name alone. Hmm. + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + endif() + + # Now, we need include directories. Can't just limit this to old CMakes, since + # new CMakes might be used to build projects designed to support older ones. + if(__jsoncpp_have_jsoncpplib) + get_property(__jsoncpp_interface_include_dirs TARGET jsoncpp_lib PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + if(__jsoncpp_interface_include_dirs) + set(JSONCPP_IMPORTED_INCLUDE_DIRS "${__jsoncpp_interface_include_dirs}" CACHE INTERNAL "" FORCE) + endif() + endif() + if(TARGET jsoncpp_lib_static AND NOT JSONCPP_IMPORTED_INCLUDE_DIRS) + get_property(__jsoncpp_interface_include_dirs TARGET jsoncpp_lib_static PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + if(__jsoncpp_interface_include_dirs) + set(JSONCPP_IMPORTED_INCLUDE_DIRS "${__jsoncpp_interface_include_dirs}" CACHE INTERNAL "" FORCE) + endif() + endif() +endif() + +# As a convenience... +if(TARGET jsoncpp_lib_static AND NOT TARGET jsoncpp_lib) + add_library(jsoncpp_lib INTERFACE) + target_link_libraries(jsoncpp_lib INTERFACE jsoncpp_lib_static) +endif() + +if(JSONCPP_IMPORTED_LIBRARY) + if(NOT JSONCPP_IMPORTED_INCLUDE_DIRS) + # OK, so we couldn't get it from the target... maybe we can figure it out from jsoncpp_DIR. + + # take off the jsoncpp component + get_filename_component(__jsoncpp_import_root "${jsoncpp_DIR}/.." ABSOLUTE) + set(__jsoncpp_hints "${__jsoncpp_import_root}") + # take off the cmake component + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + # take off the lib component + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + # take off one more component in case of multiarch lib + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + + # Now, search. + find_path(JsonCpp_INCLUDE_DIR + NAMES + json/json.h + PATH_SUFFIXES include jsoncpp include/jsoncpp + HINTS ${__jsoncpp_hints}) + if(JsonCpp_INCLUDE_DIR) + mark_as_advanced(JsonCpp_INCLUDE_DIR) + # Note - this does not set it in the cache, in case we find it better at some point in the future! + set(JSONCPP_IMPORTED_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR}) + endif() + endif() + + find_package_handle_standard_args(JsonCpp + DEFAULT_MSG + jsoncpp_DIR + JSONCPP_IMPORTED_LIBRARY + JSONCPP_IMPORTED_INCLUDE_DIRS) +endif() + +if(JSONCPP_FOUND) + # Create any missing namespaced targets from the config module. + if(__jsoncpp_have_namespaced_targets) + if(JSONCPP_IMPORTED_LIBRARY AND NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCpp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY}") + endif() + + if(JSONCPP_IMPORTED_LIBRARY_SHARED AND NOT TARGET JsonCpp::JsonCppShared) + add_library(JsonCpp::JsonCppShared INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCppShared PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY_SHARED}") + endif() + + if(JSONCPP_IMPORTED_LIBRARY_STATIC AND NOT TARGET JsonCpp::JsonCppStatic) + add_library(JsonCpp::JsonCppStatic INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCppStatic PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY_STATIC}") + endif() + + # Hide the stuff we didn't, and no longer, need. + if(NOT JsonCpp_LIBRARY) + unset(JsonCpp_LIBRARY CACHE) + endif() + if(NOT JsonCpp_INCLUDE_DIR) + unset(JsonCpp_INCLUDE_DIR CACHE) + endif() + endif() + + set(JSONCPP_LIBRARY ${JSONCPP_IMPORTED_LIBRARY}) + set(JSONCPP_INCLUDE_DIRS ${JSONCPP_IMPORTED_INCLUDE_DIRS}) + if(DEFINED JSONCPP_IMPORTED_LIBRARY_IS_SHARED) + set(JSONCPP_LIBRARY_IS_SHARED ${JSONCPP_IMPORTED_LIBRARY_IS_SHARED}) + else() + unset(JSONCPP_LIBRARY_IS_SHARED) + endif() + + if(JSONCPP_IMPORTED_LIBRARY_SHARED) + set(JSONCPP_LIBRARY_SHARED ${JSONCPP_IMPORTED_LIBRARY_SHARED}) + endif() + + if(JSONCPP_IMPORTED_LIBRARY_STATIC) + set(JSONCPP_LIBRARY_STATIC ${JSONCPP_IMPORTED_LIBRARY_STATIC}) + endif() +endif() + +# Still nothing after looking for the config file: must go "old-school" +if(NOT JSONCPP_FOUND) + # Invoke pkgconfig for hints + find_package(PkgConfig QUIET) + set(_JSONCPP_INCLUDE_HINTS) + set(_JSONCPP_LIB_HINTS) + if(PKG_CONFIG_FOUND) + pkg_search_module(_JSONCPP_PC QUIET jsoncpp) + if(_JSONCPP_PC_INCLUDE_DIRS) + set(_JSONCPP_INCLUDE_HINTS ${_JSONCPP_PC_INCLUDE_DIRS}) + endif() + if(_JSONCPP_PC_LIBRARY_DIRS) + set(_JSONCPP_LIB_HINTS ${_JSONCPP_PC_LIBRARY_DIRS}) + endif() + if(_JSONCPP_PC_LIBRARIES) + set(_JSONCPP_LIB_NAMES ${_JSONCPP_PC_LIBRARIES}) + endif() + endif() + + if(NOT _JSONCPP_LIB_NAMES) + # OK, if pkg-config wasn't able to give us a library name suggestion, then we may + # have to resort to some intense old logic. + set(_JSONCPP_LIB_NAMES jsoncpp) + set(_JSONCPP_PATHSUFFIXES) + + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND _JSONCPP_PATHSUFFIXES + linux-gcc) # bit of a generalization but close... + endif() + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND + _JSONCPP_LIB_NAMES + json_linux-gcc-${CMAKE_CXX_COMPILER_VERSION}_libmt + json_linux-gcc_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES + linux-gcc-${CMAKE_CXX_COMPILER_VERSION}) + + elseif(MSVC) + if(MSVC_VERSION EQUAL 1200) + list(APPEND _JSONCPP_LIB_NAMES json_vc6_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc6) + elseif(MSVC_VERSION EQUAL 1300) + list(APPEND _JSONCPP_LIB_NAMES json_vc7_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc7) + elseif(MSVC_VERSION EQUAL 1310) + list(APPEND _JSONCPP_LIB_NAMES json_vc71_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc71) + elseif(MSVC_VERSION EQUAL 1400) + list(APPEND _JSONCPP_LIB_NAMES json_vc8_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc80) + elseif(MSVC_VERSION EQUAL 1500) + list(APPEND _JSONCPP_LIB_NAMES json_vc9_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc90) + elseif(MSVC_VERSION EQUAL 1600) + list(APPEND _JSONCPP_LIB_NAMES json_vc10_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc10 msvc100) + endif() + + elseif(MINGW) + list(APPEND _JSONCPP_LIB_NAMES + json_mingw_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES mingw) + + else() + list(APPEND _JSONCPP_LIB_NAMES + json_suncc_libmt + json_vacpp_libmt) + endif() + endif() # end of old logic + + # Actually go looking. + find_path(JsonCpp_INCLUDE_DIR + NAMES + json/json.h + PATH_SUFFIXES jsoncpp + HINTS ${_JSONCPP_INCLUDE_HINTS}) + find_library(JsonCpp_LIBRARY + NAMES + ${_JSONCPP_LIB_NAMES} + PATHS libs + PATH_SUFFIXES ${_JSONCPP_PATHSUFFIXES} + HINTS ${_JSONCPP_LIB_HINTS}) + + find_package_handle_standard_args(JsonCpp + DEFAULT_MSG + JsonCpp_INCLUDE_DIR + JsonCpp_LIBRARY) + + if(JSONCPP_FOUND) + # We already know that the target doesn't exist, let's make it. + # TODO don't know why we get errors like: + # error: 'JsonCpp::JsonCpp-NOTFOUND', needed by 'bin/osvr_json_to_c', missing and no known rule to make it + # when we do the imported target commented out below. So, instead, we make an interface + # target with an alias. Hmm. + + #add_library(JsonCpp::JsonCpp UNKNOWN IMPORTED) + #set_target_properties(JsonCpp::JsonCpp PROPERTIES + # IMPORTED_LOCATION "${JsonCpp_LIBRARY}" + # INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}" + # IMPORTED_LINK_INTERFACE_LANGUAGES "CXX") + + set(JSONCPP_LIBRARY "${JsonCpp_LIBRARY}") + set(JSONCPP_INCLUDE_DIRS "${JsonCpp_INCLUDE_DIR}") + unset(JSONCPP_LIBRARY_IS_SHARED) + + if(__jsoncpp_have_interface_support AND NOT TARGET jsoncpp_interface) + add_library(jsoncpp_interface INTERFACE) + set_target_properties(jsoncpp_interface PROPERTIES + INTERFACE_LINK_LIBRARIES "${JsonCpp_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}") + endif() + if(__jsoncpp_have_namespaced_targets) + if(NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp ALIAS jsoncpp_interface) + endif() + endif() + endif() +endif() + +if(JSONCPP_FOUND) + mark_as_advanced(jsoncpp_DIR JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY) +endif() diff --git a/src/common/xr_dependencies.h b/src/common/xr_dependencies.h index 7498fbbf5..f99ce68a0 100644 --- a/src/common/xr_dependencies.h +++ b/src/common/xr_dependencies.h @@ -19,6 +19,9 @@ #ifdef XR_USE_PLATFORM_ANDROID #include +#include +#include +#include #endif // XR_USE_PLATFORM_ANDROID #ifdef XR_USE_PLATFORM_WIN32 @@ -53,6 +56,18 @@ #ifdef XR_USE_PLATFORM_XLIB #include #include + +#ifdef Success +#undef Success +#endif // Success + +#ifdef Always +#undef Always +#endif // Always + +#ifdef None +#undef None +#endif // None #endif // XR_USE_PLATFORM_XLIB #ifdef XR_USE_PLATFORM_XCB diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt index ac1a7d5c7..1a91ef9b8 100644 --- a/src/loader/CMakeLists.txt +++ b/src/loader/CMakeLists.txt @@ -80,12 +80,21 @@ add_library(openxr_loader ${LIBRARY_TYPE} ${PROJECT_SOURCE_DIR}/src/common/object_info.cpp ${PROJECT_SOURCE_DIR}/src/common/object_info.h ${PROJECT_SOURCE_DIR}/src/common/platform_utils.hpp - ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/src/lib_json/json_reader.cpp - ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/src/lib_json/json_value.cpp - ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/src/lib_json/json_writer.cpp ${LOADER_EXTERNAL_GEN_FILES} ${openxr_loader_RESOURCE_FILE} ) +if(BUILD_WITH_SYSTEM_JSONCPP) + target_link_libraries(openxr_loader PRIVATE JsonCpp::JsonCpp) +else() + target_sources(openxr_loader PRIVATE + ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/src/lib_json/json_reader.cpp + ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/src/lib_json/json_value.cpp + ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/src/lib_json/json_writer.cpp) + target_include_directories(openxr_loader + PRIVATE + # For jsoncpp + ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/include) +endif() set_target_properties(openxr_loader PROPERTIES FOLDER ${LOADER_FOLDER}) set_source_files_properties( @@ -111,9 +120,6 @@ target_include_directories(openxr_loader # for target-specific generated files ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} - - # For jsoncpp - ${PROJECT_SOURCE_DIR}/src/external/jsoncpp/include ) if(VulkanHeaders_FOUND) target_include_directories(openxr_loader @@ -140,7 +146,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() set_target_properties(openxr_loader PROPERTIES SOVERSION "${MAJOR}" VERSION "${MAJOR}.${MINOR}.${PATCH}") - target_link_libraries(openxr_loader -lstdc++fs -ldl -lpthread -lm) + target_link_libraries(openxr_loader PRIVATE stdc++fs PUBLIC dl pthread m) add_custom_target(libopenxr_loader.so.${MAJOR}.${MINOR} ALL COMMAND ${CMAKE_COMMAND} -E create_symlink libopenxr_loader.so.${MAJOR}.${MINOR}.${PATCH} libopenxr_loader.so.${MAJOR}.${MINOR}) diff --git a/src/loader/api_layer_interface.cpp b/src/loader/api_layer_interface.cpp index 50c5a7749..0ba87f182 100644 --- a/src/loader/api_layer_interface.cpp +++ b/src/loader/api_layer_interface.cpp @@ -374,11 +374,11 @@ XrResult ApiLayerInterface::LoadApiLayers(const std::string& openxr_command, uin ApiLayerInterface::ApiLayerInterface(const std::string& layer_name, LoaderPlatformLibraryHandle layer_library, std::vector& supported_extensions, - PFN_xrGetInstanceProcAddr get_instant_proc_addr, + PFN_xrGetInstanceProcAddr get_instance_proc_addr, PFN_xrCreateApiLayerInstance create_api_layer_instance) : _layer_name(layer_name), _layer_library(layer_library), - _get_instance_proc_addr(get_instant_proc_addr), + _get_instance_proc_addr(get_instance_proc_addr), _create_api_layer_instance(create_api_layer_instance), _supported_extensions(supported_extensions) {} diff --git a/src/loader/api_layer_interface.hpp b/src/loader/api_layer_interface.hpp index 6db6bc1ef..b121adbb3 100644 --- a/src/loader/api_layer_interface.hpp +++ b/src/loader/api_layer_interface.hpp @@ -43,7 +43,7 @@ class ApiLayerInterface { std::vector& extension_properties); ApiLayerInterface(const std::string& layer_name, LoaderPlatformLibraryHandle layer_library, - std::vector& supported_extensions, PFN_xrGetInstanceProcAddr get_instant_proc_addr, + std::vector& supported_extensions, PFN_xrGetInstanceProcAddr get_instance_proc_addr, PFN_xrCreateApiLayerInstance create_api_layer_instance); virtual ~ApiLayerInterface(); diff --git a/src/loader/manifest_file.cpp b/src/loader/manifest_file.cpp index 8e25d922f..c3c426610 100644 --- a/src/loader/manifest_file.cpp +++ b/src/loader/manifest_file.cpp @@ -539,10 +539,15 @@ void RuntimeManifestFile::CreateIfValid(std::string const &filename, LoaderLogger::LogErrorMessage("", error_ss.str()); return; } - Json::Reader reader; + Json::CharReaderBuilder builder; + std::string errors; Json::Value root_node = Json::nullValue; - if (!reader.parse(json_stream, root_node, false) || root_node.isNull()) { - error_ss << "failed to parse " << filename << ". Is it a valid runtime manifest file?"; + if (!Json::parseFromStream(builder, json_stream, &root_node, &errors) || root_node.isNull()) { + error_ss << "failed to parse " << filename << "."; + if (!errors.empty()) { + error_ss << " (Error message: " << errors << ")"; + } + error_ss << " Is it a valid runtime manifest file?"; LoaderLogger::LogErrorMessage("", error_ss.str()); return; } @@ -665,10 +670,15 @@ void ApiLayerManifestFile::CreateIfValid(ManifestFileType type, const std::strin return; } - Json::Reader reader; + Json::CharReaderBuilder builder; + std::string errors; Json::Value root_node = Json::nullValue; - if (!reader.parse(json_stream, root_node, false) || root_node.isNull()) { - error_ss << "failed to parse " << filename << ". Is it a valid layer manifest file?"; + if (!Json::parseFromStream(builder, json_stream, &root_node, &errors) || root_node.isNull()) { + error_ss << "failed to parse " << filename << "."; + if (!errors.empty()) { + error_ss << " (Error message: " << errors << ")"; + } + error_ss << " Is it a valid layer manifest file?"; LoaderLogger::LogErrorMessage("", error_ss.str()); return; } diff --git a/src/loader/runtime_interface.cpp b/src/loader/runtime_interface.cpp index b38fa6305..a85cf433c 100644 --- a/src/loader/runtime_interface.cpp +++ b/src/loader/runtime_interface.cpp @@ -219,8 +219,8 @@ const XrGeneratedDispatchTable* RuntimeInterface::GetDebugUtilsMessengerDispatch return GetDispatchTable(runtime_instance); } -RuntimeInterface::RuntimeInterface(LoaderPlatformLibraryHandle runtime_library, PFN_xrGetInstanceProcAddr get_instant_proc_addr) - : _runtime_library(runtime_library), _get_instance_proc_addr(get_instant_proc_addr) {} +RuntimeInterface::RuntimeInterface(LoaderPlatformLibraryHandle runtime_library, PFN_xrGetInstanceProcAddr get_instance_proc_addr) + : _runtime_library(runtime_library), _get_instance_proc_addr(get_instance_proc_addr) {} RuntimeInterface::~RuntimeInterface() { std::string info_message = "RuntimeInterface being destroyed."; diff --git a/src/loader/runtime_interface.hpp b/src/loader/runtime_interface.hpp index 5734f164d..90f0b652e 100644 --- a/src/loader/runtime_interface.hpp +++ b/src/loader/runtime_interface.hpp @@ -58,7 +58,7 @@ class RuntimeInterface { RuntimeInterface& operator=(const RuntimeInterface&) = delete; private: - RuntimeInterface(LoaderPlatformLibraryHandle runtime_library, PFN_xrGetInstanceProcAddr get_instant_proc_addr); + RuntimeInterface(LoaderPlatformLibraryHandle runtime_library, PFN_xrGetInstanceProcAddr get_instance_proc_addr); void SetSupportedExtensions(std::vector& supported_extensions); static std::unique_ptr _single_runtime_interface; diff --git a/src/loader/xr_generated_loader.cpp b/src/loader/xr_generated_loader.cpp index 5d703fc09..a7d97ad61 100644 --- a/src/loader/xr_generated_loader.cpp +++ b/src/loader/xr_generated_loader.cpp @@ -1771,6 +1771,144 @@ XRLOADER_ABI_CATCH_FALLBACK +// ---- XR_EXT_conformance_automation extension commands +extern "C" XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceActiveEXT( + XrSession session, + XrPath interactionProfile, + XrPath topLevelPath, + XrBool32 isActive) XRLOADER_ABI_TRY { + LoaderInstance *loader_instance = g_session_map.Get(session); + if (nullptr == loader_instance) { + LoaderLogger::LogValidationErrorMessage( + "VUID-xrSetInputDeviceActiveEXT-session-parameter", + "xrSetInputDeviceActiveEXT", + "session is not a valid XrSession", + {XrSdkLogObjectInfo{session, XR_OBJECT_TYPE_SESSION}}); + return XR_ERROR_HANDLE_INVALID; + } + const std::unique_ptr& dispatch_table = loader_instance->DispatchTable(); + if (!loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + LoaderLogger::LogValidationErrorMessage("VUID-xrSetInputDeviceActiveEXT-extension-notenabled", + "xrSetInputDeviceActiveEXT", + "The XR_EXT_conformance_automation extension has not been enabled prior to calling xrSetInputDeviceActiveEXT"); + return XR_ERROR_FUNCTION_UNSUPPORTED; + } + + return dispatch_table->SetInputDeviceActiveEXT(session, interactionProfile, topLevelPath, isActive); +} +XRLOADER_ABI_CATCH_FALLBACK + + +extern "C" XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateBoolEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrBool32 state) XRLOADER_ABI_TRY { + LoaderInstance *loader_instance = g_session_map.Get(session); + if (nullptr == loader_instance) { + LoaderLogger::LogValidationErrorMessage( + "VUID-xrSetInputDeviceStateBoolEXT-session-parameter", + "xrSetInputDeviceStateBoolEXT", + "session is not a valid XrSession", + {XrSdkLogObjectInfo{session, XR_OBJECT_TYPE_SESSION}}); + return XR_ERROR_HANDLE_INVALID; + } + const std::unique_ptr& dispatch_table = loader_instance->DispatchTable(); + if (!loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + LoaderLogger::LogValidationErrorMessage("VUID-xrSetInputDeviceStateBoolEXT-extension-notenabled", + "xrSetInputDeviceStateBoolEXT", + "The XR_EXT_conformance_automation extension has not been enabled prior to calling xrSetInputDeviceStateBoolEXT"); + return XR_ERROR_FUNCTION_UNSUPPORTED; + } + + return dispatch_table->SetInputDeviceStateBoolEXT(session, topLevelPath, inputSourcePath, state); +} +XRLOADER_ABI_CATCH_FALLBACK + + +extern "C" XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateFloatEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + float state) XRLOADER_ABI_TRY { + LoaderInstance *loader_instance = g_session_map.Get(session); + if (nullptr == loader_instance) { + LoaderLogger::LogValidationErrorMessage( + "VUID-xrSetInputDeviceStateFloatEXT-session-parameter", + "xrSetInputDeviceStateFloatEXT", + "session is not a valid XrSession", + {XrSdkLogObjectInfo{session, XR_OBJECT_TYPE_SESSION}}); + return XR_ERROR_HANDLE_INVALID; + } + const std::unique_ptr& dispatch_table = loader_instance->DispatchTable(); + if (!loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + LoaderLogger::LogValidationErrorMessage("VUID-xrSetInputDeviceStateFloatEXT-extension-notenabled", + "xrSetInputDeviceStateFloatEXT", + "The XR_EXT_conformance_automation extension has not been enabled prior to calling xrSetInputDeviceStateFloatEXT"); + return XR_ERROR_FUNCTION_UNSUPPORTED; + } + + return dispatch_table->SetInputDeviceStateFloatEXT(session, topLevelPath, inputSourcePath, state); +} +XRLOADER_ABI_CATCH_FALLBACK + + +extern "C" XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateVector2fEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrVector2f state) XRLOADER_ABI_TRY { + LoaderInstance *loader_instance = g_session_map.Get(session); + if (nullptr == loader_instance) { + LoaderLogger::LogValidationErrorMessage( + "VUID-xrSetInputDeviceStateVector2fEXT-session-parameter", + "xrSetInputDeviceStateVector2fEXT", + "session is not a valid XrSession", + {XrSdkLogObjectInfo{session, XR_OBJECT_TYPE_SESSION}}); + return XR_ERROR_HANDLE_INVALID; + } + const std::unique_ptr& dispatch_table = loader_instance->DispatchTable(); + if (!loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + LoaderLogger::LogValidationErrorMessage("VUID-xrSetInputDeviceStateVector2fEXT-extension-notenabled", + "xrSetInputDeviceStateVector2fEXT", + "The XR_EXT_conformance_automation extension has not been enabled prior to calling xrSetInputDeviceStateVector2fEXT"); + return XR_ERROR_FUNCTION_UNSUPPORTED; + } + + return dispatch_table->SetInputDeviceStateVector2fEXT(session, topLevelPath, inputSourcePath, state); +} +XRLOADER_ABI_CATCH_FALLBACK + + +extern "C" XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceLocationEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrSpace space, + XrPosef pose) XRLOADER_ABI_TRY { + LoaderInstance *loader_instance = g_session_map.Get(session); + if (nullptr == loader_instance) { + LoaderLogger::LogValidationErrorMessage( + "VUID-xrSetInputDeviceLocationEXT-session-parameter", + "xrSetInputDeviceLocationEXT", + "session is not a valid XrSession", + {XrSdkLogObjectInfo{session, XR_OBJECT_TYPE_SESSION}}); + return XR_ERROR_HANDLE_INVALID; + } + const std::unique_ptr& dispatch_table = loader_instance->DispatchTable(); + if (!loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + LoaderLogger::LogValidationErrorMessage("VUID-xrSetInputDeviceLocationEXT-extension-notenabled", + "xrSetInputDeviceLocationEXT", + "The XR_EXT_conformance_automation extension has not been enabled prior to calling xrSetInputDeviceLocationEXT"); + return XR_ERROR_FUNCTION_UNSUPPORTED; + } + + return dispatch_table->SetInputDeviceLocationEXT(session, topLevelPath, inputSourcePath, space, pose); +} +XRLOADER_ABI_CATCH_FALLBACK + + + LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProcAddr(XrInstance instance, const char* name, PFN_xrVoidFunction* function) XRLOADER_ABI_TRY { if (nullptr == function) { @@ -2100,6 +2238,29 @@ LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProcAddr(XrInstance in if (loader_instance->ExtensionIsEnabled("XR_MSFT_spatial_anchor")) { *function = reinterpret_cast(loader_instance->DispatchTable()->DestroySpatialAnchorMSFT); } + + // ---- XR_EXT_conformance_automation extension commands + + } else if (func_name == "SetInputDeviceActiveEXT") { + if (loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + *function = reinterpret_cast(loader_instance->DispatchTable()->SetInputDeviceActiveEXT); + } + } else if (func_name == "SetInputDeviceStateBoolEXT") { + if (loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + *function = reinterpret_cast(loader_instance->DispatchTable()->SetInputDeviceStateBoolEXT); + } + } else if (func_name == "SetInputDeviceStateFloatEXT") { + if (loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + *function = reinterpret_cast(loader_instance->DispatchTable()->SetInputDeviceStateFloatEXT); + } + } else if (func_name == "SetInputDeviceStateVector2fEXT") { + if (loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + *function = reinterpret_cast(loader_instance->DispatchTable()->SetInputDeviceStateVector2fEXT); + } + } else if (func_name == "SetInputDeviceLocationEXT") { + if (loader_instance->ExtensionIsEnabled("XR_EXT_conformance_automation")) { + *function = reinterpret_cast(loader_instance->DispatchTable()->SetInputDeviceLocationEXT); + } } } if (*function == nullptr) { @@ -2286,6 +2447,13 @@ void LoaderGenInitInstanceDispatchTable(XrInstance instance, std::unique_ptr(&table->CreateSpatialAnchorMSFT)); LoaderXrTermGetInstanceProcAddr(instance, "xrCreateSpatialAnchorSpaceMSFT", reinterpret_cast(&table->CreateSpatialAnchorSpaceMSFT)); LoaderXrTermGetInstanceProcAddr(instance, "xrDestroySpatialAnchorMSFT", reinterpret_cast(&table->DestroySpatialAnchorMSFT)); + + // ---- XR_EXT_conformance_automation extension commands + LoaderXrTermGetInstanceProcAddr(instance, "xrSetInputDeviceActiveEXT", reinterpret_cast(&table->SetInputDeviceActiveEXT)); + LoaderXrTermGetInstanceProcAddr(instance, "xrSetInputDeviceStateBoolEXT", reinterpret_cast(&table->SetInputDeviceStateBoolEXT)); + LoaderXrTermGetInstanceProcAddr(instance, "xrSetInputDeviceStateFloatEXT", reinterpret_cast(&table->SetInputDeviceStateFloatEXT)); + LoaderXrTermGetInstanceProcAddr(instance, "xrSetInputDeviceStateVector2fEXT", reinterpret_cast(&table->SetInputDeviceStateVector2fEXT)); + LoaderXrTermGetInstanceProcAddr(instance, "xrSetInputDeviceLocationEXT", reinterpret_cast(&table->SetInputDeviceLocationEXT)); } // Instance Update Dispatch Table with an API Layer Interface @@ -2666,5 +2834,27 @@ void ApiLayerInterface::GenUpdateInstanceDispatchTable(XrInstance instance, std: if (nullptr != cur_func_ptr) { table->DestroySpatialAnchorMSFT = reinterpret_cast(cur_func_ptr); } + + // ---- XR_EXT_conformance_automation extension commands + _get_instance_proc_addr(instance, "xrSetInputDeviceActiveEXT", &cur_func_ptr); + if (nullptr != cur_func_ptr) { + table->SetInputDeviceActiveEXT = reinterpret_cast(cur_func_ptr); + } + _get_instance_proc_addr(instance, "xrSetInputDeviceStateBoolEXT", &cur_func_ptr); + if (nullptr != cur_func_ptr) { + table->SetInputDeviceStateBoolEXT = reinterpret_cast(cur_func_ptr); + } + _get_instance_proc_addr(instance, "xrSetInputDeviceStateFloatEXT", &cur_func_ptr); + if (nullptr != cur_func_ptr) { + table->SetInputDeviceStateFloatEXT = reinterpret_cast(cur_func_ptr); + } + _get_instance_proc_addr(instance, "xrSetInputDeviceStateVector2fEXT", &cur_func_ptr); + if (nullptr != cur_func_ptr) { + table->SetInputDeviceStateVector2fEXT = reinterpret_cast(cur_func_ptr); + } + _get_instance_proc_addr(instance, "xrSetInputDeviceLocationEXT", &cur_func_ptr); + if (nullptr != cur_func_ptr) { + table->SetInputDeviceLocationEXT = reinterpret_cast(cur_func_ptr); + } } diff --git a/src/xr_generated_dispatch_table.c b/src/xr_generated_dispatch_table.c index eeaed7b75..9701d5222 100644 --- a/src/xr_generated_dispatch_table.c +++ b/src/xr_generated_dispatch_table.c @@ -172,6 +172,13 @@ void GeneratedXrPopulateDispatchTable(struct XrGeneratedDispatchTable *table, (get_inst_proc_addr(instance, "xrCreateSpatialAnchorMSFT", (PFN_xrVoidFunction*)&table->CreateSpatialAnchorMSFT)); (get_inst_proc_addr(instance, "xrCreateSpatialAnchorSpaceMSFT", (PFN_xrVoidFunction*)&table->CreateSpatialAnchorSpaceMSFT)); (get_inst_proc_addr(instance, "xrDestroySpatialAnchorMSFT", (PFN_xrVoidFunction*)&table->DestroySpatialAnchorMSFT)); + + // ---- XR_EXT_conformance_automation extension commands + (get_inst_proc_addr(instance, "xrSetInputDeviceActiveEXT", (PFN_xrVoidFunction*)&table->SetInputDeviceActiveEXT)); + (get_inst_proc_addr(instance, "xrSetInputDeviceStateBoolEXT", (PFN_xrVoidFunction*)&table->SetInputDeviceStateBoolEXT)); + (get_inst_proc_addr(instance, "xrSetInputDeviceStateFloatEXT", (PFN_xrVoidFunction*)&table->SetInputDeviceStateFloatEXT)); + (get_inst_proc_addr(instance, "xrSetInputDeviceStateVector2fEXT", (PFN_xrVoidFunction*)&table->SetInputDeviceStateVector2fEXT)); + (get_inst_proc_addr(instance, "xrSetInputDeviceLocationEXT", (PFN_xrVoidFunction*)&table->SetInputDeviceLocationEXT)); } diff --git a/src/xr_generated_dispatch_table.h b/src/xr_generated_dispatch_table.h index 75e04d5df..a4fc8c811 100644 --- a/src/xr_generated_dispatch_table.h +++ b/src/xr_generated_dispatch_table.h @@ -172,6 +172,13 @@ struct XrGeneratedDispatchTable { PFN_xrCreateSpatialAnchorMSFT CreateSpatialAnchorMSFT; PFN_xrCreateSpatialAnchorSpaceMSFT CreateSpatialAnchorSpaceMSFT; PFN_xrDestroySpatialAnchorMSFT DestroySpatialAnchorMSFT; + + // ---- XR_EXT_conformance_automation extension commands + PFN_xrSetInputDeviceActiveEXT SetInputDeviceActiveEXT; + PFN_xrSetInputDeviceStateBoolEXT SetInputDeviceStateBoolEXT; + PFN_xrSetInputDeviceStateFloatEXT SetInputDeviceStateFloatEXT; + PFN_xrSetInputDeviceStateVector2fEXT SetInputDeviceStateVector2fEXT; + PFN_xrSetInputDeviceLocationEXT SetInputDeviceLocationEXT; };