1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-12 09:56:30 +00:00

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.
This commit is contained in:
Jan Ekström 2022-04-04 23:17:43 +03:00
parent b5b5098d48
commit 6102d2bd78

View File

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