Skip to content

Commit

Permalink
Merge pull request godotengine#100471 from dsnopek/openxr-xrsim-compo…
Browse files Browse the repository at this point in the history
…sition-layer-crash

OpenXR: Fix crash with composition layers in non-dev builds
  • Loading branch information
Repiteo committed Dec 16, 2024
2 parents 10b333c + 20d8bdd commit 4364ed6
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions modules/openxr/scene/openxr_composition_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ OpenXRCompositionLayer::~OpenXRCompositionLayer() {
composition_layer_nodes.erase(this);

if (openxr_layer_provider != nullptr) {
_clear_composition_layer_provider();
memdelete(openxr_layer_provider);
openxr_layer_provider = nullptr;
}
Expand Down Expand Up @@ -374,16 +375,7 @@ void OpenXRCompositionLayer::_reset_fallback_material() {

material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, !enable_hole_punch);
material->set_transparency(get_alpha_blend() ? StandardMaterial3D::TRANSPARENCY_ALPHA : StandardMaterial3D::TRANSPARENCY_DISABLED);

Ref<ViewportTexture> texture = material->get_texture(StandardMaterial3D::TEXTURE_ALBEDO);
if (texture.is_null()) {
texture = layer_viewport->get_texture();
}

Node *loc_scene = texture->get_local_scene();
NodePath viewport_path = loc_scene->get_path_to(layer_viewport);
texture->set_viewport_path_in_scene(viewport_path);
material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, texture);
material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, layer_viewport->get_texture());
} else {
fallback->set_surface_override_material(0, Ref<Material>());
}
Expand Down

0 comments on commit 4364ed6

Please sign in to comment.