DirectX 11 another fullscreen problem thread.

Started by
2 comments, last by InvalidPointer 12 years, 6 months ago
I created a small DirectX 11 application and I am having issues with setting up the fullscreen/window mode switching.

My first problem is that my application does not catch the WM_SIZE message when I do Alt+Enter (am I missing a flag somewhere?)... I noticed that if I start my application in window mode, resize the client window manually and then press Alt+Enter, it will catch a WM_SIZE message otherwise it doesn't.


I get the annoying when it doesn't catch WM_SIZE (thus not calling ResizeBuffers):
"DXGI Warning: IDXGISwapChain::Present: Fullscreen presentation inefficiencies incurred due to application not using IDXGISwapChain::ResizeBuffers appropriately, specifying a DXGI_MODE_DESC not available in IDXGIOutput::GetDisplayModeList, or not using DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH. DXGI_SWAP_CHAIN_DESC::BufferDesc = { 1024, 768, { 0, 0 }, R8G8B8A8_UNORM, 0, 0 }; DXGI_SWAP_CHAIN_DESC::SampleDesc = { 4, 0 }; DXGI_SWAP_CHAIN_DESC::Flags = 0x2"

The second problem I have is I get a bunch of :

"First-chance exception at 0x7665b9bc in Test.exe: Microsoft C++ exception: _com_error at memory location 0x0045f4a8.."
When switching modes.

Can anyone help?

I can post some code if needed.
Advertisement
An easier way can be to not handle WM_SIZE, and instead handle any required resize the first thing you do in your main loop.
Use GetClientRect to get the window size, get the back-buffer size using GetDesc from the D3D11 back-buffer, and use GetFullscreenState on your swap-chain to see if the fullscreen mode has changed. If either the sizes don't match or the fullscreen state is not what it was the previous frame, call ResizeBuffers.

An easier way can be to not handle WM_SIZE, and instead handle any required resize the first thing you do in your main loop.
Use GetClientRect to get the window size, get the back-buffer size using GetDesc from the D3D11 back-buffer, and use GetFullscreenState on your swap-chain to see if the fullscreen mode has changed. If either the sizes don't match or the fullscreen state is not what it was the previous frame, call ResizeBuffers.


It works, thanks!
As an addendum, you may be able to use the MakeWindowAssociation() method of the IDXGIFactory interface do to this the 'proper' way, but if you've already tried this to no effect then certainly disregard :)
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

This topic is closed to new replies.

Advertisement