From 33498dc6b29eeafbcd0b679bcb1ec260d2a4db06 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 13 Nov 2023 21:35:16 +0000 Subject: [PATCH] st/oxr: Make misc extensions a build time option --- CMakeLists.txt | 22 +++++++++++++++++++ scripts/generate_oxr_ext_support.py | 10 ++++----- .../include/xrt/xrt_config_build.h.cmake_in | 5 +++++ .../oxr/oxr_extension_support.h | 10 ++++----- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23c655da3..169749217 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,6 +362,23 @@ set(XRT_OXR_RUNTIME_SUFFIX monado CACHE STRING "OpenXR client library suffix") # Most users won't touch these. mark_as_advanced(XRT_MODULE_COMPOSITOR_MAIN XRT_MODULE_COMPOSITOR_NULL XRT_FEATURE_OPENXR) +# Misc extension support. +if(NOT DEFINED XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE) + set(XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE ON) +endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL) + set(XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL ON) +endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_HEADLESS) + set(XRT_FEATURE_OPENXR_HEADLESS ON) +endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_OVERLAY) + set(XRT_FEATURE_OPENXR_OVERLAY ON) +endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_VISIBILITY_MASK) + set(XRT_FEATURE_OPENXR_VISIBILITY_MASK ON) +endif() + # Interaction extension support. if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE) set(XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE ON) @@ -598,6 +615,9 @@ message(STATUS "# FEATURE_COLOR_LOG: ${XRT_FEATURE message(STATUS "# FEATURE_DEBUG_GUI: ${XRT_FEATURE_DEBUG_GUI}") message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}") message(STATUS "# FEATURE_OPENXR_DEBUG_UTILS: ${XRT_FEATURE_OPENXR_DEBUG_UTILS}") +message(STATUS "# FEATURE_OPENXR_DISPLAY_REFRESH_RATE: ${XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE}") +message(STATUS "# FEATURE_OPENXR_FORCE_FEEDBACK_CURL: ${XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL}") +message(STATUS "# FEATURE_OPENXR_HEADLESS: ${XRT_FEATURE_OPENXR_HEADLESS}") message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE}") message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_HAND: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_HAND}") message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE}") @@ -611,8 +631,10 @@ message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}") message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT1: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT1}") message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}") +message(STATUS "# FEATURE_OPENXR_OVERLAY: ${XRT_FEATURE_OPENXR_OVERLAY}") message(STATUS "# FEATURE_OPENXR_SPACE_LOCAL_FLOOR: ${XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR}") message(STATUS "# FEATURE_OPENXR_SPACE_UNBOUNDED: ${XRT_FEATURE_OPENXR_SPACE_UNBOUNDED}") +message(STATUS "# FEATURE_OPENXR_VISIBILITY_MASK ${XRT_FEATURE_OPENXR_VISIBILITY_MASK}") message(STATUS "# FEATURE_RENDERDOC: ${XRT_FEATURE_RENDERDOC}") message(STATUS "# FEATURE_SERVICE: ${XRT_FEATURE_SERVICE}") message(STATUS "# FEATURE_SERVICE_SYSTEMD: ${XRT_FEATURE_SERVICE_SYSTEMD}") diff --git a/scripts/generate_oxr_ext_support.py b/scripts/generate_oxr_ext_support.py index c731cefe9..c1380e96e 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -49,7 +49,7 @@ EXTENSIONS = ( ['XR_KHR_opengl_enable', 'XR_USE_GRAPHICS_API_OPENGL'], ['XR_KHR_opengl_es_enable', 'XR_USE_GRAPHICS_API_OPENGL_ES'], ['XR_KHR_swapchain_usage_input_attachment_bit'], - ['XR_KHR_visibility_mask'], + ['XR_KHR_visibility_mask', 'XRT_FEATURE_OPENXR_VISIBILITY_MASK'], ['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'], ['XR_KHR_vulkan_enable2', 'XR_USE_GRAPHICS_API_VULKAN'], ['XR_KHR_win32_convert_performance_counter_time', 'XR_USE_PLATFORM_WIN32'], @@ -62,18 +62,18 @@ EXTENSIONS = ( ['XR_EXT_local_floor', 'XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR'], ['XR_EXT_palm_pose', 'XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE'], ['XR_EXT_samsung_odyssey_controller', 'XRT_FEATURE_OPENXR_INTERACTION_WINMR'], - ['XR_FB_display_refresh_rate'], + ['XR_FB_display_refresh_rate', 'XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE'], ['XR_ML_ml2_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_ML2'], - ['XR_MND_headless'], + ['XR_MND_headless', 'XRT_FEATURE_OPENXR_HEADLESS'], ['XR_MND_swapchain_usage_input_attachment_bit'], ['XR_MSFT_hand_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_MSFT_HAND'], ['XR_MSFT_unbounded_reference_space', 'XRT_FEATURE_OPENXR_SPACE_UNBOUNDED'], ['XR_OPPO_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_OPPO'], - ['XR_EXTX_overlay'], + ['XR_EXTX_overlay', 'XRT_FEATURE_OPENXR_OVERLAY'], ['XR_HTCX_vive_tracker_interaction', 'ALWAYS_DISABLED'], ['XR_MNDX_ball_on_a_stick_controller', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], ['XR_MNDX_egl_enable', 'XR_USE_PLATFORM_EGL', 'XR_USE_GRAPHICS_API_OPENGL'], - ['XR_MNDX_force_feedback_curl'], + ['XR_MNDX_force_feedback_curl', 'XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL'], ['XR_MNDX_hydra', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], ['XR_MNDX_system_buttons', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], ) diff --git a/src/xrt/include/xrt/xrt_config_build.h.cmake_in b/src/xrt/include/xrt/xrt_config_build.h.cmake_in index 6edae3c95..2c8397fd8 100644 --- a/src/xrt/include/xrt/xrt_config_build.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_build.h.cmake_in @@ -29,6 +29,9 @@ #cmakedefine XRT_FEATURE_DEBUG_GUI #cmakedefine XRT_FEATURE_OPENXR #cmakedefine XRT_FEATURE_OPENXR_DEBUG_UTILS +#cmakedefine XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE +#cmakedefine XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL +#cmakedefine XRT_FEATURE_OPENXR_HEADLESS #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_EXT_HAND #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE @@ -42,8 +45,10 @@ #cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH #cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT1 #cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT2 +#cmakedefine XRT_FEATURE_OPENXR_OVERLAY #cmakedefine XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR #cmakedefine XRT_FEATURE_OPENXR_SPACE_UNBOUNDED +#cmakedefine XRT_FEATURE_OPENXR_VISIBILITY_MASK #cmakedefine XRT_FEATURE_RENDERDOC #cmakedefine XRT_FEATURE_SERVICE #cmakedefine XRT_FEATURE_SERVICE_SYSTEMD diff --git a/src/xrt/state_trackers/oxr/oxr_extension_support.h b/src/xrt/state_trackers/oxr/oxr_extension_support.h index e78ce7136..b2ec20531 100644 --- a/src/xrt/state_trackers/oxr/oxr_extension_support.h +++ b/src/xrt/state_trackers/oxr/oxr_extension_support.h @@ -204,7 +204,7 @@ /* * XR_KHR_visibility_mask */ -#if defined(XR_KHR_visibility_mask) +#if defined(XR_KHR_visibility_mask) && defined(XRT_FEATURE_OPENXR_VISIBILITY_MASK) #define OXR_HAVE_KHR_visibility_mask #define OXR_EXTENSION_SUPPORT_KHR_visibility_mask(_) _(KHR_visibility_mask, KHR_VISIBILITY_MASK) #else @@ -350,7 +350,7 @@ /* * XR_FB_display_refresh_rate */ -#if defined(XR_FB_display_refresh_rate) +#if defined(XR_FB_display_refresh_rate) && defined(XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE) #define OXR_HAVE_FB_display_refresh_rate #define OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_) _(FB_display_refresh_rate, FB_DISPLAY_REFRESH_RATE) #else @@ -373,7 +373,7 @@ /* * XR_MND_headless */ -#if defined(XR_MND_headless) +#if defined(XR_MND_headless) && defined(XRT_FEATURE_OPENXR_HEADLESS) #define OXR_HAVE_MND_headless #define OXR_EXTENSION_SUPPORT_MND_headless(_) _(MND_headless, MND_HEADLESS) #else @@ -430,7 +430,7 @@ /* * XR_EXTX_overlay */ -#if defined(XR_EXTX_overlay) +#if defined(XR_EXTX_overlay) && defined(XRT_FEATURE_OPENXR_OVERLAY) #define OXR_HAVE_EXTX_overlay #define OXR_EXTENSION_SUPPORT_EXTX_overlay(_) _(EXTX_overlay, EXTX_OVERLAY) #else @@ -476,7 +476,7 @@ /* * XR_MNDX_force_feedback_curl */ -#if defined(XR_MNDX_force_feedback_curl) +#if defined(XR_MNDX_force_feedback_curl) && defined(XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL) #define OXR_HAVE_MNDX_force_feedback_curl #define OXR_EXTENSION_SUPPORT_MNDX_force_feedback_curl(_) _(MNDX_force_feedback_curl, MNDX_FORCE_FEEDBACK_CURL) #else