title: DirectX 11.1 Disable the depth buffer
body: <p>This question relates to a <a href="https://stackoverflow.com/questions/14859018/windows-8-store-app-directx-11-1-enabling-blendstate-with-loaded-png-texture-wit">previous question</a> I have asked.</p>
  
  <p>I have a series of 48 textures on flat square meshes that I am rendering and they all combine to form one "scene."  They each have a large percentage of of transparency with one or two smaller images, and when they are line up, I should be able to see the full scene.  I expected this would work without much issue, but when when I went to test it, I see the top-most texture, and then anywhere it would have transparency, it is just the clear color.</p>
  
  <p>At first, I thought it was an issue with how I was loading the image and somehow was disabling the alpha, but after playing around with the clear color, I realized that there was some transparency.</p>
  
  <p>Second, I tried was to enable blending - this works if all the textures get combined on a single z plane.</p>
  
  <p>I have posted my image loading and blending code on the question I linked to above.</p>
  
  <p>Now I am starting to think it may be an issue with the depth buffer, so I added the following code to my window dependent resources:</p>
  
  <pre><code>Microsoft::WRL::ComPtr&lt;ID3D11DepthStencilState&gt; DepthDefault;
  
  D3D11_DEPTH_STENCIL_DESC depthstencilDesc;
  ZeroMemory(&amp;depthstencilDesc, sizeof(depthstencilDesc));
  depthstencilDesc.DepthEnable = FALSE;
  depthstencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
  depthstencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
  depthstencilDesc.StencilEnable = FALSE;
  
  depthstencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
  depthstencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
  depthstencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
  depthstencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
  
  depthstencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
  depthstencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
  depthstencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
  depthstencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
  
  DX::ThrowIfFailed( direct3d.device-&gt;CreateDepthStencilState(&amp;depthstencilDesc, DepthDefault.GetAddressOf() ) );
  
  direct3d.context-&gt;OMSetDepthStencilState(DepthDefault.Get(), 0);
  </code></pre>
  
  <p>Even with this code, I am only seeing the topmost layer.  Am I missing something, or am I setting something incorrectly?</p>
  
  <p><strong>Edit:</strong> To visualize the problem, it's as if I had 48 panes of glass that are all the same size and they are all in a row.  Each piece of glass has one image somewhere on it.  When you look through all the glass panes, you get one extra awesome image of all the smaller images combined.  For me, directx or the pixel shader is only drawing the first glass pane and filling all the transparency of the first pane with the clear/background color.</p>
  
  <p><strong>Edit:</strong> The code I'm using to create the depthstencilview:</p>
  
  <pre><code>CD3D11_TEXTURE2D_DESC depthStencilDesc( DXGI_FORMAT_D24_UNORM_S8_UINT, backBufferDesc.Width, backBufferDesc.Height, 1, 1, D3D11_BIND_DEPTH_STENCIL );
  
  ComPtr&lt;ID3D11Texture2D&gt; depthStencil;
  DX::ThrowIfFailed( direct3d.device-&gt;CreateTexture2D( &amp;depthStencilDesc, nullptr, &amp;depthStencil ) );
  
  auto viewDesc = CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D);
  
  DX::ThrowIfFailed( direct3d.device-&gt;CreateDepthStencilView( depthStencil.Get(), &amp;viewDesc, &amp;direct3d.depthStencil ) );
  </code></pre>
  
  <p>That code is literally right above my depth test/ D3D11_DEPTH_STENCIL_DESC code.  I'm presuming that this creates the depth code.</p>