I notice these warnings in the browser’s JavaScript debugger,
WARNING: Shader Unsupported: ‘Hidden/Dof/DX11Dof’ - Setting to default shader.
WARNING: Shader Unsupported: ‘Hidden/SSAO’ - Setting to default shader.
Expected? The GlobalFog shader had these shader compile errors,
------- GLSL error:
ERROR: 0:34: ‘[ ]’ : Index expression must be constant
ERROR: 0:35: ‘[ ]’ : Index expression must be constant
ERROR: 0:36: ‘[ ]’ : Index expression must be constant
ERROR: 0:37: ‘[ ]’ : Index expression must be constant
Which I fixed by re-writing the array indexing to use constants in the shader code, but this too then gets the warning,
WARNING: Shader Unsupported: ‘Hidden/GlobalFog’ - Setting to default shader.
Is this a limitation of WebGL’s implementation of GLSL? I’m a n00b when it comes to this stuff.
Yes, WebGL has enforces some restrictions on the GLSL language which are not enforced in other GLES implementations (like not allowing dynamic access into arrays, as you have seen above). In some cases it is possibly to work around this by changing shader code. If you fixed those indexes, do you still see any other compiler errors?
Weird, now with the semantics fix to the GlobalFog image effect it works fine on WebGL. The SSAO and DOF image effects still report ‘Shader Unsupported’.
The change to ImageEffects/Shaders/GlobalFog.shader was simply to convert the non-constant index to a constant ones in the range 0…3.
Diff below.
- o.interpolatedRay = _FrustumCornersWS[(int)index];
- if (0 == (int)index)
- o.interpolatedRay = _FrustumCornersWS[0];
- else if (1 == (int)index)
- o.interpolatedRay = _FrustumCornersWS[1];
- else if (2 == (int)index)
- o.interpolatedRay = _FrustumCornersWS[2];
- else
- o.interpolatedRay = _FrustumCornersWS[3];
Interestingly even though I see for the DOF shader at player runtime,
WARNING: Shader Unsupported: ‘Hidden/Dof/DX11Dof’ - Setting to default shader.
There still exists a depth of field effect. Unsure which shader it is referring to as the ‘default shader’ that is giving this effect on GLES.
Secondly, if I change the shader model target of the SSAO shader from 3.0 to 2.0 such that it is supported by Open GL ES 2.0 I see it working ‘fine’, i.e. ambient occlusion effects are visible in the render. So does the SSAO shader really need to target shader model 3.0 when it ‘appears’ to work with shader model 2.0 with no compiler errors.
So in summary,
- Global Fog seems to work with semantic fix.
- SSAO seems to work with targeting shader model 2.0 instead of 3.0.
- DOF (DX11) gets rejected as unsupported and yet somehow there’s an DOF effect being rendered. Unknown which.
This is all WebGL in Chrome 64-bit on Mac OS X 10.10.