0
我有一個簡單的DirectX程序,當我最小化&然後取消最小化時崩潰。DirectX崩潰最小化
這些事件情況下,我涵蓋:
case WM_SIZING:
case WM_SIZE:
if(engine.isReady()) engine.resizeDevice();
if(engine.isReady()) engine.draw();
break;
調整大小大致是:
deviceContext->OMSetRenderTargets(0, NULL, NULL);
...
deviceInterface->CreateRenderTargetView(...);
...
deviceContext->RSSetViewports(1, &vp);
...
deviceContext->OMSetRenderTargets(1, &renderTargetInterface, NULL);
當我unminimize,試圖設置後臺緩存的代碼死亡。這是通過值的行:
hr = swapChain-> ResizeBuffers(3,640,480,DXGI_FORMAT_UNKNOWN,0);
ResizeBuffers()返回錯誤0x887a0005
返回緩衝區代碼:
HRESULT _setBackBuffer(const SettingsVD &settings){
HRESULT hr;
hr=swapChain->ResizeBuffers(settings.bufferCount, settings.width, settings.height, DXGI_FORMAT_UNKNOWN, 0);
if(FAILED(hr)) return hr; // Dies here when UNminimizing
ID3D11Texture2D* backBuffer=NULL;
hr=swapChain->GetBuffer(0, __uuidof(backBuffer), (LPVOID*)&backBuffer);
if(FAILED(hr)) return hr;
hr=deviceInterface->CreateRenderTargetView(backBuffer, NULL, &renderTargetInterface);
if(FAILED(hr)) return hr;
release(backBuffer);
return hr;
}
任何人都知道爲什麼回緩衝區barfing?
- 可能與我的其他線程,DirectX Crash When Resizing Tiny,但我還沒有解決這個問題呢,所以....磕碰。