Sign in to follow this  

Directx10 pipeline

Recommended Posts

Ive been reading the directx documentation recently and had a few questions. 1. The documenation notes the output mergers job, as "The OM stage is the final step for determining which pixels are visible (with depth-stencil testing) and blending the final pixel colors." It then goes on to talk about the Depth-Stencil Testing overview, which again appears to be part of the output merger. Link . But if all this happens after the pixel shader, as shown here, doesnt that mean that there is no depth testing before the pixel shader is called? I always understood that the pixel shader only gets called if the deph value outputed from the vertex shader and interpolated for input into the pixel shader passed the depth test. Meaning that you dont have to worry about expensive pixel shaders being called, which ended up failing the deph test anyway. But from the pipeline diagram, it appears that the deph test is performed after the pixel shader stage, ie the output merger stage. 2. When running multiple passess within effect techniques, do you always have to specify a vertex shader? It seems a waste to run the whole vertexshader/pixelshader cycle twice, when say, for some specific example, the only change happens in the pixel shaders.Which brings me to another question. Does the depth value of pass A ever affect if whether or not pass B gets written to the render target? For example, if both pass A and B write out the same depth, wouldnt this cause zfighting? This relates to my first question.

Share this post

Link to post
Share on other sites

The pipeline diagram, as it is presented in the SDK, is a conceptual overview of the system. The hardware implementations often reorder the physical operations in order to optimize performance and cost.

Most modern hardware performs depth testing before pixel shader, provided that the pixel shader doesn't write to the depth register. In D3D11, you can further optimize this by using less-than-equal or greater-than-equal semantics for depth writing, which doesn't disable early depth testing.


If your vertex shader (or geometry shader) is heavy enough to be a bottleneck, you can use the stream-out feature to save the transformed geometry to GPU memory and then render it multiple times with a minimal vertex shader. Vertex shader usage is mandatory in any case.

It is also possible to use instancing in order to render multiple copies of a mesh in the same place. You can then observe the instance id system value in the pixel shader to branch your logic.

Note that D3D10+ hardware is commonly powerful/flexible enough to implement many classical techniques in single pass, whereas in earlier generations you may have needed multiple passes.


Depends on the depth testing state. If the test is "less than or equal", all pixels drawn on the exactly same depth (or less) as in previous passes will be overwritten.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this