[vlc-commits] direct3d11: only resize the swapchain and create new targets if the dimensions changed

Steve Lhomme git at videolan.org
Wed Dec 13 09:30:02 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Dec 12 14:13:42 2017 +0100| [f178aa56f07776271bd9da9807ab402173a974f1] | committer: Jean-Baptiste Kempf

direct3d11: only resize the swapchain and create new targets if the dimensions changed

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f178aa56f07776271bd9da9807ab402173a974f1
---

 modules/video_output/win32/direct3d11.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 105ae2d4c2..3920751568 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -701,6 +701,20 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
         rect = sys->sys.rect_dest_clipped;
     uint32_t i_width = RECTWidth(rect);
     uint32_t i_height = RECTHeight(rect);
+    D3D11_TEXTURE2D_DESC dsc = { 0 };
+
+    if (sys->d3drenderTargetView) {
+        ID3D11Resource *res = NULL;
+        ID3D11RenderTargetView_GetResource(sys->d3drenderTargetView, &res);
+        if (res)
+        {
+            ID3D11Texture2D_GetDesc((ID3D11Texture2D*) res, &dsc);
+            ID3D11Resource_Release(res);
+        }
+    }
+
+    if (dsc.Width == i_width && dsc.Height == i_height)
+        return S_OK; /* nothing changed */
 
     if (sys->d3drenderTargetView) {
         ID3D11RenderTargetView_Release(sys->d3drenderTargetView);



More information about the vlc-commits mailing list