Hi.
I've been conducting some experiments in OpenGL 4.2, and I got stuck in some non-clearly-defined-OpenGL specification (or so I think).
I know that what I want is a little non-usual, but believe me, it is for a good reason: speed up the rendering.
So, I want to perform the early fragment tests (depth and stencil) and, for the fragments that pass the tests, update the depth value.
I started by forcing the early tests with "layout(early_fragment_tests) in" which worked very well.
But when I tried to write to the depth buffer "gl_FragDepth = variableA" it did nothing.
I understand that such action may leave fragments with depth values that do not obey to the previous depth-tests, but this in fact expected by my algorithm.
I see no reason for this not to work.
Well, I can only suspect the following: maybe the depth values (from the depth buffer) are cached, and therefore, the gl_FragDepth writes are discarded? For optimization purposes, due to the usage of early fragment tests?
Thanks in advance,




