From 6102d2bd780f8ceb401da3452f672f4fbc94e697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Mon, 4 Apr 2022 23:17:43 +0300 Subject: 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. --- video/out/d3d11/context.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'video/out') 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) -- cgit v1.2.3