From 8d0a6cd03560ed8d20efb57c5e38a980380a1a1e Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Mon, 14 Dec 2015 00:45:49 +1100 Subject: vo_opengl: dxinterop: prevent crash with 0-size window Direct3D doesn't like 0-sized swapchain dimensions, even when those dimensions are automatically set. Manually set them to a size that isn't zero instead. --- video/out/opengl/dxinterop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/opengl/dxinterop.c b/video/out/opengl/dxinterop.c index 04518714d1..bfbde88182 100644 --- a/video/out/opengl/dxinterop.c +++ b/video/out/opengl/dxinterop.c @@ -366,6 +366,8 @@ static void fill_presentparams(MPGLContext *ctx, D3DPRESENT_PARAMETERS *pparams) *pparams = (D3DPRESENT_PARAMETERS) { .Windowed = TRUE, + .BackBufferWidth = ctx->vo->dwidth ? ctx->vo->dwidth : 1, + .BackBufferHeight = ctx->vo->dheight ? ctx->vo->dheight : 1, // The length of the backbuffer queue shouldn't affect latency because // swap_buffers() always uses the backbuffer at the head of the queue // and presents it immediately. MSDN says there is a performance @@ -374,8 +376,7 @@ static void fill_presentparams(MPGLContext *ctx, D3DPRESENT_PARAMETERS *pparams) // very high CPU usage. Use six to be safe. .BackBufferCount = 6, .SwapEffect = D3DSWAPEFFECT_FLIPEX, - // Automatically get the backbuffer format from the display format. The - // size of the backbuffer is automatically determined too. + // Automatically get the backbuffer format from the display format .BackBufferFormat = D3DFMT_UNKNOWN, .PresentationInterval = presentation_interval, .hDeviceWindow = vo_w32_hwnd(ctx->vo), -- cgit v1.2.3