Skip to content

Conversation

@ryantrem
Copy link
Member

Describe the change

It is possible (observed in apps using Babylon React Native) for graphics to be re-enabled after being disabled while the engine instance and EngineView are being torn down. As far as I can tell, this is a timing issue that was probably introduced with the threading changes where rendering no longer happens on the JS thread. It seems to just depend on the timing of when React Native removes the view. The result of this is that if graphics is re-enabled, bgfx allocates a bunch of memory, and so a React Native app can end up with a lot of extra memory pressure even when Babylon is not in use.

The fix for this is to simply keep track of whether rendering has been explicitly enabled/disabled, and only allow the view to be rendered when rendering is enabled (attempting to render a frame will automatically enable rendering).

Screenshots

N/A

Documentation

N/A

Testing

I went through the tests on Android and iOS. I think it is unlikely that this would result in a regression on Windows.

@ryantrem ryantrem merged commit 3049774 into BabylonJS:master Jun 16, 2021
@ryantrem ryantrem deleted the no-bgfx-reinit-2 branch June 16, 2021 01:31
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.

2 participants