DXGI force a SetFullscreenState on D3D12 when another window gains focus on the same monitor

Started by
7 comments, last by MJP 4 years, 6 months ago

When ever another window gains focus (the most simple way is to press Alt + Tab) on the same monitor, the game window will be forced into windowed mode. I already called MakeWindowAssociation with DXGI_MWA_NO_WINDOW_CHANGES and DXGI_MWA_NO_ALT_ENTER. And it returned success. No Alt + Enter works as expected, the default handler is gone. But the forced fullscreen state change seems can't be turned off completely. Does anyone have any better idea about this issue?

Advertisement

You can't disable that.

If I don't call ResizeBuffers after that, the GPU will be removed. How should I know this situation happened ? I'm currently checking fullscreen flag that I saved against GetFullscreenState() when WM_WINDOWPOSCHANGED is received. Are there any more messages that I need to take care of ? Are these messages documented anywhere ?

Do you even really need to do fullscreen mode anymore? On Win10 you'll bypass the compositor as long you have a borderless window that covers the entire monitor, which is a much nicer experience both for us and for end users.

I couldn't agree more that borderless fullscreen is a much nicer experience. But the problem is what if a the user has a 4k monitor but a lame GPU ? Exclusive fullscreen seems like the only way to go in that situation. And you don't want to break their experience if they want to skype someone in the middle of the game. Metro : Exodus minimize the fullscreen window in that situation and re-enable the fullscreen state once it gains focus again. I guess somewhere down the line, they have to call ResizeBuffers after this situation happens, even they are minimizing the window. No one wants a GPU removal in the middle of a game. The important thing is, how should we know when that happens ?

Doesn't DXGI_SCALING_STRETCH already do the job for you?

EDIT: this also may help: https://docs.microsoft.com/en-us/windows/uwp/gaming/multisampling--scaling--and-overlay-swap-chains

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

I believe the size is the same. If we run a 1920x1080 on a 4k monitor, the only difference is the desktop resolution when that happens. And the DXGI error I got was


DXGI ERROR: IDXGISwapChain::Present: The application has not called ResizeBuffers or re-created the SwapChain after a fullscreen or windowed transition. Flip model swapchains (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL and DXGI_SWAP_EFFECT_FLIP_DISCARD) are required to do so. [ MISCELLANEOUS ERROR #117: ]

 

4 hours ago, acerskyline said:

I couldn't agree more that borderless fullscreen is a much nicer experience. But the problem is what if a the user has a 4k monitor but a lame GPU ? Exclusive fullscreen seems like the only way to go in that situation. And you don't want to break their experience if they want to skype someone in the middle of the game. Metro : Exodus minimize the fullscreen window in that situation and re-enable the fullscreen state once it gains focus again. I guess somewhere down the line, they have to call ResizeBuffers after this situation happens, even they are minimizing the window. No one wants a GPU removal in the middle of a game. The important thing is, how should we know when that happens ?

Well, with borderless you still want to support a configurable render resolution. You just may need an upscaling step to the full display resolution, which you'll want anyway if you do dynamic resolution and/or if you want the UI rendered at full display resolution.

Either way your backbuffer doesn't need to match the window size. Swap chains in DX12 can handle certain amounts of upscaling during scanout when you're in "direct flip" mode (bypassing the compositor). There's some more info here: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/for-best-performance--use-dxgi-flip-model

This topic is closed to new replies.

Advertisement