Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenXR module failing to build on Linux when Wayland is disabled #98589

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

juanjp600
Copy link
Contributor

This should fix compile errors found by sudo.juan in the Godot Contributors Chat

#97771 suggests that the OpenXR module is only meant to use EGL when Wayland is enabled. However, only some references to EGL are excluded from compilation when Wayland is disabled, with the few that are not excluded leading to compile errors. This PR fixes the incomplete preprocessor checks that cause these errors.

@dsnopek
Copy link
Contributor

dsnopek commented Oct 28, 2024

Thanks!

I think these changes would be fine (because you're right that we are only using this for Wayland), however, I don't think these changes should be necessary. This code doesn't use anything Wayland-specific, it only uses EGL, so if compiling for EGL support works (and we're already wrapping this in #ifdef EGL_ENABLED), then this should work too.

That makes me wonder if there's something else going wrong and we aren't including something necessary for EGL on some systems in the OpenXR module?

@juanjp600
Copy link
Contributor Author

If I'm understanding this correctly, the module's SCsub file only defines XR_USE_PLATFORM_EGL when Wayland is enabled:

if env["wayland"]:
env_openxr.AppendUnique(CPPDEFINES=["XR_USE_PLATFORM_EGL"])

So another approach could be to just enable this definition in all circumstances where EGL is available and not just when Wayland is enabled?

Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding this correctly, the module's SCsub file only defines XR_USE_PLATFORM_EGL when Wayland is enabled

Ah, ok, that makes sense!

Let's go with your PR then :-)

@BastiaanOlij
Copy link
Contributor

Indeed, the Monado EGL extension structs and functions are only included in OpenXR when the XR_USE_PLATFORM_EGL define is set. If this code mirrors the conditions in /modules/openxr/scsub that set this, this PR is good enough. EGL is badly supported in OpenXR so its really only with the Monado runtime that its usable from what I understand.

@Repiteo Repiteo merged commit 23f03a7 into godotengine:master Oct 30, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 30, 2024

Thanks!

@juanjp600 juanjp600 deleted the openxr-no-wayland-build-fix branch October 30, 2024 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants