[C++] [Win32] [DirectX11] SetFullscreenState & ResizeBuffers question

  • Thread starter Thread starter Charlie Brown 1001
  • Start date Start date
C

Charlie Brown 1001

Guest
Hi everybody,

first off all: I hope I reached the right forum ( did not find one for DirectX ) - if not: SORRY !!

I'm struggling since three days with a directX problem and now I think it's time to ask the experts:


I want to react to ALT-TAB in a Win32 / DirectX 11 programm, by using the messages WM_KILLFOCUS and WM_SETFOCUS.

( First ALT-TAB: switches to windowed, second one: switch back to fullscreen )

According to the following microsft article:

DirectX Graphics Infrastructure (DXGI) Best Practices

I only have to call: SetFullscreenState, resize the buffers ( as an answer to WM_SIZE ) and here we go:

DXGI resizes the front buffer to match the newly selected full-screen mode, and it sends a WM_SIZE message to the application. The application again calls ResizeBuffers, just as it would if the window border was dragged.


I'm calling the following:

m_swapChain->SetFullscreenState(fullscreen, nullptr);

where "fullscreen" is a bool that say's: Yes fullscreen, or No Windowed


And here's what I'm calling on WM_SIZE:


if (FAILED(m_swapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)))
throw ref new Platform::FailureException("Resize Buffers failed");




Result: I'm getting an error for the Resize call:

Swapchain cannot be resized unless all outstanding buffer references have been released. [ MISCELLANEOUS ERROR #19: ]


Is it really true ?

Do I have to release all buffers and create them new ?

But why should I use ResizeBuffers, if I have to make it all manually ?


Any ideas ?

Thanks,

Charlie Brown

Continue reading...
 
Back
Top