margelo/react-native-filament

Crash when trying to animate with transform props

Opened this issue · 1 comments

Hey! I've been playing with the lib, awesome work!!

I noticed that whenever I try to animate the transform props according to the docs the app crashes, on both iOS and Android.

But on the other hand, animating imperatively with TransformManager seems to work great!

Here's a minimal reproduction on a new bare RN app: https://github.com/thiagobrez/filament-crash-repro

It's a very trivial scene:

export default function BalloonsScene() {
  const translate = useSharedValue<Float3>([0, 0, 0]);

  const renderCallback: RenderCallback = useCallback(() => {
    'worklet';
    const newY = translate.value[1] + 0.01;
    translate.value = [0, newY, 0]; // Commenting this line will stop the app from crashing
  }, [translate]);

  return (
    <FilamentView style={styles.filamentView} renderCallback={renderCallback}>
      <DefaultLight />
      <Model source={BalloonModel} transformToUnitCube translate={translate} />
      <Camera />
    </FilamentView>
  );
}
Xcode logs

In the debugger: filament.render.queue (20): EXC_BAD_ACCESS (code=1, address=0x88)

In the console:

Running application filamentTranslate ({
    initialProps =     {
        concurrentRoot = 0;
    };
    rootTag = 1;
})
nw_socket_handle_socket_event [C4.1.1:1] Socket SO_ERROR [61: Connection refused]
nw_socket_handle_socket_event [C4.1.2:1] Socket SO_ERROR [61: Connection refused]
nw_connection_get_connected_socket_block_invoke [C4] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x60000337aee0 Failed : error 0:61 [61]
Unbalanced calls start/end for tag 19
Running "filamentTranslate" with {"rootTag":1,"initialProps":{"concurrentRoot":false}}
[RNF/Dispatcher]: Installing global Dispatcher Holder...
[RNF/WorkletRuntimeCollector]: Registering WorkletRuntime 0x600002609c98
[RNF/HybridObject]: (MEMORY) Creating FilamentProxy (#1)... ✅
Loading react-native-worklets-core...
Worklets loaded successfully
[RNF/FilamentProxy]: Creating Worklet Context...
Incorrect NSStringEncoding value 0x8000100 detected. Assuming NSASCIIStringEncoding. Will stop this compatibility mapping behavior in the near future.
[RNF/FilamentProxy]: Successfully created WorkletContext! Installing global Dispatcher...
[RNF/Dispatcher]: Installing global Dispatcher Holder...
[RNF/WorkletRuntimeCollector]: Registering WorkletRuntime 0x600003505ef0
[RNF/FilamentProxy]: Successfully installed global Dispatcher in WorkletContext!
[RNF/FilamentProxy]: Creating Engine...
FEngine (64 bits) created at 0x10da97e00 (threading is enabled)
FEngine resolved backend: Metal
Selected physical device 'Apple iOS simulator GPU'
Backend feature level: 2
FEngine feature level: 1
[RNF/FilamentProxy]: Display refresh rate: 60.000000 Hz
[RNF/HybridObject]: (MEMORY) Creating EngineWrapper (#1)... ✅
[RNF/FilamentProxy]: Creating Choreographer...
[RNF/HybridObject]: (MEMORY) Creating ChoreographerWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating TransformManagerWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating RenderableManagerWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating SceneWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating LightManager (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating ViewWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating CameraWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating RendererWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating NameComponentManagerWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating EntityWrapper (#1)... ✅
[RNF/FilamentProxy]: Loading asset RNF_default_env_ibl.ktx...
[RNF/HybridObject]: (MEMORY) Creating FilamentBuffer (#1)... ✅
[RNF/FilamentProxy]: Loading asset http://localhost:8081/assets/src/balloon.glb?platform=ios&hash=a8264637d75085ee73683ccc41a3e40f...
[RNF/AppleFilamentProxy]: Fetching http://localhost:8081/assets/src/balloon.glb?platform=ios&hash=a8264637d75085ee73683ccc41a3e40f...
[RNF/FilamentProxy]: Finding FilamentView #13...
[RNF/HybridObject]: (MEMORY) Creating FilamentView (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating SurfaceProvider (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating Surface (#1)... ✅
[RNF/SurfaceProvider]: Surface created!
[RNF/HybridObject]: (MEMORY) Creating Listener (#1)... ✅
[RNF/Listener]: Creating Listener...
[RNF/SurfaceProvider]: Adding "surface created" listener
[RNF/HybridObject]: (MEMORY) Creating Listener (#2)... ✅
[RNF/Listener]: Creating Listener...
[RNF/SurfaceProvider]: Adding "surface destroyed" listener
[RNF/HybridObject]: (MEMORY) Creating Listener (#3)... ✅
[RNF/Listener]: Creating Listener...
[RNF/EngineImpl]: Setting surface provider...
[RNF/PointerHolder]: Manually releasing FilamentBuffer... (PointerHolder::release())
[RNF/HybridObject]: (MEMORY) Creating Listener (#4)... ✅
[RNF/Listener]: Creating Listener...
[RNF/EngineWrapper]: Creating swapchain for surface ...
[RNF/EngineImpl]: Creating swapchain ...
[RNF/HybridObject]: (MEMORY) Creating SwapChainWrapper (#1)... ✅
[RNF/EngineImpl]: Setting swapchain...
[RNF/ChoreographerWrapper]: Adding frame callback listener
[RNF/HybridObject]: (MEMORY) Creating Listener (#5)... ✅
[RNF/Listener]: Creating Listener...
Starting choreographer
[RNF/HybridObject]: (MEMORY) Creating FilamentBuffer (#2)... ✅
[RNF/HybridObject]: (MEMORY) Creating FilamentAssetWrapper (#1)... ✅
[RNF/PointerHolder]: Manually releasing FilamentBuffer... (PointerHolder::release())
[RNF/HybridObject]: (MEMORY) Creating AABBWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating EntityWrapper (#2)... ✅
[RNF/HybridObject]: (MEMORY) Creating FilamentInstanceWrapper (#1)... ✅
[RNF/HybridObject]: (MEMORY) Creating EntityWrapper (#3)... ✅
[RNF/HybridObject]: (MEMORY) Creating EntityWrapper (#4)... ✅
'Setting up camera lens with aspect ratio:', 0.4612676056338028
Warning: sample comparison not supported by this GPU

I guess I can continue with TransformManager for now, but just wanted let you know 👍🏻

same issue