godot: Strange bug with 3 sprites, where one of them uses gdshader - Android 10

Godot version

4.0, 4.1, 4.1.1

System information

Godot v4.1.1.stable (bd6af8e0e) - Fedora Linux 37 (Workstation Edition) - Vulkan (Mobile) - integrated Intel® Graphics (ADL GT2) () - 12th Gen Intel® Core™ i5-12500H (16 Threads)

Issue description

Hi guys, I am porting circle android jump game from kids can code tutorial using vulkan renderer. I am using an old phone Xiaomi mi a2 (Android 10, it support vulkan 1.0 and gles3.2) I found a strange bug, where I am rendering 3 sprites, two sprites use png, third use png with gdshader. Tested situations:

  1. When I hide one of them (nvm which one) everything is working. So, in this case, if there is one sprite with png, and a second with gdshader, everything is working.

  2. When I remove gdshader from the sprite, everything is working.

  3. When I remove gdshader, but add more sprites, everything is working.

I will send github repo to see details.

I did tests on other phones, like moto g5(android 12) and samsung a52(android 12), and on pc as well, and everything is working. It’s working in compatibility renderer!

logcat: https://pastebin.com/Z8H5tDUQ

Currently, I am trying to build editor and export a template with debugging symbols to find the line where it’s crashing, but I found nothing.

I am open to any suggestions to fix this error because it has very unpredictable behavior.

Steps to reproduce

  1. Create circle scene, add sprite, and add png.
  2. Create jumper scene, add sprite, add png and add gdshader on that sprite:
shader_type canvas_item;

uniform vec4 color : source_color;

void fragment() {
	COLOR .rgb = color.rgb;
}
  1. Create main scene, where you add one jumper scene, and two circle scenes.

Minimal reproduction project

I removed all unnecessary files. https://github.com/marko995/CircleJumpGodot4

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 44 (25 by maintainers)

Most upvoted comments

I will release a debug APK for it soon, last I checked OpenGL ES3. I found some debug settings in the Godot sources, I still have to try if this is also possible with Vulkan.

@Alex2782 when i press compute once it works but if i press 25 times the app crashes. logcat: https://pastebin.com/fYeKr2c9

But when I pressed Add ShaderMaterial first (or after compute), app crashed instantly. logcat: https://pastebin.com/SFZmHzKT

@Alex2782 crash happens because of this line: uniform vec4 color : source_color;

when I don’t use it, works fine

The issue is present on 4.1.1.stable and on v4.2.dev2.official [da81ca62a]; 3.5.2 works as expected.

I experience a similar issue on Sony Xperia XZ1 Compact running Android 11. I narrowed down the problem to the uniform feature. If I hardcode the value, the game no longer crashes.

Next week I’ll try to add debug_callback. I can test 5 x per day for free at Firebase on real devices, there are also a lot of virtual ones, which are probably unsuitable because of software renderer.

Firebase - Test Lab has also Mi A2 Lite: full logs (search for 22258 pid)

I have tried with Validation Layer, but I can’t see any new useful information yet.

01-06 19:23:09.259: I/godot(22258): _on_timer_timeout
......
01-06 19:23:09.532: I/godot(22258): Shader loaded in 273 ms
......
01-06 19:23:09.587: F/libc(22258): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 22746 (VkThread), pid 22258 (com.godot.game)
......
01-06 19:23:09.833: F/DEBUG(23682): ABI: 'arm64'
01-06 19:23:09.835: F/DEBUG(23682): Timestamp: 2024-01-06 19:23:09-0800
01-06 19:23:09.835: F/DEBUG(23682): pid: 22258, tid: 22746, name: VkThread  >>> com.godot.game <<<
01-06 19:23:09.835: F/DEBUG(23682): uid: 10160
01-06 19:23:09.835: F/DEBUG(23682): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
01-06 19:23:09.835: F/DEBUG(23682): Cause: null pointer dereference
01-06 19:23:09.835: F/DEBUG(23682):     x0  0000000000000000  x1  0000000000000003  x2  0000007810966e80  x3  000000780f7b3058
01-06 19:23:09.836: F/DEBUG(23682):     x4  000000783cdb2000  x5  0000000000000000  x6  0000000000000000  x7  0000000000000001
01-06 19:23:09.836: F/DEBUG(23682):     x8  0000000000000002  x9  0000000000000001  x10 0000000000000001  x11 0000000000000004
01-06 19:23:09.836: F/DEBUG(23682):     x12 00000078156bbef0  x13 0000000000000000  x14 0000000000000000  x15 0000000000000002
01-06 19:23:09.836: F/DEBUG(23682):     x16 000000783d62eef8  x17 00000078156db800  x18 00000078204d2000  x19 00000078156db800
01-06 19:23:09.836: F/DEBUG(23682):     x20 0000007810966e80  x21 000000789b174d10  x22 0000000000000000  x23 000000789b174a10
01-06 19:23:09.836: F/DEBUG(23682):     x24 0000000000000001  x25 000000780f03e100  x26 0000000000000028  x27 0000007843eb8580
01-06 19:23:09.836: F/DEBUG(23682):     x28 0000000000000000  x29 000000789b177b70
01-06 19:23:09.836: F/DEBUG(23682):     sp  000000789b1740f0  lr  000000789b174a10  pc  00000078195d0004
01-06 19:23:09.829: W/Studio:PollNet(21316): type=1400 audit(0.0:4593): avc: denied { read } for name="stats" dev="proc" ino=4026532884 scontext=u:r:shell:s0 tcontext=u:object_r:proc_qtaguid_stat:s0 tclass=file permissive=0
01-06 19:23:09.844: F/DEBUG(23682): backtrace:
01-06 19:23:09.844: F/DEBUG(23682):       #00 pc 00000000000f5004  /vendor/lib64/hw/vulkan.msm8953.so (BuildId: 4059f276877a7a61cc16b085624608be)
01-06 19:23:09.844: F/DEBUG(23682):       #01 pc 00000000000a0468  /vendor/lib64/hw/vulkan.msm8953.so (qglinternal::vkCmdDrawIndexed(VkCommandBuffer_T*, unsigned int, unsigned int, unsigned int, int, unsigned int)+232) (BuildId: 4059f276877a7a61cc16b085624608be)
01-06 19:23:09.844: F/DEBUG(23682):       #02 pc 00000000019fd5e0  /data/app/com.godot.game-KJNnqiAlqU7OqrGjjechwQ==/lib/arm64/libVkLayer_khronos_validation.so (DispatchCmdDrawIndexed(VkCommandBuffer_T*, unsigned int, unsigned int, unsigned int, int, unsigned int)+156) (BuildId: 74b81aeab8816fc078cb99b8199b6b561a30c09b)
01-06 19:23:09.844: F/DEBUG(23682):       #03 pc 00000000017e8e94  /data/app/com.godot.game-KJNnqiAlqU7OqrGjjechwQ==/lib/arm64/libVkLayer_khronos_validation.so (vulkan_layer_chassis::CmdDrawIndexed(VkCommandBuffer_T*, unsigned int, unsigned int, unsigned int, int, unsigned int)+452) (BuildId: 74b81aeab8816fc078cb99b8199b6b561a30c09b)

ShaderTest.zip

@marko995: if you find the time at some point, please try it out. Are the crashes reproducible? I need a project where I can debug the functions at the push of a button.

  • button “Compute” is this example: compute_shaders
  • button “Add ShaderMaterial” adds dynamically via GdScript the file global_color_canvas_item.gdshader -> global uniform vec4 global_color;

Bildschirmfoto 2023-12-29 um 19 42 44

On my Samsung Galaxy Tab A (2016) SM-T580, there are no problems with the color shaders, but with the compute shader (output = input).

Bildschirmfoto 2023-12-29 um 19 40 16

doesn’t work:

shader_type canvas_item;

uniform vec4 color : source_color;

void fragment() {
	COLOR .rgb = color.rgb;
}

it works:

shader_type canvas_item;


void fragment() {
	COLOR.rgb = vec3(1.0, 0.0, 0.0);
}

@Alex2782 same link https://github.com/marko995/CircleJumpGodot4

ok thanks, 2 days ago Github showed 404 error (not found), today it works again

For questions regarding godot-compilation I suggest to join the contributors chat at https://chat.godotengine.org/ It is difficult to discuss these things here on Github.