summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/openxr/doc_classes/OpenXRInterface.xml8
-rw-r--r--modules/openxr/extensions/openxr_fb_foveation_extension.cpp4
-rw-r--r--modules/openxr/openxr_api.cpp47
-rw-r--r--modules/openxr/openxr_api.h1
4 files changed, 43 insertions, 17 deletions
diff --git a/modules/openxr/doc_classes/OpenXRInterface.xml b/modules/openxr/doc_classes/OpenXRInterface.xml
index 131246fe57..6d1c215ffc 100644
--- a/modules/openxr/doc_classes/OpenXRInterface.xml
+++ b/modules/openxr/doc_classes/OpenXRInterface.xml
@@ -95,14 +95,14 @@
<method name="is_foveation_supported" qualifiers="const">
<return type="bool" />
<description>
- Returns [code]true[/code] if OpenXRs foveation extension is supported, the interface must be initialised before this returns a valid value.
+ Returns [code]true[/code] if OpenXR's foveation extension is supported, the interface must be initialized before this returns a valid value.
[b]Note:[/b] This feature is only available on the compatibility renderer and currently only available on some stand alone headsets. For Vulkan set [member Viewport.vrs_mode] to [code]VRS_XR[/code] on desktop.
</description>
</method>
<method name="is_hand_tracking_supported">
<return type="bool" />
<description>
- Returns [code]true[/code] if OpenXRs hand tracking is supported and enabled.
+ Returns [code]true[/code] if OpenXR's hand tracking is supported and enabled.
[b]Note:[/b] This only returns a valid value after OpenXR has been initialized.
</description>
</method>
@@ -128,10 +128,10 @@
The display refresh rate for the current HMD. Only functional if this feature is supported by the OpenXR runtime and after the interface has been initialized.
</member>
<member name="foveation_dynamic" type="bool" setter="set_foveation_dynamic" getter="get_foveation_dynamic" default="false">
- Enable dynamic foveation adjustment, the interface must be initialised before this is accessible. If enabled foveation will automatically adjusted between low and [member foveation_level].
+ Enable dynamic foveation adjustment, the interface must be initialized before this is accessible. If enabled foveation will automatically adjusted between low and [member foveation_level].
</member>
<member name="foveation_level" type="int" setter="set_foveation_level" getter="get_foveation_level" default="0">
- Set foveation level from 0 (off) to 3 (high), the interface must be initialised before this is accessible.
+ Set foveation level from 0 (off) to 3 (high), the interface must be initialized before this is accessible.
</member>
<member name="render_target_size_multiplier" type="float" setter="set_render_target_size_multiplier" getter="get_render_target_size_multiplier" default="1.0">
The render size multiplier for the current HMD. Must be set before the interface has been initialized.
diff --git a/modules/openxr/extensions/openxr_fb_foveation_extension.cpp b/modules/openxr/extensions/openxr_fb_foveation_extension.cpp
index 7277f85b12..bbdd2e3c8a 100644
--- a/modules/openxr/extensions/openxr_fb_foveation_extension.cpp
+++ b/modules/openxr/extensions/openxr_fb_foveation_extension.cpp
@@ -112,7 +112,7 @@ XrFoveationLevelFB OpenXRFBFoveationExtension::get_foveation_level() const {
void OpenXRFBFoveationExtension::set_foveation_level(XrFoveationLevelFB p_foveation_level) {
foveation_level = p_foveation_level;
- // Update profile will do nothing if we're not yet initialised
+ // Update profile will do nothing if we're not yet initialized.
update_profile();
}
@@ -123,7 +123,7 @@ XrFoveationDynamicFB OpenXRFBFoveationExtension::get_foveation_dynamic() const {
void OpenXRFBFoveationExtension::set_foveation_dynamic(XrFoveationDynamicFB p_foveation_dynamic) {
foveation_dynamic = p_foveation_dynamic;
- // Update profile will do nothing if we're not yet initialised
+ // Update profile will do nothing if we're not yet initialized.
update_profile();
}
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp
index b1c7ab1615..d0e958164d 100644
--- a/modules/openxr/openxr_api.cpp
+++ b/modules/openxr/openxr_api.cpp
@@ -1683,14 +1683,27 @@ bool OpenXRAPI::acquire_image(OpenXRSwapChainInfo &p_swapchain) {
ERR_FAIL_COND_V(p_swapchain.image_acquired, true); // This was not released when it should be, error out and reuse...
XrResult result;
- XrSwapchainImageAcquireInfo swapchain_image_acquire_info = {
- XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO, // type
- nullptr // next
- };
- result = xrAcquireSwapchainImage(p_swapchain.swapchain, &swapchain_image_acquire_info, &p_swapchain.image_index);
- if (XR_FAILED(result)) {
- print_line("OpenXR: failed to acquire swapchain image [", get_error_string(result), "]");
- return false;
+
+ if (!p_swapchain.skip_acquire_swapchain) {
+ XrSwapchainImageAcquireInfo swapchain_image_acquire_info = {
+ XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO, // type
+ nullptr // next
+ };
+
+ result = xrAcquireSwapchainImage(p_swapchain.swapchain, &swapchain_image_acquire_info, &p_swapchain.image_index);
+ if (!XR_UNQUALIFIED_SUCCESS(result)) {
+ // Make sure end_frame knows we need to submit an empty frame
+ frame_state.shouldRender = false;
+
+ if (XR_FAILED(result)) {
+ // Unexpected failure, log this!
+ print_line("OpenXR: failed to acquire swapchain image [", get_error_string(result), "]");
+ return false;
+ } else {
+ // In this scenario we silently fail, the XR runtime is simply not ready yet to acquire the swapchain.
+ return false;
+ }
+ }
}
XrSwapchainImageWaitInfo swapchain_image_wait_info = {
@@ -1700,9 +1713,21 @@ bool OpenXRAPI::acquire_image(OpenXRSwapChainInfo &p_swapchain) {
};
result = xrWaitSwapchainImage(p_swapchain.swapchain, &swapchain_image_wait_info);
- if (XR_FAILED(result)) {
- print_line("OpenXR: failed to wait for swapchain image [", get_error_string(result), "]");
- return false;
+ if (!XR_UNQUALIFIED_SUCCESS(result)) {
+ // Make sure end_frame knows we need to submit an empty frame
+ frame_state.shouldRender = false;
+
+ if (XR_FAILED(result)) {
+ // Unexpected failure, log this!
+ print_line("OpenXR: failed to wait for swapchain image [", get_error_string(result), "]");
+ return false;
+ } else {
+ // Make sure to skip trying to acquire the swapchain image in the next frame
+ p_swapchain.skip_acquire_swapchain = true;
+ return false;
+ }
+ } else {
+ p_swapchain.skip_acquire_swapchain = false;
}
return true;
diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h
index 89f8f3cbec..64769b244c 100644
--- a/modules/openxr/openxr_api.h
+++ b/modules/openxr/openxr_api.h
@@ -139,6 +139,7 @@ private:
void *swapchain_graphics_data = nullptr;
uint32_t image_index = 0;
bool image_acquired = false;
+ bool skip_acquire_swapchain = false;
};
OpenXRSwapChainInfo swapchains[OPENXR_SWAPCHAIN_MAX];