Definitively PIX or the graphics debugger (if you got a visual studio version coming with one). Alternatives are Cryteks RenderDoc, there are also tools from the different hardware vendors. Here you can inspect if you got the right buffers bound, what states are active, look at render targets, depth buffers, debug shaders if you must, etc. etc.
In this case a look at the the transformed vertices (in PIX post-VS or GS tab) and/or at the depth buffer would have pointed you in the right direction.
This is a nasty beginner bug, so I'll elaborate a bit. If you look at the
math of the projection matrix and set znear = 0 it will end up with something like this:
sx 0 0 0
0 sy 0 0
0 0 1 1
0 0 0 0
So after projection, your clip-space vertices end up with w == z, after the perspective divide z == 1 (normalized device coordinates, this is now your vertex's depth value). So, all your vertices end up at the far plane. Since you don't explicitly set a depth stencil state, the
default is used. This uses a depth comparison function of D3D11_COMPARISON_LESS and since your depth buffer is cleared to 1, well, guess what happens ;)
Edit: Wait, it's even worse, with this formula sx and sy end up being 0, too. So all your vertices end up at (0,0,1)
. I should have linked to
this function instead. Sorry about the confusion.