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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10023
Author: @zadjii-msft
Created: 5/3/2021
Status: Merged
Merged: 5/12/2021
Merged by: @zadjii-msft

Base: mainHead: dev/migrie/f/oop/use-dcomp-handle


📝 Commits (4)

  • 21a97b6 Revert "Revert "Use DComp surface handle for Swap Chain management.""
  • 2e861d8 some minor cleanup
  • 445bdf6 Do the delayload dance
  • 12b78f5 Merge remote-tracking branch 'origin/main' into dev/migrie/f/oop/use-dcomp-handle

📊 Changes

7 files changed (+57 additions, -20 deletions)

View changed files

📝 src/cascadia/TerminalControl/ControlCore.cpp (+2 -2)
📝 src/cascadia/TerminalControl/ControlCore.h (+1 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+6 -6)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -1)
📝 src/renderer/dx/DxRenderer.cpp (+39 -7)
📝 src/renderer/dx/DxRenderer.hpp (+6 -3)
📝 src/renderer/dx/precomp.h (+2 -0)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10023 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 5/3/2021 **Status:** ✅ Merged **Merged:** 5/12/2021 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/f/oop/use-dcomp-handle` --- ### 📝 Commits (4) - [`21a97b6`](https://github.com/microsoft/terminal/commit/21a97b6c80dd95cf3be84d9eb2070adc5956fa75) Revert "Revert "Use DComp surface handle for Swap Chain management."" - [`2e861d8`](https://github.com/microsoft/terminal/commit/2e861d8a37886278e638c556b71e44943d6b64b7) some minor cleanup - [`445bdf6`](https://github.com/microsoft/terminal/commit/445bdf6cad73f7cec15d8bd32567d7aec9a5da94) Do the delayload dance - [`12b78f5`](https://github.com/microsoft/terminal/commit/12b78f506673813d17360226f759f19923459447) Merge remote-tracking branch 'origin/main' into dev/migrie/f/oop/use-dcomp-handle ### 📊 Changes **7 files changed** (+57 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+2 -2) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+1 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+6 -6) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -1) 📝 `src/renderer/dx/DxRenderer.cpp` (+39 -7) 📝 `src/renderer/dx/DxRenderer.hpp` (+6 -3) 📝 `src/renderer/dx/precomp.h` (+2 -0) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:24:38 +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#27848