Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using SoftBody on mobile #78715

Closed
dqdthanhthanh opened this issue Jun 26, 2023 · 13 comments · Fixed by #84852
Closed

Crash when using SoftBody on mobile #78715

dqdthanhthanh opened this issue Jun 26, 2023 · 13 comments · Fixed by #84852

Comments

@dqdthanhthanh
Copy link

dqdthanhthanh commented Jun 26, 2023

Godot version

4.1 beta 3, 4.1 beta 1

System information

Windows 10 - 4.1 beta 3 - Android 12

Issue description

Crash when using SoftBody on android mobile.

Steps to reproduce

  • Simple scene setup using a plane softbody, camera.
  • Export to android mobile.
  • Immediate crash when open the app.

Minimal reproduction project

SoftbodyMobileTest.zip

@AThousandShips
Copy link
Member

Can you confirm this crash doesn't happen when running on some other platform after export?

@dqdthanhthanh
Copy link
Author

dqdthanhthanh commented Jun 26, 2023

Can you confirm this crash doesn't happen when running on some other platform after export?

i have export on mac, windows and no problem. Also works fine on html5.

@YuriSizov
Copy link
Contributor

Did you experience the same issue with any version of 4.0?

@dqdthanhthanh
Copy link
Author

Did you experience the same issue with any version of 4.0?

I just tried with godot on steam (export to android mobile), crash immediately if there's softbody in the scene.

@YuriSizov
Copy link
Contributor

Thanks, at least this means it's not a recent regression.

@YuriSizov YuriSizov added this to the 4.2 milestone Jun 26, 2023
@Alex2782
Copy link
Member

Alex2782 commented Nov 4, 2023

GodotSoftBody3D::create_from_trimesh
USER ERROR: FATAL: Index p_index = 16256 is out of bounds (count = 36).
https://github.com/godotengine/godot/blob/master/core/templates/local_vector.h#L161

Android Studio Logcat. My master branch, updated a few days ago. Also crashes with Godot 4.1.3.

2023-11-04 01:41:09.004  9304-9388  godot                   com.godot.game                       E  USER ERROR: FATAL: Index p_index = 16256 is out of bounds (count = 36).
2023-11-04 01:41:09.004  9304-9388  godot                   com.godot.game                       E     at: operator[] (./core/templates/local_vector.h:161)
2023-11-04 01:41:09.004  9304-9388  libc                    com.godot.game                       A  Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x77e6541738 in tid 9388 (VkThread), pid 9304 (com.godot.game)
2023-11-04 01:41:09.305 10399-10399 DEBUG                   pid-10399                            A  Cmdline: com.godot.game
2023-11-04 01:41:09.305 10399-10399 DEBUG                   pid-10399                            A  pid: 9304, tid: 9388, name: VkThread  >>> com.godot.game <<<
2023-11-04 01:41:09.305 10399-10399 DEBUG                   pid-10399                            A        #00 pc 0000000001c88738  /data/app/~~OLZfBYu-2oJLJqYnEgpn1Q==/com.godot.game-6JxgXKjppRm1W-BVn63KJg==/lib/arm64/libgodot_android.so (LocalVector<unsigned int, unsigned int, false, false>::operator[](unsigned int)+144)
2023-11-04 01:41:09.305 10399-10399 DEBUG                   pid-10399                            A        #01 pc 0000000003a44c2c  /data/app/~~OLZfBYu-2oJLJqYnEgpn1Q==/com.godot.game-6JxgXKjppRm1W-BVn63KJg==/lib/arm64/libgodot_android.so (GodotSoftBody3D::create_from_trimesh(Vector<int> const&, Vector<Vector3> const&)+728)
2023-11-04 01:41:09.305 10399-10399 DEBUG                   pid-10399                            A        #02 pc 0000000003a44808  /data/app/~~OLZfBYu-2oJLJqYnEgpn1Q==/com.godot.game-6JxgXKjppRm1W-BVn63KJg==/lib/arm64/libgodot_android.so (GodotSoftBody3D::set_mesh(RID)+260)
2023-11-04 01:41:09.305 10399-10399 DEBUG                   pid-10399                            A        #03 pc 0000000003a0bcd8  /data/app/~~OLZfBYu-2oJLJqYnEgpn1Q==/com.godot.game-6JxgXKjppRm1W-BVn63KJg==/lib/arm64/libgodot_android.so (GodotPhysicsServer3D::soft_body_set_mesh(RID, RID)+132)
2023-11-04 01:41:09.306 10399-10399 DEBUG                   pid-10399                            A        #04 pc 000000000387cd88  /data/app/~~OLZfBYu-2oJLJqYnEgpn1Q==/com.godot.game-6JxgXKjppRm1W-BVn63KJg==/lib/arm64/libgodot_android.so (PhysicsServer3DWrapMT::soft_body_set_mesh(RID, RID)+192)

Can anyone do anything with it yet?

Before the crash, some `AdrenoVK` errors are also displayed
2023-11-04 01:41:07.851  9304-9388  AdrenoVK-0              com.godot.game                       I  ===== BEGIN DUMP OF OVERRIDDEN SETTINGS =====
2023-11-04 01:41:07.851  9304-9388  AdrenoVK-0              com.godot.game                       I  ===== END DUMP OF OVERRIDDEN SETTINGS =====
2023-11-04 01:41:07.851  9304-9388  AdrenoVK-0              com.godot.game                       I  QUALCOMM build          : 193b2ee, I593c16c433
                                                                                                    Build Date              : 10/07/21
                                                                                                    Shader Compiler Version : EV031.32.02.10
                                                                                                    Local Branch            : Test-lib-SR05432264
                                                                                                    Remote Branch           : 
                                                                                                    Remote Branch           : 
                                                                                                    Reconstruct Branch      : 
2023-11-04 01:41:07.851  9304-9388  AdrenoVK-0              com.godot.game                       I  Build Config            : S P 10.0.5 AArch64
2023-11-04 01:41:07.851  9304-9388  AdrenoVK-0              com.godot.game                       I  Driver Path             : /vendor/lib64/hw/vulkan.adreno.so
2023-11-04 01:41:07.854  9304-9388  godot                   com.godot.game                       I  Vulkan API 1.1.128 - Forward Mobile - Using Vulkan Device #0: Qualcomm - Adreno (TM) 650
2023-11-04 01:41:07.856  9304-9388  qdgralloc               com.godot.game                       E  GetGpuPixelFormat: No map for format: 0x38
2023-11-04 01:41:07.856  9304-9388  AdrenoUtils             com.godot.game                       E  <validate_memory_layout_input_parmas:1973>: Unknown Format 0
2023-11-04 01:41:07.856  9304-9388  AdrenoUtils             com.godot.game                       E  <adreno_init_memory_layout:4706>: Memory Layout input parameter validation failed!
2023-11-04 01:41:07.856  9304-9388  qdgralloc               com.godot.game                       E  GetGpuResourceSizeAndDimensions Graphics metadata init failed
2023-11-04 01:41:07.856  9304-9388  Gralloc4                com.godot.game                       E  isSupported(1, 1, 56, 1, ...) failed with 1
2023-11-04 01:41:07.856  9304-9388  GraphicBufferAllocator  com.godot.game                       E  Failed to allocate (4 x 4) layerCount 1 format 56 usage b00: 1
2023-11-04 01:41:07.856  9304-9388  AHardwareBuffer         com.godot.game                       E  GraphicBuffer(w=4, h=4, lc=1) failed (Unknown error -1), handle=0x0
2023-11-04 01:41:07.856  9304-9388  qdgralloc               com.godot.game                       E  GetGpuPixelFormat: No map for format: 0x38
2023-11-04 01:41:07.856  9304-9388  AdrenoUtils             com.godot.game                       E  <validate_memory_layout_input_parmas:1973>: Unknown Format 0
2023-11-04 01:41:07.856  9304-9388  AdrenoUtils             com.godot.game                       E  <adreno_init_memory_layout:4706>: Memory Layout input parameter validation failed!
2023-11-04 01:41:07.856  9304-9388  qdgralloc               com.godot.game                       E  GetGpuResourceSizeAndDimensions Graphics metadata init failed
2023-11-04 01:41:07.856  9304-9388  Gralloc4                com.godot.game                       E  isSupported(1, 1, 56, 1, ...) failed with 1
2023-11-04 01:41:07.857  9304-9388  GraphicBufferAllocator  com.godot.game                       E  Failed to allocate (4 x 4) layerCount 1 format 56 usage b00: 1
2023-11-04 01:41:07.857  9304-9388  AHardwareBuffer         com.godot.game                       E  GraphicBuffer(w=4, h=4, lc=1) failed (Unknown error -1), handle=0x0

@Calinou
Copy link
Member

Calinou commented Nov 4, 2023

This may be related to #80371.

@Alex2782

This comment was marked as outdated.

@Alex2782
Copy link
Member

Alex2782 commented Nov 5, 2023

The problem could be identical to: #80371

I think already RS::SurfaceData MeshStorage::mesh_get_surface returns the data incorrectly on Android.

Executing mesh_surface_get_arrays in a loop changes the SurfaceData structure on Android. On the Mac, the structure remains the same.

image

In this example, index_data was first overwritten with attrib_data under Android.
Then (2nd pass in the loop) attrib_data and index_data were overwritten with vertex_data.

Screen-2023-11-05-021817.mp4

@Alex2782
Copy link
Member

Alex2782 commented Nov 5, 2023

maybe also #75599

@dqdthanhthanh
Copy link
Author

Runs normally on iPhone 11. Still crashes on Android. Using godot 4.1.3

@Alex2782

This comment was marked as outdated.

@Alex2782
Copy link
Member

I may have a solution, first I'll check other problems to see if they are also fixed.
6a0fc73

google-hellovk -> if flag VK_MEMORY_PROPERTY_HOST_COHERENT_BIT is passed, then there are no more problems with the buffers. In the VMA-Lib VMA_MEMORY_USAGE_CPU_ONLY

Screen_recording_20231113_010916.mp4

@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Nov 15, 2023
@akien-mga akien-mga changed the title 4.1 Crash when using SoftBody on mobile Crash when using SoftBody on mobile Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants