coderef

EXT_frag_depth WebGL extensionLimited availability

The EXT_frag_depth extension for WebGL 1.0 and 2.0 contexts adds setting the depth value of a fragment from within the fragment shader.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–37Not supported
38+Supportedsince Oct 7, 2014
Current: 155
Edge
12–92Not supported
93+Supportedsince Sep 2, 2021
Current: 154
Firefox
1–46Not supported
47+Supportedsince Jun 7, 2016
Current: 157
Safari
1–8Not supported
9+Supportedsince Sep 30, 2015
Current: 27
MobileChrome Android
18–37Not supported
38+Supportedsince Oct 8, 2014
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
1–14.5Not supported
15+Supportedsince Sep 20, 2021
Current: 27

How to use

Not supported in Firefox Android. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: EXT frag depth.

Feature detection

JS · check before using
if ("EXT_frag_depth" in globalThis) {
  // EXT_frag_depth is available
} else {
  // load a polyfill or use a fallback
}