This morning there was a new chrome update 31.0.1650.48 after which none of my programs are working. It is logging some warnings in the console like
WebGL: INVALID_VALUE: getUniformLocation: no object or object deleted
cocos2d: ERROR: Failed to link program: [object WebGLProgram]
WebGL: INVALID_OPERATION: drawArrays: attribs not setup correctly
Anyone else facing these issues? I am checking this on Mac. Is it working for anyone with chrome v31 either mac or windows?
I found the reason that “Uniforms with the same name but different type/precision”
The problem is been caused by this code in shaders/CCGLProgram.js:
var preStr = (type == this._glContext.VERTEX_SHADER) ? “precision highp float;” : “precision mediump float;”;
We can be modify “mediump” to “highp”, then it can work.
I found the reason that “Uniforms with the same name but different type/precision”
>
The problem is been caused by this code in shaders/CCGLProgram.js:
var preStr = (type == this._glContext.VERTEX_SHADER) ? “precision highp float;
” : “precision mediump float;
”;
>
We can be modify “mediump” to “highp”, then it can work.
Thank you, this worked for me! Was this caused by cocos2dx or chrome? And with this question what I really mean is, should I be worried by another future Chrome update?
This problem is caused by chrome 31, chrome 31 changes its precision checking. Its error information is “Uniforms with the same name but different type/precision”,
We set the float’s precision to “highp” in vertex shader, because of high precision on position, while set the float’s precision to “mediump” in fragment shader, because of better performance. This setup works well on OpenGL , other browser and chrome before v31.