[PR #10023] Use DComp surface handle for Swap Chain management #27853

Open
opened 2026-01-31 09:24:40 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/10023

State: closed
Merged: Yes


Summary of the Pull Request

This PR changes the DxEngine to create a swapchain HANDLE, then have the TermControl attach that handle to the SwapChainPanel, rather than returning the swapchain via a IDXGISwapChain1.

I didn't write this code originally, @miniksa helped me out. The original commit was so succinct that I didn't think there was anything else to add or take away.

I'm going to need this for tear-out (#1256), so that I can have the content process create swap chain handles, then duplicate those handles out to the window process that will end up embedding the content.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

This reverts commit c113b65d9b.

That commit reverted 30b8335479

Validation Steps Performed

  • Built and ran the Terminal, it still seems to work
  • Does a TDR still work? or do we need to recreate the handle, or something.
  • Does this work on Win7? I honestly have no idea how DX compatibility works. Presumably, the WPF version uses the ForHwnd path, so this will still work, but I don't know if this will suddenly fail to launch on Win7 or something. Tagging in @miniksa.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/10023 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This PR changes the DxEngine to create a swapchain HANDLE, then have the TermControl attach _that_ handle to the SwapChainPanel, rather than returning the swapchain via a `IDXGISwapChain1`. I didn't write this code originally, @miniksa helped me out. The original commit was so succinct that I didn't think there was anything else to add or take away. I'm going to need this for tear-out (#1256), so that I can have the content process create swap chain handles, then duplicate those handles out to the window process that will end up embedding the content. ## References * [`DCompositionCreateSurfaceHandle`](https://docs.microsoft.com/en-us/windows/win32/api/dcomp/nf-dcomp-dcompositioncreatesurfacehandle) * [`CreateSwapChainForCompositionSurfaceHandle`](https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-idxgifactorymedia-createswapchainforcompositionsurfacehandle) * [`CreateSwapChainForComposition`](https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgifactory2-createswapchainforcomposition) * Tear-out: #1256 * Megathread: #5000 * Project: https://github.com/microsoft/terminal/projects/5 ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/projects/5#card-50760249 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments This reverts commit c113b65d9b15028281f6383909a73dba6af55bfc. That commit reverted 30b833547928d6dcbf88d49df0dbd5b3f6a7c879 ## Validation Steps Performed * [x] Built and ran the Terminal, it still seems to work * [x] Does a TDR still work? or do we need to recreate the handle, or something. * [x] Does this work on Win7? I honestly have no idea how DX compatibility works. Presumably, the WPF version uses the `ForHwnd` path, so this will still work, but I don't know if this will suddenly fail to launch on Win7 or something. Tagging in @miniksa.
claunia added the pull-request label 2026-01-31 09:24:40 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27853