title: Unable to create a DX11 render target view
body: <p>I'm trying to get started with DirectX 11 game programming, but for some reason I'm simply unable to create a render target view with ID3D11Device::CreateRenderTargetView().</p>
  
  <p>(BTW, I use VS for Desktop 2013, and the highest feature level my GPU supports is 11_0. I'm running Windows 8.1.)</p>
  
  <p>Here's the code I think is relevant:   </p>
  
  <pre><code>D3D11_TEXTURE2D_DESC backBufferDesc;
      ZeroMemory(&amp;backBufferDesc, sizeof(backBufferDesc));
      backBufferDesc.ArraySize = 1;
      backBufferDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
      backBufferDesc.CPUAccessFlags = 0;
      backBufferDesc.Format = DXGI_FORMAT_R32_FLOAT;
      backBufferDesc.Height = nHeight;
      backBufferDesc.Width = nWidth;
      backBufferDesc.MipLevels = 1;
      backBufferDesc.MiscFlags = 0;
      backBufferDesc.SampleDesc.Count = 1;
      backBufferDesc.SampleDesc.Quality = 0;
      backBufferDesc.Usage = D3D11_USAGE_DEFAULT;
  
      ID3D11Texture2D* backBufferTexture;
      result = d3dDevice_ -&gt; CreateTexture2D(&amp;backBufferDesc, 0, &amp;backBufferTexture);
      if (FAILED(result))
      {
          MessageBox(0, "Failed to create the back buffer texture!", "DirectX Error", MB_OK);
          return false;
      }
  
      result = swapChain_-&gt;GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&amp;backBufferTexture);
      if (FAILED(result))
      {
          MessageBox(0, "Failed to get the swap chain back buffer!", "DirectX Error", MB_OK);
          return false;
      }
  
      D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
      ZeroMemory(&amp;rtvDesc, sizeof(rtvDesc));
      rtvDesc.Format = backBufferDesc.Format;
  
      result = d3dDevice_-&gt;CreateRenderTargetView(backBufferTexture, &amp;rtvDesc, &amp;backBufferTarget_);
      if (backBufferTexture)
          backBufferTexture-&gt;Release();
      if (FAILED(result))
      {
          MessageBox(0, "Failed to create the render target view!", "DirectX Error", MB_OK);
          return false;
      }
  </code></pre>