I will set up the vertex locations with the following
Position0 = -1, -1, 1Position1 = -1, 1, 1Position2 = 1, -1, 1Position3 = 1, 1, 1
I will create the indices this way
index[0] = 0; index[1] = 1; index[2] = 2;
index[3] = 0; index[4] = 2; index[5] = 3;
When I take a look in PIX, and take a look at the Details -> Mesh panel for DrawIndexed I will see the correct values (well, the ones I posted above there. For example, VTX/IDX 0 will be (-1, -1, 1, 1). What I do not see for some strange reason is the DrawIndexed call vertex shader debugging, UNLESS I click on a specific part of the Render, even though all I see is the cleared render target color. For example, if I try to debug the pixel (161, 161) I will see the DrawIndexed primitive event, however, there will be a message telling me that "This pixel was eliminated because: It failed the depth test.". The interesting part to that, is I disable the depth test in the depth stencil state the gets set.
The shader code is simple, I just take the input and send it back out. When I go to render, it is very basic, the steps are like this.
ClearRenderTargetView(...)ClearDepthStencilView(view, D3D11_CLEAR_DEPTH, 1.0f, 0)SetVSShader()SetPSShader()// FullScreenQuad rendering codeSetInputLayoutToRender(..)SetVertexBuffers(..)SetIndexBuffer(...)DrawIndexedPrimitive(6, 0, 0)SwapChain->Present(..)
Does anyone know what could be going on here?
Depth stencil state code
D3D11_DEPTH_STENCIL_DESC depthStencilDesc; // Initialize the description of the stencil state. ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc)); // Set up the description of the stencil state. depthStencilDesc.DepthEnable = false; depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS; depthStencilDesc.StencilEnable = false; depthStencilDesc.StencilReadMask = 0xFF; depthStencilDesc.StencilWriteMask = 0xFF; // Stencil operations if pixel is front-facing. depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR; depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; // Stencil operations if pixel is back-facing. depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR; depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; hr = m_pD3D11Device->CreateDepthStencilState(&depthStencilDesc, &m_depthStencilState);
Shader code
struct VertexShaderInput{ float4 Position : POSITION;};struct VertexShaderOutput{ float4 Position : SV_POSITION;};VertexShaderOutput VS(VertexShaderInput input){ VertexShaderOutput output; output.Position = input.Position; return output;}float4 PS(VertexShaderOutput input) : SV_Target{ return float4(0.0f, 0.0f, 0.0f, 1.0f);}