DirectX Crash When Resizing Tiny

2019-08-07 10:19发布

问题:

I am trying to make my program more bullet proof. My program resizes fine until I make it super tiny like this:

A method to prevent that from happening is to set a minimum size, which I know how to do already. I want to look deeper into the problem before I do that.

The following is where the functions start to crash.

hr=swapChain->ResizeBuffers(settings.bufferCount, settings.width, settings.height, DXGI_FORMAT_UNKNOWN, 0);
if(FAILED(hr)) return 0;

I figured it was because the buffer was too small, so I made a fail safe buffer size. It also failed though.

hr=swapChain->ResizeBuffers(settings.bufferCount, fallback.width, fallback.height, DXGI_FORMAT_UNKNOWN, 0);
if(FAILED(hr)) return 0;

What is the reason the program chokes when I make it tiny? I thought it was the buffers being too small. Doesnt seem like it is the case.

Edit:
Been a while since I posted this, so my code has changed a lot. Now it gives an unhandled exception crash when calling deviceContext->ClearRenderTargetView().