fragDepth error / 'gl_FragDepthEXT': undeclared identifier on release 119

Hi, I’ve just updated my three.js file from r111 to r119 and I’m getting an error when compiling a rawShaderMaterial.

The error states

THREE.WebGLShader: gl.getShaderInfoLog() fragment ERROR: 0:656: 'gl_FragDepthEXT

and the shader code is

656: gl_FragDepthEXT=depth;

I’m setting material.extensions.fragDepth=true and the variable depth has a valid float value.

Also, the code works perfectly with release r111

Is there any new requirement to enable fragDepth extension on release 119?
(The same happens with r118)

Since r118, WebGLRenderer automatically uses a WebGL 2 rendering context. That means this code

material.extensions.fragDepth=true

is not necessary anymore since the extension is enabled by default. However, since you are using RawShaderMaterial, it’s necessary to update your shader code to GLSL 3.0.

You can avoid any migration task by just using WebGL1Renderer. It’s identical to WebGLRenderer, it just enforces a WebGL 1 rendering context.

At least with the current release r119, I recommend the latter one if you are not planning to use a WebGL 2 exclusive feature (e.g. multisampled rendertargets or 3D textures).

Similar issue at GitHub:

Thanks for your help

1 Like