Skip to content

Conversation

@Drigax
Copy link
Contributor

@Drigax Drigax commented Apr 2, 2021

This PR integrates changes from BabylonJS/BabylonNative#582, updating the BabylonNative graphics initialization code to consume the configuration-based contract.

void Initialize(facebook::jsi::Runtime& jsiRuntime, Dispatcher jsDispatcher);
void Deinitialize();
void UpdateView(void* windowPtr, size_t width, size_t height, void* windowTypePtr = nullptr);
void UpdateView(void* windowPtr, size_t width, size_t height);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally, we should be removing void * from this header as well, in favor of WindowType.

Currently I cannot include the headers here without build failure, I'll keep tooling with CMake to so that this works, but it may require making this a library instead of a collection of source files included in another library. I'm no CMake expert, however.

Copy link
Contributor

Choose a reason for hiding this comment

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

id suggest redefining the type here or using a void pointer for the time being. We can update include directories for the native modules to track down the headers required to access the window type definition. But right now the native modules aren't precompiled binaries when distributed through npm. So if BabylonNative.h references babylon native headers and our react-native native module references BabylonNative.h, i'm pretty sure wed have to package and distribute all headers required to resolve the windowtype, which is going to be a lot more work/seems beyond the scope of fixing breaking changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After chatting offline, I'll go forward with retaining void*.

@chrisfromwork
Copy link
Contributor

@Drigax in BabylonNative theres a change where openxr_loader.lib was renamed to openxr_loaderd.lib for debug. If you mimic what i did in the vcxproj here you should be able to fix windows ci: #188

"${CMAKE_CURRENT_LIST_DIR}/DispatchFunction.h"
"${CMAKE_CURRENT_LIST_DIR}/BabylonNative.h"
"${CMAKE_CURRENT_LIST_DIR}/BabylonNative.cpp")
"${CMAKE_CURRENT_LIST_DIR}/BabylonNative.cpp")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove new line

{
GraphicsConfiguration graphicsConfig = GraphicsConfiguration();
graphicsConfig.WindowPtr = (WindowType)windowPtr;
graphicsConfig.Width = width;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit can we have this as a reinterpret_cast()?

{
ANativeWindow* windowPtr{ ANativeWindow_fromSurface(env, surface) };
ANativeWindow* windowPtr = ANativeWindow_fromSurface(env, surface);
auto width{ static_cast<size_t>(ANativeWindow_getWidth(windowPtr)) };
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: was this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not at all, reverting

Copy link
Contributor

@chrisfromwork chrisfromwork left a comment

Choose a reason for hiding this comment

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

:shipit:

@Drigax
Copy link
Contributor Author

Drigax commented Apr 2, 2021

Looks like everything's green outside of the Android build failures

nvtt.lib;
OGLCompilerd.lib;
openxr_loader.lib;
openxr_loaderd.lib;
Copy link
Member

Choose a reason for hiding this comment

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

Aren't these changes part of @chrisfromwork's PR? Not sure why they are showing up here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes were recommended by chris, I added them to this PR so that it would pass windows CI. We can check in #188 and I can rebase, else we pretty much have the same goal here, I'm just integrating my changes from the new latest commit.

Copy link
Contributor

@chrisfromwork chrisfromwork Apr 5, 2021

Choose a reason for hiding this comment

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

yeah in moving to the newest master we'll see breaks in ci without this change

@Drigax
Copy link
Contributor Author

Drigax commented Apr 5, 2021

@ryantrem, are we good to check in?

Co-authored-by: Ryan Tremblay <ryantrem@msn.com>
@chrisfromwork chrisfromwork merged commit ef7ba06 into BabylonJS:master Apr 6, 2021
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.

3 participants