I am trying to get an early selection of fragments to work based on a stencil test. My scenario is this: I have a fragment shader that does a lot of work, but only needs to be executed on very few fragments when I make my scene. These fragments can be located almost everywhere on the screen (I cannot use scissors to quickly filter these fragments).
In rendering 1, I create a stencil buffer with two possible values. The values ββwill have the following meaning for pass 2:
- 0: do nothing
- 1: ok to continue (for example, enter a fragment shader and render)
Pass 2 correctly displays the scene. The stencil buffer is configured as follows:
glStencilMask(1); glStencilFunc(GL_EQUAL, 1, 1); // if the value is NOT 1, please early cull! glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // never write to stencil buffer
Now I run my application. The color of the selected pixels changes based on the stencil value, which means that the stencil test works fine.
However, I should see a huge, impressive increase in productivity with an early selection of stencil ... but nothing happens. I assume that the stencil test happens either after the depth test, or even after the fragment shader has been called. Why?
nVidia obviously has a patent for the early selection of stencil: http://www.freepatentsonline.com/7184040.html Is this right away because it's on?
I am using an nVidia GeForce GTS 450 graphics card. Do you plan to use stencil early selection to work with this card? Starting Windows 7 with the latest drivers.
source share