glslEditor
glslEditor copied to clipboard
The editor crashes when dividing uniforms by zero...
...And setting gl_FragColor
to the result: gl_FragColor = vec4(u_resolution.x / 0.0);
Console output:
gl.js:144
Error in program linking:
C:\fakepath(43,33-77): warning X4008: floating point division by zero
C:\fakepath(45,34-64): warning X4008: floating point division by zero
C:\fakepath(46,22-52): warning X4008: floating point division by zero
C:\fakepath(46,22-52): error X4579: NaN and infinity literals not allowed by shader model
Warning: D3D shader compilation failed with default flags. (ps_3_0)
Retrying with avoid flow control
C:\fakepath(43,33-77): warning X4008: floating point division by zero
C:\fakepath(45,34-64): warning X4008: floating point division by zero
C:\fakepath(46,22-52): warning X4008: floating point division by zero
C:\fakepath(46,22-52): error X4579: NaN and infinity literals not allowed by shader model
Warning: D3D shader compilation failed with avoid flow control flags. (ps_3_0)
Retrying with prefer flow control
C:\fakepath(43,33-77): warning X4008: floating point division by zero
C:\fakepath(45,34-64): warning X4008: floating point division by zero
C:\fakepath(46,22-52): warning X4008: floating point division by zero
C:\fakepath(46,22-52): error X4579: NaN and infinity literals not allowed by shader model
Warning: D3D shader compilation failed with prefer flow control flags. (ps_3_0)
Failed to create D3D shaders.
GlslCanvas.js:385
Uncaught TypeError: Failed to execute 'getUniformLocation' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLProgram'.
at GlslCanvas.uniform (GlslCanvas.js:385)
at GlslCanvas.render (GlslCanvas.js:458)
at RenderLoop (GlslCanvas.js:156)
Surprisingly, gl_FragColor = vec4(500.0 / 0.0);
doesn't cause the error.
P.S. editor.thebookofshaders.com is dead
Seams like a WebGL issue. http://editor.thebookofshaders.com is probably trying to reload the previous code you where working on, the one that have the error. Try cleaning your cache and cookies.
Would you ever fix this issue? It also affects shaders on The Book of Shaders, which is kind of annoying. If you mistype something, you often don't even know it, unless you hold the console open all the time. The shader just freezes.