-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate uniforms shared between vertex and fragment programs on mediump-only devices #817
Comments
The suggested solution here is OK with me. |
Also mentioned on the forum. |
Note to self: this is only for uniforms, not varyings.
|
Potential future debugging tool: WEBGL_debug_shader_precision |
WEBGL_debug_shader_precision was rejected as an extension. |
@lilleyse I looked more at this. I think the right general-purpose approach is check if If not, extract the uniforms from For unit testing, use a custom vertex and fragment shader like this and we'll mock high precision to not be supported. |
What is the best way to mock high precision not being supported? |
To test for For mocking it, you could add a function to |
@kring Do you have a |
No I don't, sorry. The device mentioned in the original description belonged to AGI. It's entirely possible a software update since then has made the problem go away, though. |
Technically this is still a bug but almost all devices support If you change the code below to force the
cesium/Source/Renderer/ShaderSource.js Lines 237 to 245 in 680de81
|
The GLSL ES Spec (http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf) says:
So, on a device that only supports
mediump
precision in the fragment shader, it is not legal to declare a single uniform ashighp
in the vertex shader (the default) andmediump
in the fragment shader. One way to resolve this is to declare itmediump
everywhere, but this could cause artifacts in some situations. A safer solution is to duplicate the uniform, so the vertex shader gets ahighp
version and the fragment shader gets amediump
version. The Cesium renderer could do this automatically with a little bit of work.We saw this problem in Chrome on a Samsung Galaxy Note 10.1, which has a Mali-400MP GPU. On that device, the shader failed to link as a result of the mismatched precision of the
czm_viewport
uniform (and probably others).The text was updated successfully, but these errors were encountered: