[vlc-devel] [PATCH 2/4] direct3d11: only resize the swapchain and create new targets if the dimensions changed
Steve Lhomme
robux4 at videolabs.io
Tue Dec 12 14:13:42 CET 2017
---
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);
--
2.14.2
More information about the vlc-devel
mailing list