Uncapped full-screen frame rate by bypassing DWM #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disabling vsync in DX12 is non-trivial, but possible. The D3D12Fullscreen sample doesn't allow uncapped frame rates because even the full-screen uses DWM. Fullscreen mode is basically just a maximized window without border.
To enable full-screen mode without DWM, I added DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH. This requires the swapchain buffers need to be resized after toggling between windowed and full-screen mode. I moved this functionality from OnSizeChanged() to a separate ResizeBuffers() function. This allows uncapped frame rates in full-screen on the primary monitor.
To avoid unnecessary flicker when switching to full-screen manually ('space' instead of alt-enter), the window is resized to the target resolution before the mode switch. The target resolution is currently the maximum output resolution (I couldn't find any method to get physical resolution on high-DPI screen).
Relevant discussion: https://directx12forum.azurewebsites.net/index.php?topic=4131.15