From 24fc57e17520522fb994fa727bf500d7a2453ee7 Mon Sep 17 00:00:00 2001 From: Dev-Taehui Date: Wed, 1 Feb 2023 16:14:08 +0900 Subject: [PATCH] Add presentFlags to Present function --- winrt/lib/drawing/CanvasSwapChain.abi.idl | 3 +++ winrt/lib/drawing/CanvasSwapChain.cpp | 9 +++++++-- winrt/lib/drawing/CanvasSwapChain.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) 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 944cdf97f..2301cacbc 100644 --- a/winrt/lib/drawing/CanvasSwapChain.cpp +++ b/winrt/lib/drawing/CanvasSwapChain.cpp @@ -438,10 +438,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( [&] @@ -450,7 +455,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)); }); } diff --git a/winrt/lib/drawing/CanvasSwapChain.h b/winrt/lib/drawing/CanvasSwapChain.h index fe8077ceb..1bf2a3fa0 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;