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

XR_LOADER_DEBUG=all support on godot android #26

Open
hammerandtongs opened this issue Feb 8, 2023 · 3 comments
Open

XR_LOADER_DEBUG=all support on godot android #26

hammerandtongs opened this issue Feb 8, 2023 · 3 comments

Comments

@hammerandtongs
Copy link

Exposing XR_LOADER_DEBUG might be useful for android XR debugging but android has restrictions on env use (each process has its own freestanding env).

https://registry.khronos.org/OpenXR/specs/1.0/loader.html#loader-debugging

I think the cleanest way to do that would be to modify the gradle build target something like

buildConfigField "String", "XR_LOADER_DEBUG", "\"${System.env.GODOT_ANDROID_XR_LOADER_DEBUG}\""

Then add GODOT_ANDROID_XR_LOADER_DEBUG to the build environment.

This could be checked in godotscript by

https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-get-environment

*Warning this is untested as I don't have an android XR device.

@BastiaanOlij
Copy link
Member

Is there any serious down side, performance wise or other, to including this switch?

Else I'd suggest instead of reacting to GODOT_ANDROID_XR_LOADER_DEBUG we react to the debug build system already build into the AAR build scripts.

There is a problem here that needs to be solved in Core, unlike GDExternal, the gdap file does not allow for specifying whether a debug or runtime build of a plugin should be included in the export. That is something that was discussed with the android team but currently on the list of todos for a future version.

That said, we can change the CI to make both runtime and debug builds and just have a godotopenxrloaders-runtime.zip and godotopenxrloaders-debug.zip that includes the different versions.

@hammerandtongs
Copy link
Author

I think it makes a lot of sense to add this to debug builds but I was hoping for someone/anyone with a device to tell us it was ok and didn't fill up logs with silly spam :)

But also it would be kind of nice to find a place to document this "hack" to get working android environment variables for godot. Is there a faq or tips section for it?

@ArchLinus
Copy link

I've been trying to hack in XR_LOADER_DEBUG=all by calling setenv("XR_LOADER_DEBUG", "all", 1); at the core initialization level, but it just doesn't seem like the loader on android is picking it up at all.

Since the environment variable situation is a bit of a mess on android, it might be better to just implement the XR_EXT_debug_utils extension. This extension allows you to register a callback for debug messages, giving you much better control over the logging than the environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants