summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2022-04-04 23:17:43 +0300
committerJan Ekström <jeebjp@gmail.com>2022-04-11 17:56:02 +0300
commit6102d2bd780f8ceb401da3452f672f4fbc94e697 (patch)
treecd5106f9c7406f54f3a29ca0ce08e867f48d5b24 /video/out
parentb5b5098d48f664d0141fab7e10e7177fecec9607 (diff)
downloadmpv-6102d2bd780f8ceb401da3452f672f4fbc94e697.tar.bz2
mpv-6102d2bd780f8ceb401da3452f672f4fbc94e697.tar.xz
vo_gpu/d3d11: enable receival of color depth without active backbuffer
Query the description of the swap chain, which should in all theory contain the format of the backbuffer. Then utilize a newly added ra_d3d11 function to map the format to an ra_format. After that, utilize the depth of the first plane of the format, as previously.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/d3d11/context.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index bbdf170df1..24f1db27dd 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -189,11 +189,21 @@ static bool d3d11_reconfig(struct ra_ctx *ctx)
static int d3d11_color_depth(struct ra_swapchain *sw)
{
struct priv *p = sw->priv;
+ DXGI_SWAP_CHAIN_DESC desc;
- if (!p->backbuffer)
+ HRESULT hr = IDXGISwapChain_GetDesc(p->swapchain, &desc);
+ if (FAILED(hr)) {
+ MP_ERR(sw->ctx, "Failed to query swap chain description: %s!\n",
+ mp_HRESULT_to_str(hr));
+ return 0;
+ }
+
+ const struct ra_format *ra_fmt =
+ ra_d3d11_get_ra_format(sw->ctx->ra, desc.BufferDesc.Format);
+ if (!ra_fmt)
return 0;
- return p->backbuffer->params.format->component_depth[0];
+ return ra_fmt->component_depth[0];
}
static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)