[SOLVED] Failed to compile fragment shader - iPad

Hi! We are testing our application on iPad using Chrome (87.0.2480.77) and iPad OS 14.0.1 on an iPad (6th generation)

The scene starts to load, it completes, and the scene is just pure black, and the error logs state that:

ERROR Failed to compile fragment shader: 
'[]' : array constructor supported in GLSL ES 3.00 and above only
'[]' : first-class arrays (array initializer) supported in GLSL ES 3.00 and above only
'const' : cannot declare arrays of this qualifier
'=' : Invalid operation for arrays
'=' : cannot convert from 'const array[8] of 3-component vector to float' to 'const highp array[8] of 3-component vector of float'  

Is this with the latest release only or does this happen with older releases of the engine as well?

We have only tested with the latest so far.

I’m notifying the team internally about this. Can you please check against an older release such as 1.40.4 and 1.39.4?

Yes, will do in a second, we just ran into some other issues which I’m going to be creating a new thread about.

1 Like

please try on PC when launching from the Editor as well and select “Prefer WebGl 1”, you are likely to reproduce it this way as well.

And this should have a shader including the error in the console, which should make it easier to fix.

2 Likes

In the editor, running the current version, produces this exact issue when using WebGL 1

can you share the repro, or at least to whole shader including the errors from the console please.

It is public at the moment, for these very reasons. Here you go:

https://playcanvas.com/project/784241/overview/train-seats

this is the shader compile error:

ERROR: 0:35: '[]' : array constructor supported in GLSL ES 3.00 and above only
ERROR: 0:35: '[]' : first-class arrays (array initializer) supported in GLSL ES 3.00 and above only
ERROR: 0:35: 'const' : cannot declare arrays of this qualifier
ERROR: 0:35: '=' : Invalid operation for arrays
ERROR: 0:35: '=' : cannot convert from 'const array[8] of 3-component vector of float' to 'const highp array[8] of 3-component vector of float'

and it fails to compile your SSAO shader from “New Shader” file … I think that post effect is not compatible with WebGl 1? It’s not something we provide, so I’m not sure about it.

1 Like

I will try to remove it and see again. But afaik, I have that completely disabled. Would that still get compiled and cause errors?

Thank you for the input.

Try putting a breakpoint on this line to see if it executes, but likely yes.

        this.ssaoShader = new pc.Shader(graphicsDevice, {
1 Like

I have deleted the SSAO JS completely, as it is a pretty basic implementation, and really doesn’t add much to the screen. But that has fixed the issue completely. So thank you!

2 Likes

we’re working on a decent SSAO implementation at the moment, which should get released when done. Keep an eye on it!

1 Like