summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2018-01-04 22:58:12 +1100
committerJames Ross-Gowan <rossy@jrg.systems>2018-01-04 23:05:10 +1100
commita9a4d6349a2d92200d80382532bff46971aafdae (patch)
tree247ad0e892ba1a4f4e6afe066e07cc593ec13b8a /video/out
parentbaa18f76ca41fe92c6b7ed9f73a33b8b4de1337e (diff)
downloadmpv-a9a4d6349a2d92200d80382532bff46971aafdae.tar.bz2
mpv-a9a4d6349a2d92200d80382532bff46971aafdae.tar.xz
vo_gpu: d3d11: check for NULL backbuffer in start_frame
In a lost device scenario, resize() will fail and p->backbuffer will be NULL. We can't recover from lost devices yet, but we should still check for a NULL backbuffer in start_frame() rather than crashing. Also remove a NULL check for p->swapchain. This was a red herring, since p->swapchain never becomes NULL in an error condition, but p->backbuffer actually does. This should fix the crash in #5320, but it doesn't fix the underlying reason for the lost device (which is probably a driver bug.)
Diffstat (limited to 'video/out')
-rw-r--r--video/out/d3d11/context.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index b02d2e80ce..af664d9988 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -73,8 +73,6 @@ struct priv {
static struct mp_image *d3d11_screenshot(struct ra_swapchain *sw)
{
struct priv *p = sw->ctx->priv;
- if (!p->swapchain)
- return NULL;
return mp_d3d11_screenshot(p->swapchain);
}
@@ -131,6 +129,10 @@ static int d3d11_color_depth(struct ra_swapchain *sw)
static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
{
struct priv *p = sw->priv;
+
+ if (!p->backbuffer)
+ return false;
+
*out_fbo = (struct ra_fbo) {
.tex = p->backbuffer,
.flip = false,
@@ -226,6 +228,8 @@ static bool d3d11_init(struct ra_ctx *ctx)
goto error;
p->backbuffer = get_backbuffer(ctx);
+ if (!p->backbuffer)
+ goto error;
return true;