glTFast
glTFast copied to clipboard
[Android only] Crash with Null Pointer Dereference on Android when loading a model with materials + Jpeg/Png textures - works fine on other platforms
Describe the bug
When loading a model that has materials and textures on Android, I get the error 2023/03/21 14:27:38.557 15316 15341 Error AndroidRuntime Cause: null pointer dereference
and following errors about Error AndroidRuntime #09 pc 00000000000c87d8 /vendor/lib64/egl/libGLESv2_adreno.so (glTexSubImage2D+144) (BuildId: b87189ccebbe50e571d1bf6b17cf24dc)
to which the app crashes immediately and fails to load.
If I load a model that has no materials/textures, it loads fine as in this case I am loading an animation only file that has the bones and keyframes to append to an existing character in the Unity scene
The same models load fine with the same scene + script in builds on Desktop Windows 11/Mac M1 and on IOS, this only happens on Android.
As the errors are mainly around adreno GPU stuff and texture via glTexSubImage2D, I assume this is something related to the
Files
Repro Project (shared to your email at [email protected]): https://drive.google.com/file/d/1F7HSal5cu6mAZQvFakU3PyMk1qav2BLc/view?usp=share_link
Models which are included in the project under Assets/Streaming Assets (shared to your email at [email protected]): https://drive.google.com/file/d/1eypfkiR2aPEdg9SqirxkDwEKXO8_UHKH/view?usp=share_link
Pre-built APK to demonstrate (shared to your email at [email protected]): https://drive.google.com/file/d/1WQsO-qU91D6YNaxCYS560aJS0aUbr7_S/view?usp=share_link
To Reproduce Steps to reproduce the behavior:
- Go to Scenes/TestLoader
- Hit play > use the top right button in the scene UI canvas for Load Avatar and Equipment
- See in Editor, the equipment loads fine
- Now build this scene to android, do the same there and observe the crash as well as android logs in logcat
Expected behavior GLB files should load fine on Android systems
Desktop (please complete the following information):
- glTFast version 4.9.1
- Unity Editor version 2022.2.10
- Render Pipeline URP 14.0.6
- Platform: Mac M1 Editor and Windows 11 Editor
additionally (if significant for the bug):
- Device: Xperia 1, tested on Pixel phones too
- OS: Android 11
- Unity Editor was used on Windows 11 and M1 Mac machines to test if the editor caused the issue
Additional context Full error log: errorlog.txt
The GLB files tested use JPEG textures, I can confirm this also happens with PNG Textures.
KTX2 textures load just fine however, when using the KTX package recommended in your repro
Have the same issue after upgrading my project from 2021.3.x to 2022.3.9f
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40
Cause: null pointer dereference
x0 000000742f1e98f0 x1 0000000000000000 x2 00000000ffffffff x3 0000000000000000
x4 0000000000000040 x5 0000000000000010 x6 0000000000000000 x7 00000000ffffffff
x8 0000000000000000 x9 0000000000000000 x10 0000000000000000 x11 0000000000000000
x12 0000000000000000 x13 0000000000000040 x14 0000000000000002 x15 00000000ffff0000
x16 0000000000000002 x17 0000000000000000 x18 0000000000000000 x19 0000007373b80000
x20 0000000000000008 x21 0000000000000000 x22 0000000000000008 x23 0000000000000100
x24 0000000000000000 x25 0000000000000018 x26 0000000000000000 x27 0000000000000004
x28 0000000000000008 x29 000000742f1e9950
sp 000000742f1e9830 lr 000000747ac90c1c pc 000000747ac90c44
backtrace:
#00 pc 0000000000308c44 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!4d0cdaba868e987aa070f5a6b168e2!76b617b5a74!+1724) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#01 pc 0000000000304724 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!6fd1d11959478379873bee344e3720!76b617b5a74!+1172) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#02 pc 00000000002da048 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!e9a0267a4c3f12c4fb16e257d3a26e!76b617b5a74!+3712) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#03 pc 00000000002df5dc /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!9c0715a0352375a9ec27cf88ce6933!76b617b5a74!+468) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#04 pc 0000000000148158 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!27efe93e728a48e12b9279ac49fad7!76b617b5a74!+1648) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#05 pc 000000000029e820 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!e94336f9c3a8e90238c7c8557996da!76b617b5a74!+584) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#06 pc 00000000001f6fe8 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!0e6b00ab8c4b112f9f6effa6a8b2b5!76b617b5a74!+1448) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#07 pc 00000000001f3cec /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!4ecf3032464df959aad423cba1a73c!76b617b5a74!+868) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#08 pc 0000000000211720 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!141e50cb152287019aff218176d094!76b617b5a74!+272) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#09 pc 0000000000229e84 /vendor/lib64/egl/libGLESv2_adreno.so (!!!0000!838e96e6042a39f699090106d8c25f!76b617b5a74!+212) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
#10 pc 0000000000128938 /vendor/lib64/egl/libGLESv2_adreno.so (glTexSubImage2D+144) (BuildId: 4c01ec827c67fa05ff2cd01d1d58e663)
Happens also only on android targets (Meta Quest, PICO Neo4). Using glTFast v5.0.4
@ROBYER1 you had this issue about half a year ago - any news or did you find a solution?
When using Vulkan as Graphics API instead of OpenGLES3 I do not get those crashes.
Unforunately I cannot use Vulkan due to other dependencies in my project, but this might at least help someone else or narrow the issue down.
I will try and see if I can find related issues to the OpenGLES3 API somewhere.
I submitted a bug-report to Unity for this issue as it was related to their OpenGLES3 implementation.
Just received an email that they fixed this issue and that its currently awaiting internal confirmation. Will keep you updated once I get more info in which versions this fixed will be released in.
Good news everyone.
I just got updates on my bug report. Looks like the issue will be fixed in these versions:
- 2022.3.13f1
- 2023.1.20f1
- 2023.2.0b17
- 2023.3.0a12
I will test it once I get a hand on the 2022.3.13f1 version.
Ahh, yes I came around to try it. It works again now with the aforementioned version.
Guess you can close this issue now