Help with a Vulcan crash on some Android devices

Godot Version

4.2.1 stable

Question

My game is crashing with a Vulkan stack trace on some Android devices when I run some shaders. On other devices, the effect runs just fine. I tried to make a minimal repro, but the repro project runs just fine on all the devices that I tried.

He is the shader that seems to be causing problem: src/sfx/explosion_sfx.gdshader · main · Yannick Gingras / Revengate · GitLab

I add it to the scene as follow: src/viewport.gd · main · Yannick Gingras / Revengate · GitLab

And this is the crash trace than I get when I do that:

03-15 21:44:52.670  7663  7693 I godot   : === Start of turn 3 ===
03-15 21:44:52.671  7663  7693 I godot   : playing actors: [<Actor Hero on StartingBoard at [4:1]>, <Actor Nadege on StartingBoard at [1:2]>, <Actor BarTender on StartingBoard at [1:7]>, <Actor Michel on StartingBoard at [14:1]>, <Actor BarPatron1 on StartingBoard at [3:8]>, <Actor BarPatron2 on StartingBoard at [3:6]>] 
03-15 21:44:53.626  7663  7693 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 7693 (VkThread), pid 7663 (ngate.revengate)
03-15 21:44:54.026  7734  7734 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-15 21:44:54.026  7734  7734 F DEBUG   : Build fingerprint: 'Sony/G8441/G8441:9/47.2.A.11.228/3311891731:user/release-keys'
03-15 21:44:54.026  7734  7734 F DEBUG   : Revision: '0'
03-15 21:44:54.026  7734  7734 F DEBUG   : ABI: 'arm64'
03-15 21:44:54.026  7734  7734 F DEBUG   : Timestamp: 2024-03-15 21:44:53.733108092-0700
03-15 21:44:54.026  7734  7734 F DEBUG   : Process uptime: 0s
03-15 21:44:54.026  7734  7734 F DEBUG   : Cmdline: org.revengate.revengate
03-15 21:44:54.026  7734  7734 F DEBUG   : pid: 7663, tid: 7693, name: VkThread  >>> org.revengate.revengate <<<
03-15 21:44:54.026  7734  7734 F DEBUG   : uid: 10167
03-15 21:44:54.026  7734  7734 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
03-15 21:44:54.026  7734  7734 F DEBUG   : Cause: null pointer dereference
03-15 21:44:54.026  7734  7734 F DEBUG   :     x0  0000006e0b365fa8  x1  0000006e9b2580b0  x2  0000006deb4ae3e0  x3  0000000000000001
03-15 21:44:54.026  7734  7734 F DEBUG   :     x4  0000006d3b436010  x5  0000006e1b2b62b0  x6  0000000000000003  x7  0000006e9b2580a8
03-15 21:44:54.026  7734  7734 F DEBUG   :     x8  0000000000000000  x9  0000000000000000  x10 0000000000000001  x11 0000006e4b255480
03-15 21:44:54.026  7734  7734 F DEBUG   :     x12 0000000000000001  x13 0000006d2b35b2f0  x14 0000000000000000  x15 0000006e1b2b62b0
03-15 21:44:54.026  7734  7734 F DEBUG   :     x16 0000006d3b436010  x17 0000000000000000  x18 0000000000000000  x19 0000006e4b255480
03-15 21:44:54.026  7734  7734 F DEBUG   :     x20 0000006c7b9b85c0  x21 0000000000000003  x22 0000006c7b9b7dc0  x23 0000006c7b9b88c0
03-15 21:44:54.026  7734  7734 F DEBUG   :     x24 0000000000000000  x25 0000000000000000  x26 0000000000000028  x27 0000006dab2a0c30
03-15 21:44:54.026  7734  7734 F DEBUG   :     x28 0000000000000018  x29 0000006c7b9b7d50
03-15 21:44:54.026  7734  7734 F DEBUG   :     lr  0000000000008000  sp  0000006c7b9b7cc0  pc  0000006c72d44770  pst 0000000000000000
03-15 21:44:54.026  7734  7734 F DEBUG   : backtrace:
03-15 21:44:54.026  7734  7734 F DEBUG   :       #00 pc 00000000000c4770  /vendor/lib64/hw/vulkan.msm8998.so (A5xCommandBuffer::FinalizeDescriptors(A5xBaseAddressDesc*, unsigned int*, unsigned int*, unsigned int)+536)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #01 pc 00000000000bce44  /vendor/lib64/hw/vulkan.msm8998.so (A5xCommandBuffer::HwValidateState()+1156)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #02 pc 00000000000779e4  /vendor/lib64/hw/vulkan.msm8998.so (QglCommandBuffer::DrawIndexed(unsigned int, unsigned int, int, unsigned int, unsigned int)+220)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #03 pc 0000000002b0ea50  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #04 pc 0000000002b10844  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #05 pc 0000000002b11730  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #06 pc 0000000002a53bb0  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #07 pc 0000000002a5577c  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #08 pc 0000000002a4a280  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #09 pc 0000000002a4b638  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #10 pc 00000000029ef90c  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #11 pc 0000000000da2bc8  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #12 pc 0000000000d5d7a0  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so
03-15 21:44:54.026  7734  7734 F DEBUG   :       #13 pc 0000000000d72180  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/lib/arm64/libgodot_android.so (Java_org_godotengine_godot_GodotLib_step+208)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #14 pc 0000000000222244  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #15 pc 0000000000211608  /apex/com.android.art/lib64/libart.so (nterp_helper+152) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #16 pc 000000000019096c  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/oat/arm64/base.vdex (org.godotengine.godot.vulkan.VkRenderer.onVkDrawFrame+0)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #17 pc 00000000002124c4  /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #18 pc 000000000019120a  /data/app/~~K9R_Ex1lL_aAzZNpwkTO6g==/org.revengate.revengate-nukek6wTaXMSiUPB9x-xyQ==/oat/arm64/base.vdex (org.godotengine.godot.vulkan.VkThread.run+286)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #19 pc 0000000000218964  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #20 pc 0000000000284208  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+188) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #21 pc 000000000061fab0  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+460) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #22 pc 000000000066e674  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1184) (BuildId: 143d4d521718f1d1b0005e86eb8ae170)
03-15 21:44:54.026  7734  7734 F DEBUG   :       #23 pc 00000000000b1810  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: 6bfaf10f10e5ff343703efae2f1bdbdb)
03-15 21:44:54.027  7734  7734 F DEBUG   :       #24 pc 00000000000512f0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 6bfaf10f10e5ff343703efae2f1bdbdb)

I tried to do the same in this minimal project, but it’s working just fine with this one. Will link in a comment…

Device where I have the problem: Sony XZ1 Compact running Android 12.
Devise where I do not have the problem: Samsung Galaxy S10e running Android 12.

Anyone has any idea how I could get to the bottom of what my game is doing wrong that is causing the shader to crash while it seem to be running fine in the minimal project?

This is the minimal project that does not crash: Yannick Gingras / Shader Crash Repro · GitLab

The crash does not happen with the gl_compatibility renderer. My game is really low graphics, so I could definitely make it work with that renderer, but I would rather use some of the features of the regular renderer when possible. Is it possible to pick the renderer at startup time based on a config or do I have to make separate APKs for each rendeders?