summaryrefslogtreecommitdiffstats
path: root/modules/openxr
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2024-05-07 16:25:57 -0500
committerDavid Snopek <dsnopek@gmail.com>2024-05-07 20:49:46 -0500
commitde654d9846fc0aed0459c7036a5d399ecfdf20e2 (patch)
treedf854cbf108c9ea8bb0fdba2133dc68b5fad2b1b /modules/openxr
parent9c7e4031c03edb1f40c9a2876f6876fb2d404141 (diff)
downloadredot-engine-de654d9846fc0aed0459c7036a5d399ecfdf20e2.tar.gz
OpenXR: Fix composition layers not having correct play space
Diffstat (limited to 'modules/openxr')
-rw-r--r--modules/openxr/extensions/openxr_composition_layer_extension.cpp3
-rw-r--r--modules/openxr/openxr_api.cpp2
-rw-r--r--modules/openxr/scene/openxr_composition_layer_cylinder.cpp7
-rw-r--r--modules/openxr/scene/openxr_composition_layer_cylinder.h1
-rw-r--r--modules/openxr/scene/openxr_composition_layer_equirect.cpp7
-rw-r--r--modules/openxr/scene/openxr_composition_layer_equirect.h1
-rw-r--r--modules/openxr/scene/openxr_composition_layer_quad.cpp7
-rw-r--r--modules/openxr/scene/openxr_composition_layer_quad.h1
8 files changed, 4 insertions, 25 deletions
diff --git a/modules/openxr/extensions/openxr_composition_layer_extension.cpp b/modules/openxr/extensions/openxr_composition_layer_extension.cpp
index 9a00cecab1..fb21c45fd8 100644
--- a/modules/openxr/extensions/openxr_composition_layer_extension.cpp
+++ b/modules/openxr/extensions/openxr_composition_layer_extension.cpp
@@ -209,6 +209,7 @@ XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_compos
switch (composition_layer->type) {
case XR_TYPE_COMPOSITION_LAYER_QUAD: {
XrCompositionLayerQuad *quad_layer = (XrCompositionLayerQuad *)composition_layer;
+ quad_layer->space = openxr_api->get_play_space();
quad_layer->subImage.swapchain = swapchain_info.get_swapchain();
quad_layer->subImage.imageArrayIndex = 0;
quad_layer->subImage.imageRect.offset.x = 0;
@@ -219,6 +220,7 @@ XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_compos
case XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR: {
XrCompositionLayerCylinderKHR *cylinder_layer = (XrCompositionLayerCylinderKHR *)composition_layer;
+ cylinder_layer->space = openxr_api->get_play_space();
cylinder_layer->subImage.swapchain = swapchain_info.get_swapchain();
cylinder_layer->subImage.imageArrayIndex = 0;
cylinder_layer->subImage.imageRect.offset.x = 0;
@@ -229,6 +231,7 @@ XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_compos
case XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR: {
XrCompositionLayerEquirect2KHR *equirect_layer = (XrCompositionLayerEquirect2KHR *)composition_layer;
+ equirect_layer->space = openxr_api->get_play_space();
equirect_layer->subImage.swapchain = swapchain_info.get_swapchain();
equirect_layer->subImage.imageArrayIndex = 0;
equirect_layer->subImage.imageRect.offset.x = 0;
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp
index 0742cae26a..32512070d6 100644
--- a/modules/openxr/openxr_api.cpp
+++ b/modules/openxr/openxr_api.cpp
@@ -2302,7 +2302,7 @@ void OpenXRAPI::end_frame() {
};
result = xrEndFrame(session, &frame_end_info);
if (XR_FAILED(result)) {
- print_line("OpenXR: failed to end frame! [", get_error_string(result), "]");
+ print_line("OpenXR: rendering skipped and failed to end frame! [", get_error_string(result), "]");
return;
}
diff --git a/modules/openxr/scene/openxr_composition_layer_cylinder.cpp b/modules/openxr/scene/openxr_composition_layer_cylinder.cpp
index ae5a8da5f3..728ba71006 100644
--- a/modules/openxr/scene/openxr_composition_layer_cylinder.cpp
+++ b/modules/openxr/scene/openxr_composition_layer_cylinder.cpp
@@ -76,13 +76,6 @@ void OpenXRCompositionLayerCylinder::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "fallback_segments", PROPERTY_HINT_NONE, ""), "set_fallback_segments", "get_fallback_segments");
}
-void OpenXRCompositionLayerCylinder::_on_openxr_session_begun() {
- OpenXRCompositionLayer::_on_openxr_session_begun();
- if (openxr_api) {
- composition_layer.space = openxr_api->get_play_space();
- }
-}
-
Ref<Mesh> OpenXRCompositionLayerCylinder::_create_fallback_mesh() {
Ref<ArrayMesh> mesh;
mesh.instantiate();
diff --git a/modules/openxr/scene/openxr_composition_layer_cylinder.h b/modules/openxr/scene/openxr_composition_layer_cylinder.h
index aed0fabd78..bb1d242267 100644
--- a/modules/openxr/scene/openxr_composition_layer_cylinder.h
+++ b/modules/openxr/scene/openxr_composition_layer_cylinder.h
@@ -50,7 +50,6 @@ protected:
void _notification(int p_what);
- virtual void _on_openxr_session_begun() override;
virtual Ref<Mesh> _create_fallback_mesh() override;
public:
diff --git a/modules/openxr/scene/openxr_composition_layer_equirect.cpp b/modules/openxr/scene/openxr_composition_layer_equirect.cpp
index d67e71443c..14cfea8da6 100644
--- a/modules/openxr/scene/openxr_composition_layer_equirect.cpp
+++ b/modules/openxr/scene/openxr_composition_layer_equirect.cpp
@@ -81,13 +81,6 @@ void OpenXRCompositionLayerEquirect::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "fallback_segments", PROPERTY_HINT_NONE, ""), "set_fallback_segments", "get_fallback_segments");
}
-void OpenXRCompositionLayerEquirect::_on_openxr_session_begun() {
- OpenXRCompositionLayer::_on_openxr_session_begun();
- if (openxr_api) {
- composition_layer.space = openxr_api->get_play_space();
- }
-}
-
Ref<Mesh> OpenXRCompositionLayerEquirect::_create_fallback_mesh() {
Ref<ArrayMesh> mesh;
mesh.instantiate();
diff --git a/modules/openxr/scene/openxr_composition_layer_equirect.h b/modules/openxr/scene/openxr_composition_layer_equirect.h
index 7a002a48dc..66f8b0a91c 100644
--- a/modules/openxr/scene/openxr_composition_layer_equirect.h
+++ b/modules/openxr/scene/openxr_composition_layer_equirect.h
@@ -51,7 +51,6 @@ protected:
void _notification(int p_what);
- virtual void _on_openxr_session_begun() override;
virtual Ref<Mesh> _create_fallback_mesh() override;
public:
diff --git a/modules/openxr/scene/openxr_composition_layer_quad.cpp b/modules/openxr/scene/openxr_composition_layer_quad.cpp
index 17d57851e4..8c5b8ec26b 100644
--- a/modules/openxr/scene/openxr_composition_layer_quad.cpp
+++ b/modules/openxr/scene/openxr_composition_layer_quad.cpp
@@ -62,13 +62,6 @@ void OpenXRCompositionLayerQuad::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "quad_size", PROPERTY_HINT_NONE, ""), "set_quad_size", "get_quad_size");
}
-void OpenXRCompositionLayerQuad::_on_openxr_session_begun() {
- OpenXRCompositionLayer::_on_openxr_session_begun();
- if (openxr_api) {
- composition_layer.space = openxr_api->get_play_space();
- }
-}
-
Ref<Mesh> OpenXRCompositionLayerQuad::_create_fallback_mesh() {
Ref<QuadMesh> mesh;
mesh.instantiate();
diff --git a/modules/openxr/scene/openxr_composition_layer_quad.h b/modules/openxr/scene/openxr_composition_layer_quad.h
index d88b596984..21bb9b2d85 100644
--- a/modules/openxr/scene/openxr_composition_layer_quad.h
+++ b/modules/openxr/scene/openxr_composition_layer_quad.h
@@ -47,7 +47,6 @@ protected:
void _notification(int p_what);
- virtual void _on_openxr_session_begun() override;
virtual Ref<Mesh> _create_fallback_mesh() override;
public: