summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2015-12-14 00:45:49 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2015-12-14 01:11:56 +1100
commit8d0a6cd03560ed8d20efb57c5e38a980380a1a1e (patch)
tree9e8811bed2af9c57a5a8e298d04851cd35c65b34
parentf24ba544cd03261f25dab8ab564d832c28233079 (diff)
downloadmpv-8d0a6cd03560ed8d20efb57c5e38a980380a1a1e.tar.bz2
mpv-8d0a6cd03560ed8d20efb57c5e38a980380a1a1e.tar.xz
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.
-rw-r--r--video/out/opengl/dxinterop.c5
1 files changed, 3 insertions, 2 deletions
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),