gltf with LINE primitives crashes on Android/iOS
- Dominant language
- C++
- Stars
- 20.5k
- Forks
- 2.3k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 74
Description
**Describe the bug**
The following gltf model will crash the 1.62.0 gltf-viewer on Android (and cause similar crash on iOS in 1.58.0 with the Metal backend)
https://drive.google.com/file/d/1wD8EJ_jszyIMnnnFgyVnIE7EDZ-6fqGc/view?usp=sharing
Specifically, this is a single quad with no faces, only vertices/edges. This has been exported from Blender (create a quad, delete only faces, export as gltf and check the "Loose Edges" checkbox under "Mesh" options when exporting).
```
(base) nickfisher@Nicks-Mac-mini Downloads % gltf-transform inspect /Volumes/T7/Downloads/DP3567-rv1.glb
OVERVIEW
────────────────────────────────────────────
┌────────────────────┬──────────────────────────────────┐
│ key │ value │
├────────────────────┼──────────────────────────────────┤
│ version │ 2.0 │
├────────────────────┼──────────────────────────────────┤
│ generator │ Khronos glTF Blender I/O v4.4.55 │
├────────────────────┼──────────────────────────────────┤
│ extensionsUsed │ none │
├────────────────────┼──────────────────────────────────┤
│ extensionsRequired │ none │
└────────────────────┴──────────────────────────────────┘
SCENES
────────────────────────────────────────────
┌───┬───────┬──────────┬───────────┬─────────┬────────────────────┬───────────────────┬────────────────────────┐
│ # │ name │ rootName │ bboxMin │ bboxMax │ renderVertexCount¹ │ uploadVertexCount │ uploadNaiveVertexCount │
├───┼───────┼──────────┼───────────┼─────────┼────────────────────┼───────────────────┼────────────────────────┤
│ 0 │ Scene │ Plane │ -1, 0, -1 │ 1, 0, 1 │ 8 │ 4 │ 4 │
└───┴───────┴──────────┴───────────┴─────────┴────────────────────┴───────────────────┴────────────────────────┘
¹ Expected number of vertices processed by the vertex shader for one render
pass, without considering the vertex cache.
² Expected number of vertices uploaded to GPU, assuming each Accessor
is uploaded only once. Actual number uploaded may be higher,
dependent on the implementation and vertex buffer layout.
³ Expected number of vertices uploaded to GPU, assuming each Primitive
is uploaded once, duplicating vertex attributes shared among Primitives.
MESHES
────────────────────────────────────────────
┌───┬───────┬───────┬────────────────┬──────────────┬──────────┬─────────┬──────────────┬───────────┬──────────┐
│ # │ name │ mode │ meshPrimitives │ glPrimitives │ vertices │ indices │ attributes │ instances │ size¹ │
├───┼───────┼───────┼────────────────┼──────────────┼──────────┼─────────┼──────────────┼───────────┼──────────┤
│ 0 │ Plane │ LINES │ 1 │ 4 │ 4 │ u16 │ POSITION:f32 │ 1 │ 64 Bytes │
└───┴───────┴───────┴────────────────┴──────────────┴──────────┴─────────┴──────────────┴───────────┴──────────┘
⁴ size estimates GPU memory required by a mesh, in isolation. If accessors are
shared by other mesh primitives, but the meshes themselves are not reused, then
the sum of all mesh sizes will overestimate the asset's total size. See "dedup".
MATERIALS
────────────────────────────────────────────
No materials found.
TEXTURES
────────────────────────────────────────────
No textures found.
ANIMATIONS
────────────────────────────────────────────
No animations found.
```
gltf_validator indicates this is a valid gltf:
```
(base) nickfisher@Nicks-Mac-mini Downloads % ./gltf_validator -o /Volumes/T7/Downloads/DP3567-rv1.glb
/Volumes/T7/Downloads/DP3567-rv1.glb
Errors: 0, Warnings: 0, Infos: 0, Hints: 0
Time: 18ms
{
"uri": "../../../Volumes/T7/Downloads/DP3567-rv1.glb",
"mimeType": "model/gltf-binary",
"validatorVersion": "2.0.0-dev.3.10",
"issues": {
"numErrors": 0,
"numWarnings": 0,
"numInfos": 0,
"numHints": 0,
"messages": [],
"truncated": false
},
"info": {
"version": "2.0",
"generator": "Khronos glTF Blender I/O v4.4.55",
"resources": [
{
"pointer": "/buffers/0",
"mimeType": "application/gltf-buffer",
"storage": "glb",
"byteLength": 64
}
],
"animationCount": 0,
"materialCount": 0,
"hasMorphTargets": false,
"hasSkins": false,
"hasTextures": false,
"hasDefaultScene": true,
"drawCallCount": 1,
"totalVertexCount": 4,
"totalTriangleCount": 0,
"maxUVs": 0,
"maxInfluences": 0,
"maxAttributes": 1
}
}
```
**To Reproduce**
Steps to reproduce the behavior:
1. Connect physical Android device to host machine (I'm using OPPO A17/Android 12)
2. Install latest gltf-viewer apk with `adb install`
3. Go to https://google.github.io/filament/remote and set up adb forwarding
4. Drag/drop the glb file above
5. App will crash
Similar result with a custom viewer using Filament 1.58.0 on an iPhone 11/iOS 17.6.1 with Metal backend (app does not always crash, but nothing renders (including skybox) and the console shows the following:
`Execution of the command buffer was aborted due to an error during execution. Caused GPU Address Fault Error (0000000b:kIOGPUCommandBufferCallbackErrorPageFault)`
This does not happen on the current Filament web viewer or our custom viewer on macOS with Metal backend.
**Expected behavior**
Quad should render as LINES as can be seen in https://sandbox.babylonjs.com https://gltf-viewer.donmccurdy.com, the Filament web viewer at https://google.github.io/filament/viewer/ and our own custom viewer (Filament v1.58.0) on macOS:
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Logs**
Android:
```
07-10 11:19:27.604 1736 1834 W System : A resource failed to call release.
07-10 11:19:27.611 24974 24974 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-10 11:19:27.611 24974 24974 F DEBUG : Build fingerprint: 'OPPO/CPH2477T2/OP56F5:12/SP1A.210812.016/S.202503191549:user/release-keys'
07-10 11:19:27.611 24974 24974 F DEBUG : Revision: '0'
07-10 11:19:27.611 24974 24974 F DEBUG : ABI: 'arm64'
07-10 11:19:27.611 24974 24974 F DEBUG : Timestamp: 2025-07-10 11:19:27.164508850+0800
07-10 11:19:27.611 24974 24974 F DEBUG : Process uptime: 0s
07-10 11:19:27.611 24974 24974 F DEBUG : Cmdline: com.google.android.filament.gltf
07-10 11:19:27.611 24974 24974 F DEBUG : pid: 24782, tid: 24809, name: FEngine::loop >>> com.google.android.filament.gltf <<<
07-10 11:19:27.611 24974 24974 F DEBUG : uid: 10482
07-10 11:19:27.611 24974 24974 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
07-10 11:19:27.611 24974 24974 F DEBUG : Cause: null pointer dereference
07-10 11:19:27.611 24974 24974 F DEBUG : x0 0000000000000000 x1 0000007e0e5640c0 x2 0000000000000008 x3 0000000000000001
07-10 11:19:27.611 24974 24974 F DEBUG : x4 b400007e8f727800 x5 0000000000000000 x6 0000000000000000 x7 0000000000000000
07-10 11:19:27.611 24974 24974 F DEBUG : x8 0000000000000000 x9 0000000000000001 x10 0000007e0e5640c0 x11 b400007e8f72e278
07-10 11:19:27.611 24974 24974 F DEBUG : x12 b400007e8f72ecc8 x13 0000000000000005 x14 b400007e8f72e8a8 x15 0000000000000000
07-10 11:19:27.611 24974 24974 F DEBUG : x16 b400007dfa797380 x17 0000000000000000 x18 0000007e10606000 x19 b400007e8f727800
07-10 11:19:27.611 24974 24974 F DEBUG : x20 b400007e8f72ed50 x21 000000000000000b x22 0000007e111017f8 x23 0000007e11101874
07-10 11:19:27.611 24974 24974 F DEBUG : x24 0000000000000e9a x25 b400007e8f72e7a0 x26 0000000000000001 x27 0000007e111019e8
07-10 11:19:27.611 24974 24974 F DEBUG : x28 b400007e8f6752c0 x29 0000007e111018b0
07-10 11:19:27.611 24974 24974 F DEBUG : lr 0000007e73af0f88 sp 0000007e111017f0 pc 0000000000000000 pst 0000000080000000
07-10 11:19:27.611 24974 24974 F DEBUG : backtrace:
07-10 11:19:27.611 24974 24974 F DEBUG : #00 pc 0000000000000000
07-10 11:19:27.611 24974 24974 F DEBUG : #01 pc 00000000000b3f84 /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: 50564d5a9ec50c3916325e7809dff705)
07-10 11:19:27.611 24974 24974 F DEBUG : #02 pc 00000000000b5918 /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: 50564d5a9ec50c3916325e7809dff705)
07-10 11:19:27.611 24974 24974 F DEBUG : #03 pc 00000000000b4b90 /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: 50564d5a9ec50c3916325e7809dff705)
07-10 11:19:27.611 24974 24974 F DEBUG : #04 pc 00000000000b7a78 /vendor/lib64/egl/libGLESv2_mtk.so (glDrawElementsInstanced+132) (BuildId: 50564d5a9ec50c3916325e7809dff705)
07-10 11:19:27.611 24974 24974 F DEBUG : #05 pc 00000000001d1b50 /data/app/~~L7Mde-wsmUk3ms8-ypllPg==/com.google.android.filament.gltf-Ujgvz7FzX7-8_r8yAATh6Q==/lib/arm64/libfilament-jni.so (std::__ndk1::__function::__func, void ()>::operator()()+48) (BuildId: a0faf8ec72c94fc8cb50bcb6589fbf712c22309f)
```
**Smartphone (please complete the following information):**
OPPO A17/Android 12
iPhone 11/iOS 17.6.1
**Additional context**
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.