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

feat: add visionOS support #323

Merged
merged 2 commits into from
Apr 29, 2024
Merged

feat: add visionOS support #323

merged 2 commits into from
Apr 29, 2024

Conversation

okwasniewski
Copy link
Contributor

This PR is the first step of adding visionOS support to bgfx followup PR to bgfx will be opened soon.

@@ -6,6 +6,10 @@
#ifndef BX_PLATFORM_H_HEADER_GUARD
#define BX_PLATFORM_H_HEADER_GUARD

#ifdef __APPLE__
#include <TargetConditionals.h>
Copy link
Owner

Choose a reason for hiding this comment

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

No platform includes... You have to figure out how to detect it without it. If you didn't notice there are no other platform includes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've replaced platform include with #elif __has_builtin(__is_target_os) && __is_target_os(xros) as there is no __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ equivalent for visionOS. Do you think that's okay?

Copy link
Owner

Choose a reason for hiding this comment

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

They have these for all platforms except visionOS?

__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__

Do you think that's okay?

This is fine, but you have to guard first __has_builtin with something, since it's not available everywhere:

#elif __has_builtin(__is_target_os) && __is_target_os(xros)

For example (not sure if this will work, just a guess):

#elif defined(__has_builtin) && __has_builtin(__is_target_os) && __is_target_os(xros)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, unfortunately this is missing for visionOS..

Apple left some TODO comments in AvailabilityInternal.h (header where the rest of the defines are mentioned) but there is no __ENVIRONMENT_XR_OS_VERSION_MIN_REQUIRED__ or __ENVIRONMENT_VISIONOS_OS_VERSION_MIN_REQUIRED__.

CleanShot 2024-04-29 at 15 38 19@2x

I've checked and #elif defined(__has_builtin) && __has_builtin(__is_target_os) && __is_target_os(xros) works great.

Copy link
Owner

Choose a reason for hiding this comment

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

I've checked and #elif defined(__has_builtin) && __has_builtin(__is_target_os) && __is_target_os(xros) works great.

Great! LGTM.

Are you still adding changes or this is it? I'm ready to merge it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the point of bx repo I think it's all. If anything pops out I can create a follow up PR.

So yeah, I think we can merge it 😄

src/mutex.cpp Outdated Show resolved Hide resolved
src/os.cpp Outdated Show resolved Hide resolved
makefile Outdated Show resolved Hide resolved
scripts/toolchain.lua Outdated Show resolved Hide resolved
scripts/toolchain.lua Show resolved Hide resolved
src/file.cpp Outdated Show resolved Hide resolved
include/bx/platform.h Outdated Show resolved Hide resolved
@okwasniewski okwasniewski marked this pull request as ready for review April 25, 2024 08:55
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

Successfully merging this pull request may close these issues.

None yet

2 participants