1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-06 06:08:23 +00:00

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.
This commit is contained in:
James Ross-Gowan 2015-12-14 00:45:49 +11:00
parent f24ba544cd
commit 8d0a6cd035

View File

@ -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),