Sign in to follow this  
Shnoutz

DirectX 11 another fullscreen problem thread.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='Erik Rufelt' timestamp='1317434712' post='4867832']
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.
[/quote]

It works, thanks!

Share this post


Link to post
Share on other sites
As an addendum, you may be able to use the [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb174540(v=vs.85).aspx"]MakeWindowAssociation()[/url] method of the IDXGIFactory interface do to this the 'proper' way, but if you've already tried this to no effect then certainly disregard :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this