2

I want to create multiple render target view and i tried it but i can't get buffer more than 2.

I've already set DXGI_SWAP_CHAIN_DESC's BufferCount value as BufferSize

UINT const BufferSize = 4;
ID3D11Texture2D* BufferTemp;

ID3D11RenderTargetView** RenderTargetView = new ID3D11RenderTargetView*[BufferSize];
for (UINT i = 0; i < BufferSize; i++) {
    ZeroMemory(&BufferTemp, sizeof(BufferTemp));

    SwapChain->GetBuffer(i, __uuidof(ID3D11Texture2D), (void**)&BufferTemp);

    Device->CreateRenderTargetView(BufferTemp, 0, &RenderTargetView[i]);
}

In the actual code, I've initialized HRESULT value, and it said S_OK at the first loop, but after that it said 0x887a0001.

user7860670
  • 35,849
  • 4
  • 58
  • 84
KidCozy
  • 25
  • 5

1 Answers1

0

If this swap chain is using DXGI_SWAP_EFFECT_DISCARD effect then GetBuffer method can only access the first buffer. That is you can only get view of the only buffer you can draw on.

user7860670
  • 35,849
  • 4
  • 58
  • 84