Supposing I set up as:
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);
glClear(GL_DEPTH_BUFFER_BIT);
glFramebufferDrawBufferEXT(id, GL_NONE); // id is currently bound framebuffer object
glColorMaski(0, GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
[ol]
[li]If the bound fragment shader does not explicitly write to gl_FragDepth
, will it still be executed, given that the color mask is false and the draw buffer is nil? Or can I assume the driver will be smarter than that? [/li][li]Is it better to simply not have an active fragment shader, or will that cause the fixed function fragment processing to be substituted? [/li][li]Overall, what’s the best approach here? Should I have a separate version of each shader for the depth pre-pass, or rely on the driver being smart enough to cull unnecessary computations (including vertex shader outputs which end up not being used in subsequent stages, like normals, for example)? [/li][/ol]