OpenXR: Fix composition layers not having correct play space

This commit is contained in:
David Snopek 2024-05-07 16:25:57 -05:00
parent 9c7e4031c0
commit de654d9846
8 changed files with 4 additions and 25 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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();

View file

@ -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:

View file

@ -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();

View file

@ -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:

View file

@ -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();

View file

@ -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: