Here is a question for those more knowledgeable on the inner workings of the graphics pipe...
When using Pixel Shader Depth Output, it's expected that the depth testing operation must then occur after the fragment shader is run. No Early-Z, Hi-Z, etc.
I was wondering when stencil testing occurs on modern video cards.
Given Stencil is so closely linked to depth, and stencil operations can depend on the depth value, I wonder if the actual stencil test still occurs before the fragment is shaded (+ Hi-Stencil)?
I'm currently mentally toying with an idea that will require fragment shader depth output, and the performance hit for lack of early z is far too high (it's very high fillrate and overdraw, without blending).
I was thinking that instead of the current depth fill pass for each object, I'd use a stencil fill pass with the vertices offset the maximum I expect the pixel depth to be offset (so zfail here would not update the stencil). (If that makes sense)... It wouldn't be as good, but it'd help a lot.
I want to know, because if the stencil test occurs after the fragment shader, then this will all be a waste of time.
(Note I will be using KEEP stencil ops for all geometry drawn with the depth shader)
(Also note this is targetted at DX9, so no DX11 min/max depth for me..)
Anywho. Thankeo
When using Pixel Shader Depth Output, it's expected that the depth testing operation must then occur after the fragment shader is run. No Early-Z, Hi-Z, etc.
I was wondering when stencil testing occurs on modern video cards.
Given Stencil is so closely linked to depth, and stencil operations can depend on the depth value, I wonder if the actual stencil test still occurs before the fragment is shaded (+ Hi-Stencil)?
I'm currently mentally toying with an idea that will require fragment shader depth output, and the performance hit for lack of early z is far too high (it's very high fillrate and overdraw, without blending).
I was thinking that instead of the current depth fill pass for each object, I'd use a stencil fill pass with the vertices offset the maximum I expect the pixel depth to be offset (so zfail here would not update the stencil). (If that makes sense)... It wouldn't be as good, but it'd help a lot.
I want to know, because if the stencil test occurs after the fragment shader, then this will all be a waste of time.
(Note I will be using KEEP stencil ops for all geometry drawn with the depth shader)
(Also note this is targetted at DX9, so no DX11 min/max depth for me..)
Anywho. Thankeo