diff options
author | Jan Ekström <jeebjp@gmail.com> | 2022-04-03 19:10:34 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2022-04-11 17:56:02 +0300 |
commit | 4b8e3f20bc74494b0a70c7a3a860d2a819c6c53c (patch) | |
tree | afb3cbdfda17556ade2ea2e1808164dc9122f30d /video | |
parent | 6102d2bd780f8ceb401da3452f672f4fbc94e697 (diff) | |
download | mpv-4b8e3f20bc74494b0a70c7a3a860d2a819c6c53c.tar.bz2 mpv-4b8e3f20bc74494b0a70c7a3a860d2a819c6c53c.tar.xz |
vo_gpu/d3d11: mimic libplacebo backbuffer usage
Instead of always having the reference outside of calling resize,
request a backbuffer at start and relieve the backbuffer at
submission for presentation.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/d3d11/context.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c index 24f1db27dd..43a4fcb1f3 100644 --- a/video/out/d3d11/context.c +++ b/video/out/d3d11/context.c @@ -166,7 +166,10 @@ static bool resize(struct ra_ctx *ctx) struct priv *p = ctx->priv; HRESULT hr; - ra_tex_free(ctx->ra, &p->backbuffer); + if (p->backbuffer) { + MP_ERR(ctx, "Attempt at resizing while a frame was in progress!\n"); + return false; + } hr = IDXGISwapChain_ResizeBuffers(p->swapchain, 0, ctx->vo->dwidth, ctx->vo->dheight, DXGI_FORMAT_UNKNOWN, 0); @@ -175,8 +178,6 @@ static bool resize(struct ra_ctx *ctx) return false; } - p->backbuffer = get_backbuffer(ctx); - return true; } @@ -213,6 +214,9 @@ static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) if (!out_fbo) return true; + assert(!p->backbuffer); + + p->backbuffer = get_backbuffer(sw->ctx); if (!p->backbuffer) return false; @@ -227,7 +231,10 @@ static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) static bool d3d11_submit_frame(struct ra_swapchain *sw, const struct vo_frame *frame) { + struct priv *p = sw->priv; + ra_d3d11_flush(sw->ctx->ra); + ra_tex_free(sw->ctx->ra, &p->backbuffer); return true; } @@ -526,10 +533,6 @@ static bool d3d11_init(struct ra_ctx *ctx) if (!mp_d3d11_create_swapchain(p->device, ctx->log, &scopts, &p->swapchain)) goto error; - p->backbuffer = get_backbuffer(ctx); - if (!p->backbuffer) - goto error; - return true; error: |