Skip to content

Releases: eduardoborges/react-native-filament

2.0.0-rc.6: leaks and StrictMode cleanups from the stress runs

Choose a tag to compare

@eduardoborges eduardoborges released this 03 Sep 04:41
978d132

Fixes found by a night of stress runs on the example app (every screen mounted and unmounted in loops, JS reloads, Fast Refresh, backgrounding, rotation, a 340 mount soak) and on a React Native 0.87.1 app:

  • useBuffer now releases a buffer that finished loading after its effect was cleaned up, even with releaseOnUnmount: false. Nobody would ever consume it, and under fast mount and unmount loops those buffers filled the Java heap on Android until asset loads failed with OutOfMemoryError. Skybox releases its texture buffer on unmount as well.
  • useLightEntity destroys its light entity on unmount. It used to leak one per mount.
  • FilamentView no longer rejects a promise when the native view disappears before findFilamentView resolves.
  • The recording example only stops the recorder when one is running, so StrictMode no longer throws from the cleanup. The test hybrid object initialises its members; createNewHybridObject() used to hand back an invalid enum.
  • Docs: enableTransparentRendering={false} stops clearing between frames, so the scene needs a Skybox.
  • Example: Stress screen gained a 20 round soak entry, and TwoScenes renders two engines on one screen.

Verified on iOS 17 Pro simulator and an Android emulator: 3 rounds at 1.5 s and 5 rounds at 250 ms over 18 screens, 20 round soak with flat memory, 8 JS reloads, 10 background cycles, 10 rotations, 5 Fast Refreshes, all without a crash. The React Native 0.87.1 app survives 10 mount and unmount cycles with this package on both platforms.

2.0.0-rc.5: teardown crash fixes

Pre-release

Choose a tag to compare

@eduardoborges eduardoborges released this 03 Sep 03:01
86c75ac

Crash fixes found by cycling every example screen (17 scenes, 3 rounds at 1.5 s and 5 rounds at 250 ms) on iOS and Android:

  • Android: Hermes GC (hades thread) finalizing a wrapper that held the last reference to a Filament asset called into JDispatcher JNI without an attached thread (std::terminate, "Unable to retrieve jni environment"). JDispatcher now wraps its JNI calls in jni::ThreadScope::WithClassLoader.
  • Recorder and view swapchains kept a raw native window while Filament still had createSwapChain queued; releasing the recorder right after creation crashed in eglCreateWindowSurface. The swapchain deleter now owns the surface/recorder until Filament destroyed the swapchain.
  • Releasing a material while a renderable still used one of its instances hit a Filament precondition abort (BackgroundImage, createPlane, createDebugCubeWireframe). Material deleters detach those renderables first, and RenderableManager.destroyEntity() lets components free their shapes explicitly (BackgroundImage and DebugBox do).
  • useBuffer no longer hands out a buffer that was loaded for an effect run that already cleaned up (StrictMode).
  • useWorkletCallback docs: the returned function is a JS trampoline and cannot be passed into worklets or native callbacks. The PhysicsCoin example passes a plain worklet.

2.0.0-rc.4: react-native-worklets

Pre-release

Choose a tag to compare

@eduardoborges eduardoborges released this 02 Sep 19:52
1e2b46d

Release candidate of the react-native-worklets migration (continues margelo#327).

Changes since rc.3: on Android the Filament runtime's queue is a worklets::AsyncQueueUI with a render-thread scheduler instead of a subclass of AsyncQueue. The subclass failed react-native-worklets' dynamic_pointer_cast whenever libworklets.so was loaded before libreact-native-filament.so (Android compares type_info by pointer and the weak AsyncQueue type_info binds per library in dlopen order), which left the runtime without a queue and aborted on the first scheduled worklet. With Reanimated in the app that was the normal load order.

Verified on React Native 0.83.1 (example app) and 0.87.1 (fresh template app with Reanimated sensors, both library load orders), New Architecture, Hermes, iOS simulator and Android emulator. Peers: react-native-worklets >= 0.12, react-native-reanimated >= 4. Requires the react-native-worklets/plugin Babel plugin.

The tarball includes the prebuilt Filament (from 1.11.0) and Bullet3 binaries, so it installs like the npm package:

"react-native-filament": "https://github.com/eduardoborges/react-native-filament/releases/download/v2.0.0-rc.4/react-native-filament-2.0.0-rc.4.tgz"