close
Skip to content

Backends: Dx12: Enable swapchain tearing to eliminate viewports framerate throttling#8965

Closed
RT2Code wants to merge 5 commits into
ocornut:dockingfrom
RT2Code:dx12-unthrottle-viewport-framerate
Closed

Backends: Dx12: Enable swapchain tearing to eliminate viewports framerate throttling#8965
RT2Code wants to merge 5 commits into
ocornut:dockingfrom
RT2Code:dx12-unthrottle-viewport-framerate

Conversation

@RT2Code
Copy link
Copy Markdown
Contributor

@RT2Code RT2Code commented Sep 27, 2025

According to the DXGI documentation, with VSync off and a swapchain using flip swap effects, it is recommended to enable tearing to support displays with variable refresh rate.

Another reason to enable swapchain tearing is that without it, non-fullscreen swapchains are throttled to the display’s refresh rate even with VSync disabled. Enabling tearing removes this limitation and lets viewports run at full framerate.

I used this sample as a reference for this PR.

Please note that fullscreen is not supported yet (no change here, it's already unsupported), that's something I'll fix in a future PR.

@ocornut
Copy link
Copy Markdown
Owner

ocornut commented Sep 29, 2025

Thanks for your PR.
Some observations:

  • We recently started using DXGI_MWA_NO_ALT_ENTER (15c88c4, 3d937be) and I believe your latest merge introduce two spots doing the same thing.
  • bd->tearingSupport is recomputed every time in ImGui_ImplDX12_CreateWindow(), could that be moved to Init ?
  • In main.cpp, g_tearingSupport -> g_SwapChainTearingSupport.

@ocornut
Copy link
Copy Markdown
Owner

ocornut commented Sep 29, 2025

Another reason to enable swapchain tearing is that without it, non-fullscreen swapchains are throttled to the display’s refresh rate even with VSync disabled. Enabling tearing removes this limitation and lets viewports run at full framerate.

(For the records, I don't get display refresh rate throttling on my desktop Windows 10 setup.)

@RT2Code RT2Code force-pushed the dx12-unthrottle-viewport-framerate branch from b8f9a75 to 134d20d Compare September 29, 2025 14:44
@RT2Code RT2Code force-pushed the dx12-unthrottle-viewport-framerate branch from 134d20d to bd00d34 Compare September 29, 2025 14:47
@RT2Code
Copy link
Copy Markdown
Contributor Author

RT2Code commented Sep 29, 2025

bd->tearingSupport is recomputed every time in ImGui_ImplDX12_CreateWindow(), could that be moved to Init ?

Correct, and in fact, you made me realize it's also true for the dxgi factory, there's no need to recreate it for each viewport. I applied your suggestions.

(For the records, I don't get display refresh rate throttling on my desktop Windows 10 setup.)

Maybe it's specific to Windows 11? When I disable VSync and no support for tearing, my framerate is capped to 144fps, which is my screen refresh rate.

@ocornut
Copy link
Copy Markdown
Owner

ocornut commented Sep 29, 2025

Merged as 3dafd9e, b4514ce. Thank you!

@ocornut ocornut closed this Sep 29, 2025
@RT2Code RT2Code deleted the dx12-unthrottle-viewport-framerate branch September 29, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants