Godot: Scene with animated mesh kill the app on Asus Zenfone 5 (2014) [GLES2]

Created on 23 Dec 2019  路  4Comments  路  Source: godotengine/godot

Godot version:
Godot 3.2 beta 4

OS/device including version:
Development:
Windows 10

Test:
Asus Zenfone 5 (2014)

Issue description:
When opening a scene with animated mesh (with skeleton and animation), the app crash.
This issue only happen on my Asus Zenfone 5 (2014), I tested on my other device it's not happen.
This is the logcat:
benchmark_3d_logcat.txt

Steps to reproduce:
Open the project below, export for Android on GLES2 beckend.
Play and enter scene that has animated mesh (1st, 2nd, or 3rd scene)
The app crash.

Minimal reproduction project:
Godot 3D Test.zip

bug 3.2 rendering

All 4 comments

From the log it appears it is crashing because the shader compilation is failing:

12-21 08:28:17.689: E/godot(5817): **ERROR**: SceneShaderGLES2: Fragment shader compilation failed:
12-21 08:28:17.689: E/godot(5817): Compile failed.
12-21 08:28:17.689: E/godot(5817): ERROR: 0:652: 'array syntax' : requires language version 4294967295
12-21 08:28:17.689: E/godot(5817): ERROR: main() function is missing.
12-21 08:28:17.689: E/godot(5817): ERROR: 2 compilation errors. No code generated.

It may well be one of your custom shaders, I'm not sure which because your minimum reproduction has several shaders. I don't know about the missing main but it appears these lines are giving a problem with the array syntax:

12-21 08:28:17.599: I/godot(5817): 651: #ifdef USE_LIGHTMAP_CAPTURE
12-21 08:28:17.599: I/godot(5817): 652: uniform mediump vec4[12] lightmap_captures;
12-21 08:28:17.599: I/godot(5817): 653: uniform bool lightmap_capture_sky;
12-21 08:28:17.599: I/godot(5817): 654: 
12-21 08:28:17.599: I/godot(5817): 655: #endif

It might need testing the glsl language available on the hardware and disabling this, maybe this array syntax is not in the spec for gles version 100.

@lawnjelly I've seen other reports of baked lighting not working on mobile, such as https://github.com/godotengine/godot-proposals/issues/326#issuecomment-568215963.

@lawnjelly I've seen other reports of baked lighting not working on mobile, such as godotengine/godot-proposals#326 (comment).

I'm guessing this is the lookup of the baked voxels. If you use a manual lightmap with a custom shader, you probably won't have this problem. However this is probably fixable in the shader, some hardware is picky about arrays afaik (and some have bugs). This is complaining about needing version -1 (as 32 bit uint) which maybe a roundabout way of saying it doesn't support it.

The spec here:
https://www.khronos.org/files/opengles_shading_language.pdf
Says

The following array indexing functionality must be supported:
Uniforms
Vertex Shaders : Any integer
Fragment Shaders : constant-index-expression

Given that the loop that accesses it here is constant when unrolled, it should (in theory) work. And I don't get why it flagging the error on declaration rather than use. With access to hardware that this fails on you could try some permutations, see what is causing the problem (maybe even unrolling the loop manually?). At worst you could presumably have 12 different uniforms rather than an array, but that's probably pretty inefficient.

This is probably overkill for some OpenGL ES 2 level hardware though, you could probably even get away with something far simpler like a single lookup for the whole object (maybe the original quake did this?). Especially as the whole point of using baked lightmaps in a lot of instances is to improve performance, there may be an argument for a simpler shader option. I think the voxel lookup had a large performance impact when I tested it, from memory.

Mind you I would find out what that other error about 'main missing' is first because the array error could be a red herring.

https://developer.qualcomm.com/forum/qdn-forums/mobile-technologies/mobile-gaming-graphics-optimization-adreno/27169

A few articles like this suggest unrolling the loop manually may be a possible solution. I have a feeling I've had a similar bug where unrolling the loop solved it.

PR https://github.com/godotengine/godot/pull/35178 fixes the shader compilation issue. But the shader compilation issue didn't cause a crash. It would be a good idea to test this again after #35178 is merged and see if we can get more info relating to the crash.

Was this page helpful?
0 / 5 - 0 ratings