React native babylon js app crashing

Hey,
I am facing one recurring crashing issue in one of my babylon native application and the below error is being shown after the crash.

TCP Conn 0x6000004b8580 Failed : error 0:61 [61]

-[MTLDebugBlitCommandEncoder internalValidateCopyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:]:384: failed assertion `Copy From Texture Validation

sourceTexture pixelFormat must be compatible with destinationTexture pixelFormat.

Hi @sayan
I guess this is the error you get in xcode ?
Can you copy/paste the callstack?
Can you push your app somewhere we can have access to?

1 Like

’

dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/webskitters/Library/Developer/Xcode/DerivedData/viewerlibrery-fdxijmnvobgowebabjedxjxopmtm/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib DYLD_FRAMEWORK_PATH=/Users/webskitters/Library/Developer/Xcode/DerivedData/viewerlibrery-fdxijmnvobgowebabjedxjxopmtm/Build/Products/Debug-iphonesimulator

-[MTLDebugBlitCommandEncoder internalValidateCopyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:]:384: failed assertion `Copy From Texture Validation

sourceTexture pixelFormat must be compatible with destinationTexture pixelFormat.

’

CoreSimulator 802.6.1 - Device: iPhone 13 (63B38EA3-9DF6-4E94-8C1B-33A3A6D67C09) - Runtime: iOS 15.5 (19F70) - DeviceType: iPhone 13

Which version of babylonReactNative are you using?
Do you get the issue when you disable Metal Validation?
It’s difficult to have an opinion on the issue without a repro.
Can you upload at least your typescript files?
What are the babylon.js features you are using?

Hey, I am using β€œ@babylonjs/react-native”: β€œ^1.5.1” and β€œ@babylonjs/react-native-iosandroid-0-69”: β€œ^1.5.1” versions to create react native engine view, and my whole scene is created from external javascript files. From there I just take the engine instance and create the scene β€œ@babylonjs/core”: β€œ^5.45.1”. Mainly i am working with dynamic texture and its properties like context.drawImage, context.fillText, context.lineTo. Sometime this dynamic texture applied to mesh or sometimes on sprite manager. There are lots of user interactions such as, user can change the entire view frequently, on that time I am just clearing the dynamic texture and reconstruct them accordingly. Sometimes dynamic texture getting black and some times its crashing with the above issue shown in xcode. I am using lots of java script files thats why I am not able to reproduce the same. Thanks.

Without a repro, it will be close to impossible to figure it out.
I would suggest to try to reduce your code until the minimal configuration for a crash is achieved, and then, you find the set of actions that leads to a crash or you manage to do a repro .js.