diff --git a/winrt/lib/drawing/CanvasDevice.cpp b/winrt/lib/drawing/CanvasDevice.cpp index 7e9f13be1..25d7d0599 100644 --- a/winrt/lib/drawing/CanvasDevice.cpp +++ b/winrt/lib/drawing/CanvasDevice.cpp @@ -1330,6 +1330,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.abi.idl b/winrt/lib/drawing/CanvasSwapChain.abi.idl index 6cff6f94e..e6604b0fc 100644 --- a/winrt/lib/drawing/CanvasSwapChain.abi.idl +++ b/winrt/lib/drawing/CanvasSwapChain.abi.idl @@ -131,6 +131,9 @@ namespace Microsoft.Graphics.Canvas [overload("Present")] HRESULT PresentWithSyncInterval([in] INT32 syncInterval); + [overload("Present")] + HRESULT PresentWithSyncIntervalAndPresentFlags([in] INT32 syncInterval, [in] INT32 presentFlags); + [overload("ResizeBuffers")] HRESULT ResizeBuffersWithSize( [in] Windows.Foundation.Size newSize); diff --git a/winrt/lib/drawing/CanvasSwapChain.cpp b/winrt/lib/drawing/CanvasSwapChain.cpp index 68003e993..c8bdc85e3 100644 --- a/winrt/lib/drawing/CanvasSwapChain.cpp +++ b/winrt/lib/drawing/CanvasSwapChain.cpp @@ -448,10 +448,15 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas IFACEMETHODIMP CanvasSwapChain::Present() { - return PresentWithSyncInterval(1); + return PresentWithSyncIntervalAndPresentFlags(1, 0); } IFACEMETHODIMP CanvasSwapChain::PresentWithSyncInterval(int32_t syncInterval) + { + return PresentWithSyncIntervalAndPresentFlags(syncInterval, 0); + } + + IFACEMETHODIMP CanvasSwapChain::PresentWithSyncIntervalAndPresentFlags(int32_t syncInterval, int32_t presentFlags) { return ExceptionBoundary( [&] @@ -460,7 +465,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas auto& resource = GetResource(); DXGI_PRESENT_PARAMETERS presentParameters = { 0 }; - ThrowIfFailed(resource->Present1(syncInterval, 0, &presentParameters)); + ThrowIfFailed(resource->Present1(syncInterval, presentFlags, &presentParameters)); }); } @@ -556,7 +561,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas widthInPixels, heightInPixels, static_cast(newFormat), - 0)); + DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING)); if (!m_isTransformMatrixSupported) { diff --git a/winrt/lib/drawing/CanvasSwapChain.h b/winrt/lib/drawing/CanvasSwapChain.h index b7bb82f4d..b392570aa 100644 --- a/winrt/lib/drawing/CanvasSwapChain.h +++ b/winrt/lib/drawing/CanvasSwapChain.h @@ -182,6 +182,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas IFACEMETHOD(Present)() override; IFACEMETHOD(PresentWithSyncInterval)(int32_t syncInterval) override; + IFACEMETHOD(PresentWithSyncIntervalAndPresentFlags)(int32_t syncInterval, int32_t presentFlags) override; IFACEMETHOD(ResizeBuffersWithSize)( Size newSize) override;