Crash on older Android devices


#1

I have an old Nexus 7 with Android 5.1.1 and just found out, that my game crashes on it with the following error:

E/HXCPP (15726): Called from openfl.display.Stage::__createRenderer openfl/display/Stage.hx line 1097
E/HXCPP (15726): Called from openfl._internal.renderer.opengl.GLRenderer::new openfl/_internal/renderer/opengl/GLRenderer.hx line 66
E/HXCPP (15726): Called from openfl._internal.renderer.opengl.GLShaderManager::new openfl/_internal/renderer/opengl/GLShaderManager.hx line 29
E/HXCPP (15726): Called from openfl._internal.renderer.opengl.GLShaderManager::initShader openfl/_internal/renderer/opengl/GLShaderManager.hx line 43
E/HXCPP (15726): Called from openfl.display.Shader::__init openfl/display/Shader.hx line 265
E/HXCPP (15726): Called from openfl.display.Shader::__initGL openfl/display/Shader.hx line 305
E/HXCPP (15726): Called from lime.utils.GLUtils::createProgram lime/utils/GLUtils.hx line 56
E/HXCPP (15726): Called from lime.utils.Log::error lime/utils/Log.hx line 42
E/Exception(15726): [lime.utils.GLUtils] ERROR: Unable to initialize the shader program

Are there any way to make it work?


Segmentation fault on Galaxy S2
#2

Hmm, here is the shader code we have:

https://github.com/openfl/openfl/blob/develop/openfl/display/Shader.hx#L84-L159

It’s curious, though, it seems like it compiles both the vertex and fragment shaders fine, but cannot link it into a program :confused:

Perhaps you could try making this change:

(to get extra debug info)


#3

More details:

E/Exception( 6182): [lime.utils.GLUtils] ERROR: Unable to initialize the shader program
E/Exception( 6182):
E/Exception( 6182): L0007: Cannot find vertex shader varying for declared fragment shader varyingvColorMultipliers


#4

Does it make a difference if you take out the if statement here, and always set vColorMultipliers and vColorOffsets?

https://github.com/openfl/openfl/blob/develop/openfl/display/Shader.hx#L148-L153


#5

Didn’t help, I’m getting the same error message.


#6

Does it say varyingvColorMultipliers or varying vColorMultipliers?


#7

varyingvColorMultipliers


#8

Huh, I wonder if somehow it’s losing a space somewhere. Try adding another space in the shader, see if it shows something different?


#9

Or maybe this is related?

https://github.com/openfl/openfl/blob/develop/openfl/display/Shader.hx#L103


#10

I think, it’s something related to mat4 and/or Nexus 7:
https://www.google.ca/search?q=“Cannot+find+vertex+shader+varying+for+declared+fragment+shader”

One of the comments on GitHub:

It looks like the problem might be that Tegra2 can’t pass the mat4 this works fine if I change the shaders to construct the mat4 inside the frag shader this works fine. Although not quite as efficient.

Although Nexus 7 has Tegra 3.


#11

Im also dealing with this issue , theres is not any solution for this. ? i cannot run any haxe demo on my asus tf101 (also tegra incorporate) not even the game that i publish in google play a year ago. So the tegra base devices, will be dismiss from any openfl development ? lucky me.


#12

Ah hah, can you guys try this fix:

https://devtalk.nvidia.com/default/topic/524040/strange-gles-link-issue-under-android-4-2/

Change varying mat4 vColorMultipliers; to varying vec4 vColorMultipliers[4];

https://github.com/openfl/openfl/blob/develop/openfl/display/Shader.hx#L150


#13

Hi singmajesty

i forgot to mention

Im using openfl 6.5.3 , haxe compiler 3.4.4, neko 2.1.0 , lime tools 5.9.1, windows 8.1

I tried change the line code 150, in my openfl distribution this line appears at 136
i dont know if this is because the shader.hx that appears in github its very different to the default installed version anyway , here i share with you a list of attempts , that i try to fix this error,… spoiler NOTHING WORK


Attempt 01


So i replaced my default shader.hx with the github version, i compiled to neko target, works great,tried to compile to android using this version without any change, i get a suscessfull compilation but fails when i try to install the generate apk, it gives me the same error describes by pozirk

E/Exception( 6182): [lime.utils.GLUtils] ERROR: Unable to initialize the shader program
E/Exception( 6182):
E/Exception( 6182): L0007: Cannot find vertex shader varying for declared fragment shader varyingvColorMultipliers

In Abstract:
- change default shader.hx in openfl 6.5.3 by the current github version (2017-12-07)
i keep the code to see if theres any issue with the shader version that i have

- neko target, success.

- android target, build sucess apk, but error at runtime , "Cannot find vertex shader... "

Attempt 02


So i change the line 150 with varying mat4 vColorMultipliers; by the way i think you make a mistake here, saying “Change varying mat4 vColorMultipliers; to varying vec4 vColorMultipliers[4]”; its ot vec4 but mat4 instead right?

  • making this change i cant get a neko compilation :frowning: , but
  • in other side i can get a successfull android compilation , but im now having this errors

E/Exception(4167): [lime.utils.GLUtils] ERROR: Error compiling vertex shader
E/Exception(4167): (23) : error C7553: OpenGL array assignments require #version 120
E/Exception(4167): (23) : error C1035: assignment of incompatible types

In Abstract:
- change default shader.hx in openfl 6.5.3 by the current github version (2017-12-07)
i change the 150 line with varying mat4 vColorMultipliers[4]

- neko target, fail

- android target, build sucess apk, but error at runtime , 
      "OpenGL array assignments require #version 120"

Attempt 03


So i try to change the line 150 with this varying mat4[4] vColorMultipliers , following the --second post/first answer-- of this thread

  • making this change i cant get a neko compilation :frowning: , but
  • in other side i can get an successfull android compilation , with installing the apk im having almost the same error in attempt 02

E/Exception(5079): [lime.utils.GLUtils] ERROR: Error compiling vertex shader
E/Exception(5079): (7) : error C7551: OpenGL first class arrays require #version 120
E/Exception(5079): (21) : error C7553: OpenGL array assignments require #version 120
E/Exception(5079): (21) : error C1035: assignment of incompatible types

In Abstract:
- change default shader.hx in openfl 6.5.3 by the current github version (2017-12-07)
i change the 150 line with varying mat4[4] vColorMultipliers

- neko target, fails.

- android target, build sucess apk, but error at runtime\
       "OpenGL first class arrays require #version 120"

i also tried making this changes using the default shader.hx and nothing.

Im very tired, and i dont have any clue about what to do.


#14

I also change the 150 line with

varying vec4 vColorMultipliers[4] and also with

varying vec4[4] vColorMultipliers

still i having the error

E/Exception(5079): (21) : error C7553: OpenGL array assignments require #version 120


#15

Try this:


#16

With that openfl , Now it’s Working , thank you , thank you so much singmajesty

singmajesty but now, i have a question about graphic performance

i dont know why the performance of the animations of my project are more fluid in html5 in my tf101 , than with the native target, there is any explanation about it? or better yet a solution / fix / hack ?
i noticed this behavior , when i used bitmaps with png images with alpha,


#17

Are you testing the native target for Android, or do you mean the desktop native target? One difference is for the desktop is that CPU performance is better, and one difference for HTML5 vs. Windows is we default to 60 FPS / vsync on HTML5, but 30 FPS is the default for desktop (you can use <window fps="60" /> or change stage.frameRate to test another value)


#18

I’m not able to test this new update on my Nexus 7 at the moment, I will do it later.
Thank you for the fix, @singmajesty!


#19

If you have multiple devices, it would be awesome if you also had any idea if this affects performance negatively for devices that did support varying mat4


#20

So far I see no difference in performance, I’ll let you know if anything. :slight_smile: