From d506cdc4c554100767df6985aef3bc227e922b4b Mon Sep 17 00:00:00 2001 From: Dev-Taehui Date: Wed, 1 Feb 2023 16:17:40 +0900 Subject: [PATCH] Provide DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING for CanvasSwapChain when creating or resizing for supporting VRR --- winrt/lib/drawing/CanvasDevice.cpp | 1 + winrt/lib/drawing/CanvasSwapChain.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/winrt/lib/drawing/CanvasDevice.cpp b/winrt/lib/drawing/CanvasDevice.cpp index 73ca5f185..0ae8d53da 100644 --- a/winrt/lib/drawing/CanvasDevice.cpp +++ b/winrt/lib/drawing/CanvasDevice.cpp @@ -1153,6 +1153,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas swapChainDesc.Scaling = DXGI_SCALING_STRETCH; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; swapChainDesc.AlphaMode = ToDxgiAlphaMode(alphaMode); + swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; ComPtr swapChain; ThrowIfCreateSurfaceFailed( diff --git a/winrt/lib/drawing/CanvasSwapChain.cpp b/winrt/lib/drawing/CanvasSwapChain.cpp index 2301cacbc..f3b5e9676 100644 --- a/winrt/lib/drawing/CanvasSwapChain.cpp +++ b/winrt/lib/drawing/CanvasSwapChain.cpp @@ -551,7 +551,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas widthInPixels, heightInPixels, static_cast(newFormat), - 0)); + DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING)); if (m_isCoreWindowSwapChain) {