- Add any Unicode character to the FP or VP shader (for example, add comment “// Привет!”) and it will not work in HTML5. Errors from the Chrome 72.0.3626.121 console:
WebGL: INVALID_VALUE: shaderSource: string not ASCII
WARNING:GRAPHICS: ERROR: 0:? : ‘’ : syntax error
I tried to find the cause of the error in the generated asm.js code. I found that because of the character length in Unicode, extra characters are added to the shader code:
function _glShaderSource(shader, count, string, length) {
var source = GL.getSource(shader, count, string, length);
// ^^^ variable "source" will contain random characters from memory at the end.
GLctx.shaderSource(GL.shaders[shader], source)
}
- It would be great if Defold could check errors in HTML5 debug build and output the invalid shader code.