I’m trying to write to both a color and depth buffer in a fragment shader where both are bound to a FBO.
Color is bound as a color attachment, and depth as a depth attachment.
In older GLSL versions you would use:
gl_FragData = colordata;
gl_FragDepth = depthdata;
But in GLSL 1.40 gl_FragData is depreciated and you need a user defined out variable for color buffers. However when I use this I get the linker error: “built-in and user-defined fragment shader outputs may not be used at the same time”.
Looking trough the GLSL 1.40 documentation it doesn’t seem like gl_FragDepth has been depreciated, so in order to write depth I have (?) to use a built-in shader output, which apparently is not going to work when a user defined output is also used.
Does anyone know how to do this correctly in GLSL 1.40, or is the NVIDIA linker at fault?