Skip to content

Commit

Permalink
vo_gpu/d3d11: enable receival of color depth without active backbuffer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeeb committed Apr 11, 2022
1 parent b5b5098 commit 6102d2b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions video/out/d3d11/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6102d2b

Please sign in to comment.