d3dcoder / d3d12book

Sample code for the book "Introduction to 3D Game Programming with DirectX 12"
1.54k stars 591 forks source link

press F2 to set SampleDesc.count = 4 will fail, due to mSwapChainBuffer not be reset before create a new swap chain #3

Open qzhan15 opened 8 years ago

qzhan15 commented 8 years ago

at below code at begin of D3DApp::CreateSwapChain will solve this issue

for (int i = 0; i < SwapChainBufferCount; ++i) mSwapChainBuffer[i].Reset();

Sighman6 commented 8 years ago

Actually, the problem occurs because you cannot use multi-sampling with DXGI_SWAP_EFFECT_FLIP_DISCARD.

doxmo commented 8 years ago

I wrote GHagi's code and I've changed DXGI_SWAP_EFFECT_FLIP_DISCARD for anothers. The error continue.

Drayan commented 7 years ago

Actually, according to https://github.com/Microsoft/DirectXTK12/wiki/Simple-rendering#Multisampling (Look at the technical note at the end of the page), MSAA is supported for DXGI_SWAP_EFFECT_DISCARD, not FLIP_DISCARD.

With DXGI_SWAP_EFFECT_FLIP_DISCARD, you have to use another way (explained in the link I gave).

khollen42 commented 7 years ago

Has anyone implemented the code changes recommended by Drayan? I'm getting the same crash with the latest code.