-
Notifications
You must be signed in to change notification settings - Fork 133
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 #1384
Conversation
e5c3d0d
to
7dd838f
Compare
5445ef5
to
eee6ff4
Compare
3b3b03c
to
76e05b7
Compare
ec8658e
to
d5d0bd4
Compare
a13bb22
to
830f26f
Compare
I'm not sure if the latest BGFX changes make Win32 fail or if it's something else... Probably it would be best to separate bgfx bump |
It's probably bgfx. We normally verify that bgfx is working before submitting a PR to the bgfx fork. Here is one of the errors:
|
830f26f
to
25ac5ee
Compare
Okay looks like this change fixed build issues: diff --git a/src/shader_spirv.cpp b/src/shader_spirv.cpp
index dc4f12282..185fdfd02 100644
--- a/src/shader_spirv.cpp
+++ b/src/shader_spirv.cpp
@@ -17,12 +17,8 @@ namespace bgfx
#define SPV_OPERAND_7(_a0, _a1, _a2, _a3, _a4, _a5, _a6) SPV_OPERAND_1(_a0), SPV_OPERAND_6(_a1, _a2, _a3, _a4, _a5, _a6)
#define SPV_OPERAND_8(_a0, _a1, _a2, _a3, _a4, _a5, _a6, _a7) SPV_OPERAND_1(_a0), SPV_OPERAND_7(_a1, _a2, _a3, _a4, _a5, _a6, _a7)
#define SPV_OPERAND_9(_a0, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) SPV_OPERAND_1(_a0), SPV_OPERAND_8(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8)
-#if BX_COMPILER_MSVC
-// Workaround MSVS bug...
-# define SPV_OPERAND(...) { BX_MACRO_DISPATCHER(SPV_OPERAND_, __VA_ARGS__) BX_VA_ARGS_PASS(__VA_ARGS__) }
-#else
-# define SPV_OPERAND(...) { BX_MACRO_DISPATCHER(SPV_OPERAND_, __VA_ARGS__)(__VA_ARGS__) }
-#endif // BX_COMPILER_MSVC
+#define SPV_OPERAND(...) { BX_MACRO_DISPATCHER(SPV_OPERAND_, __VA_ARGS__)(__VA_ARGS__) }
+
#define _ Count
bool isDebug(SpvOpcode::Enum _opcode) Here is a PR bringing this back: BabylonJS/bgfx#39 |
a094a08
to
8731cae
Compare
8731cae
to
69f3c76
Compare
Hey, FYI we will first make windowed rendering work in this PR and then create a separate one with the NativeXr plugin. |
84bad1e
to
c3d27f1
Compare
82a04a0
to
fe935eb
Compare
Hey @ryantrem @CedricGuillemet this one is ready for re-review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. I'm getting ready to test on-device, now. Please add a link in README.md to the new VisionOS section in BUILDING.md.
I'm getting a bgfx build error
|
Which version of CMake are you using? Can you try with at least 3.29.0? And also just to make sure did you use this command to generate project?
|
@okwasniewski in the PR description you have a link to a closed bgfx.cmake PR. Will you update that to point to the merged PR(s) so we have a good record of all the related changes across repos? |
Fixed |
I'm have CMake 3.29.3 installed and I'm using |
Is |
It's supposed to be skipped, in that file ( |
Oh okay I got the issue, I was running on visionOS 2.0 and switched to older Xcode for simulator build and got the same issue as you did. Damn I guess I need to submit one more PR to bgfx. Going to work on this tomorrow |
@docEdub Can you try if adding ifdefs to this piece of code make bgfx compile? Im hoping you could test out Babylon Native while we wait for this PR to get merged into bgfx #if !BX_PLATFORM_VISIONOS
if (NULL != NSClassFromString(@"MTKView") )
{
MTKView *view = (MTKView *)_nwh;
if (NULL != view
&& [view isKindOfClass:NSClassFromString(@"MTKView")])
{
m_metalLayer = (CAMetalLayer *)view.layer;
}
}
#endif |
Here is the PR which should fix it: bkaradzic/bgfx#3347 going to do sync one more time once it merges |
Yep, that gets it building and it's working on device. Nice! |
96f6bb1
to
33a470a
Compare
33a470a
to
028474e
Compare
Looks like we're good to go on this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM. Tested on device with most recent changes and it works as expected.
Congrats @okwasniewski (and @matthargett) on getting this in! Thanks for the contribution! |
Thanks for your partnership (and patience)! Next up is getting Babylon React Native to support React Native visionOS, then immersive mode and 6DOF head tracking 🥽 |
Hey,
This PR introduces visionOS windowed rendering for Babylon Native.
Recording
ScreenRecording_08-14-2024.12-57-06_1.MP4
TODO
bkaradzic/bgfx
toBabylonJS/bgfx
: Update to latest bgfx bgfx#38NativeXr plugin integration will be a separate PR.