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

Steve Lhomme git at videolan.org
Wed Dec 13 11:15:35 CET 2017


vlc/vlc-3.0 | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Dec 12 14:13:42 2017 +0100| [4b0f4e484bbfa608c08af8fd0e2cfb51ac8765da] | committer: Hugo Beauzée-Luyssen

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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit f178aa56f07776271bd9da9807ab402173a974f1)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 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