godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.81k stars 20.14k forks source link

Vulkan Mobile: CPUParticles2D with Spritesheet texture is crashing on Android #86037

Open EdoanR opened 9 months ago

EdoanR commented 9 months ago

Tested versions

System information

Godot v4.2.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated AMD Radeon (TM) R7 360 Series () - AMD Ryzen 5 5600G with Radeon Graphics (12 Threads)

Issue description

When using a CPUParticle2D with a spritesheet (png file) as it's texture, and with a CanvasItemMaterial with Particles Animation enabled, and having any sprite infront of it (does not need to overlap it), whether by child order or by z-index, it crashes when playing on Android.

Does not need to be on the startup, spawning the particle or having a delay to emit it with requirements that I described above, it will crash as well.

But I was able to cause this problem only on my Android device, I have tested in other devices and it does not crash.

Device Android RAM It crashes?
Xiaomi Redmi 7A 10 2GB Crash
Xiaomi Redmi Note 8 10 4GB Does not crash
Xiaomi Redmi Note 9 11 4GB Does not crash
Samsung Galaxy A54 13 8GB Does not crash

The only difference between the devices that I think is causing the problem is the RAM.

The crashes happened in Godot v4.2-stable and v4.1.2-stable, it does not happen on Godot v3.5.3-stable (with both ES3 and ES2).

It is crashing only on Mobile renderer, Compatibility renderer does not crash.

Perhabs is Vulkan renderization causing problem in 2GB devices?

Steps to reproduce

  1. Add a CPU2DParticle to the scene.
  2. Set a new CanvasItemMaterial to it's material
  3. Enable the particles animation.
  4. Add icon.svg or any other sprite to the scene, make it appear infront of the particles by changing the z-index or by child order.
  5. Export to android and play it.

Minimal reproduction project (MRP)

Project files APK file

Calinou commented 9 months ago

Tested with Mobile and Compatibility renderer.

Perhabs is Vulkan renderization causing problem in 2GB devices?

The Compatibility rendering method uses OpenGL ES 3.0, not Vulkan.

EdoanR commented 9 months ago

UPDATE: It does work on Compatibility renderer, my bad. I was changing the renderer using the dropdown at top right, but after I created the project from scratch with Compatibility renderer, it did not crash. But creating with Mobile renderer it does crash. So I guess it's indeed something with Vulkan. I updated the issue description.

ModuleCode commented 9 months ago

I think it's the same problem #85750

Alex2782 commented 9 months ago

i think uniform https://github.com/godotengine/godot/issues/79760#issuecomment-1852828366

canvas_item_material.cpp

        code += "uniform int particles_anim_h_frames;\n";
        code += "uniform int particles_anim_v_frames;\n";
        code += "uniform bool particles_anim_loop;\n\n";

Bildschirmfoto 2023-12-12 um 23 41 41

QbieShay commented 8 months ago

@Zennos Can you include a crash log?

EdoanR commented 8 months ago

@Zennos Can you include a crash log?

I don't know how to get the crash log :/, I've been using adb logcat but it print so much stuff that isn't related to godot that I get lost, is there any guide of how to do it?

QbieShay commented 8 months ago

Try this https://forum.godotengine.org/t/get-adb-log-from-android/10604

I'm not sure myself, I haven't done much mobile dev lately

EdoanR commented 8 months ago

Try this https://forum.godotengine.org/t/get-adb-log-from-android/10604

I'm not sure myself, I haven't done much mobile dev lately

My system didn't recognize grep, but I looked up an alternative and the following command worked for me: adb logcat | findstr /R /C:"Godot" /C:"godot" /C:"spritesheet_cpu_particles_4_2_mobile"

Output:

12-22 11:08:56.823  1613  3371 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp bnds=[441,943][545,1047] (has extras)} from uid 10072
12-22 11:08:58.153   520  1016 D OemNetd : setPidForPackage: packageName=com.example.spritesheet_cpu_particles_4_2_mobile, pid=8569, pid=10461
12-22 11:08:58.153  1613  1699 I ActivityManager: Start proc 8569:com.example.spritesheet_cpu_particles_4_2_mobile/u0a461 for activity {com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp} caller=com.miui.home
12-22 11:08:58.779 12663 24723 I ProcessMonitor: onForegroundInfoChanged: ForegroundInfo{mForegroundPackageName='com.example.spritesheet_cpu_particles_4_2_mobile', mForegroundUid=10461, mForegroundPid=8569, mLastForegroundPackageName='com.miui.home', mLastForegroundUid=10072, mLastForegroundPid=26035, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=1}
12-22 11:08:59.674  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:08:59.687  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:08:59.689  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:08:59.698  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:08:59.703  8569  8569 V GodotActivity: Creating new Godot fragment instance.
12-22 11:08:59.790  8569  8721 E Perf    : Fail to get file list com.example.spritesheet_cpu_particles_4_2_mobile
12-22 11:09:00.754  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:09:00.762  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:09:00.959  8569  8569 W Godot   : The vulkan hardware level does not meet the minimum requirement: 1
12-22 11:09:00.962  8569  8569 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.spritesheet_cpu_particles_4_2_mobile activity: com.godot.game.GodotApp@e672947
12-22 11:09:00.989  8569  8569 W Activity: Slow Operation: Activity com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp onCreate took 1452ms
12-22 11:09:01.029  1613  1658 I SensorService: check list, getPackageName  org.godotengine.godot.Godot
12-22 11:09:01.392  8569  8569 W Looper  : Slow Looper main: Activity com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp is 399ms late (wall=1907ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.LaunchActivityItem] lifecycleRequest=android.app.servertransaction.ResumeActivityItem }) because of 1 msg, msg 1 took 517ms (seq=2 late=3ms h=android.app.ActivityThread$H w=110)
12-22 11:09:01.395  8569  8569 W Looper  : Slow Looper main: Activity com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp is 2332ms late (wall=1ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] }) because of 2 msg, msg 1 took 517ms (seq=2 late=3ms h=android.app.ActivityThread$H w=110), msg 2 took 1907ms (seq=3 late=399ms h=android.app.ActivityThread$H w=159)
12-22 11:09:01.609  8569  8921 I godot   : Godot Engine v4.2.stable.official.46dc27791 - https://godotengine.org
12-22 11:09:01.782  1613  1691 I Timeline: Timeline: Activity_windows_visible id: ActivityRecord{f3a7d1b u0 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp t1318} time:1255974816
12-22 11:09:01.810  1613  1697 I ActivityTaskManager: Displayed com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp: +4s959ms
12-22 11:09:02.540  8569  8921 D vulkan  : searching for layers in '/data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm'
12-22 11:09:02.541  8569  8921 D vulkan  : searching for layers in '/data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/base.apk!/lib/armeabi-v7a'
12-22 11:09:02.608  8569  8921 I godot   : Vulkan API 1.1.87 - Forward Mobile - Using Vulkan Device #0: Qualcomm - Adreno (TM) 505
12-22 11:09:05.925  8569  8921 I godot   :
12-22 11:09:06.014  8569  8921 D AudioTrack: get packages (com.example.spritesheet_cpu_particles_4_2_mobile) for calling UID 10461
12-22 11:09:07.803  9030  9030 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1894 onStartInput(EditorInfo{EditorInfo{packageName=com.example.spritesheet_cpu_particles_4_2_mobile, inputType=0, inputTypeString=NULL, enableLearning=false, autoCorrection=false, autoComplete=false, imeOptions=0, privateImeOptions=null, actionName=UNSPECIFIED, actionLabel=null, initialSelStart=-1, initialSelEnd=-1, initialCapsMode=0, label=null, fieldId=-1, fieldName=null, extras=null, hintText=null, hintLocales=[]}}, false)
12-22 11:09:11.554  8569  8921 D Godot   : OnGodotSetupCompleted
12-22 11:09:11.568  8569  8921 D Godot   : OnGodotMainLoopStarted
12-22 11:09:12.162  9560  9560 F DEBUG   : pid: 8569, tid: 8921, name: VkThread  >>> com.example.spritesheet_cpu_particles_4_2_mobile <<<
12-22 11:09:12.567  9560  9560 F DEBUG   :       #02 pc 013c27c8  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #03 pc 02f3c764  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #04 pc 02f3fe08  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #05 pc 02f410a8  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #06 pc 02e4c8f0  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #07 pc 02e4f688  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #08 pc 02e3feb4  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #09 pc 02e4180c  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #10 pc 02dda970  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #11 pc 008e9d9c  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #12 pc 00894df4  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #13 pc 008ae264  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/lib/arm/libgodot_android.so
12-22 11:09:12.567  9560  9560 F DEBUG   :       #14 pc 0000c547  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/oat/arm/base.odex (art_jni_trampoline+94)
12-22 11:09:12.567  9560  9560 F DEBUG   :       #22 pc 0033e9da  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/oat/arm/base.vdex (org.godotengine.godot.vulkan.VkRenderer.onVkDrawFrame)
12-22 11:09:12.568  9560  9560 F DEBUG   :       #25 pc 0033f0d0  /data/app/com.example.spritesheet_cpu_particles_4_2_mobile-bOyeQvsVNP5xHVl2695Iig==/oat/arm/base.vdex (org.godotengine.godot.vulkan.VkThread.run+300)
12-22 11:09:16.968  1613  9789 W ActivityTaskManager:   Force finishing activity com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp
12-22 11:09:17.076  1613  1801 W InputDispatcher: channel '96a1b48 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
12-22 11:09:17.079  1613  1801 E InputDispatcher: channel '96a1b48 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp (server)' ~ Channel is unrecoverably broken and will be disposed!
12-22 11:09:17.089  1613  8667 E InputDispatcher: Window handle Window{96a1b48 u0 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp} has no registered input channel
12-22 11:09:17.159  1613  8667 E InputDispatcher: Window handle Window{96a1b48 u0 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp} has no registered input channel
12-22 11:09:17.241  5472  5490 D LauncherFsGestureCompat: componentName is com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp
12-22 11:09:17.451  1613  8667 E InputDispatcher: Window handle Window{96a1b48 u0 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp} has no registered input channel
12-22 11:09:17.605  9594  9748 D PerfEngineController: ForegroundInfo{mForegroundPackageName='com.miui.home', mForegroundUid=10072, mForegroundPid=5472, mLastForegroundPackageName='com.example.spritesheet_cpu_particles_4_2_mobile', mLastForegroundUid=10461, mLastForegroundPid=8569, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0}
12-22 11:09:17.616 12663 24723 I ProcessMonitor: onForegroundInfoChanged: ForegroundInfo{mForegroundPackageName='com.miui.home', mForegroundUid=10072, mForegroundPid=5472, mLastForegroundPackageName='com.example.spritesheet_cpu_particles_4_2_mobile', mLastForegroundUid=10461, mLastForegroundPid=8569, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0}
12-22 11:09:17.644  1613  8714 E InputDispatcher: Window handle Window{96a1b48 u0 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp} has no registered input channel
12-22 11:09:17.704  1613  2287 I ActivityManager: Process com.example.spritesheet_cpu_particles_4_2_mobile (pid 8569) has died: fore TOP
12-22 11:09:17.714  1613  1659 I WindowManager: WIN DEATH: Window{96a1b48 u0 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp}
12-22 11:09:17.715  1613  1659 W InputDispatcher: Attempted to unregister already unregistered input channel '96a1b48 com.example.spritesheet_cpu_particles_4_2_mobile/com.godot.game.GodotApp (server)'
12-22 11:09:18.527  9030  9030 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1894 onStartInput(EditorInfo{EditorInfo{packageName=com.example.spritesheet_cpu_particles_4_2_mobile, inputType=0, inputTypeString=NULL, enableLearning=false, autoCorrection=false, autoComplete=false, imeOptions=0, privateImeOptions=null, actionName=UNSPECIFIED, actionLabel=null, initialSelStart=-1, initialSelEnd=-1, initialCapsMode=0, label=null, fieldId=-1, fieldName=null, extras=null, hintText=null, hintLocales=[]}}, true)

An interesting line:

12-22 11:09:00.959 8569 8569 W Godot : The vulkan hardware level does not meet the minimum requirement: 1

Alex2782 commented 8 months ago

Vulkan API 1.1.87 + Xiaomi Redmi 7A https://vulkan.gpuinfo.org/displayreport.php?id=14230

Soon I will try to create a debug project, I find it strange that the apps crash because of uniform. I could not reproduce the problem on my old Samsung tablet with Android 8. (Vulkan API 1.0.61)


I mostly use this filter adb logcat -s godot

But it could also be that something outside of Godot crashes in the system. In this case, I first redirect everything to a text file, but this way all logs from the last 2 hours are output. The text file is 2 MB in size.

adb logcat > logs.txt (all logs, redirect to a text file, after crash press Ctrl + C to cancel)