Blast-Radius Aware AI Code Review for Business-Critical Systems
LiveReview LiveReview Explore LiveReview

gl_FragDepth - establishes a depth value for the current fragment

Declaration

       out float gl_FragDepth ;.SH "DESCRIPTION"

       Available only in the fragment language, gl_FragDepth is an output variable that is used to establish the
       depth value for the current fragment. If depth buffering is enabled and no shader writes to gl_FragDepth,
       then the fixed function value for depth will be used (this value is contained in the z component of
       gl_FragCoord()) otherwise, the value written to gl_FragDepth is used. If a shader statically assigns to
       gl_FragDepth, then the value of the fragment's depth may be undefined for executions of the shader that
       take that path. That is, if the set of linked fragment shaders statically contain a write to
       gl_FragDepth, then it is responsible for always writing it.

Name

       gl_FragDepth - establishes a depth value for the current fragment

See Also

gl_FragCoord()

Version Support

       ┌──────────────┬───────────────────────────────────────────────────────────────────────────────────┐
       │              │        OpenGLShadingLanguageVersion                                            │
       ├──────────────┼──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┤
       │ Variable     │ 1.10 │ 1.20 │ 1.30 │ 1.40 │ 1.50 │ 3.30 │ 4.00 │ 4.10 │ 4.20 │ 4.30 │ 4.40 │ 4.50 │
       │ Name         │      │      │      │      │      │      │      │      │      │      │      │      │
       ├──────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ gl_FragDepth │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │
       └──────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘

See Also