vo_gpu/d3d11: add more usage flags to the swapchain images

vo_gpu_next and libplacebo expect swapchain images to be able to be
blitted to, which for libplacebo on FL11_0 and up means they have to
have DXGI_USAGE_UNORDERED_ACCESS, since libplacebo uses a compute shader
to emulate certain kinds of blits. For libplacebo's benefit, set all
applicable usage flags on swapchain images.
This commit is contained in:
James Ross-Gowan 2022-01-20 22:34:45 +11:00 committed by Jan Ekström
parent 65f9a688a4
commit 3c4b8433dc
1 changed files with 8 additions and 1 deletions

View File

@ -492,6 +492,13 @@ static bool d3d11_init(struct ra_ctx *ctx)
if (!vo_w32_init(ctx->vo))
goto error;
UINT usage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT;
if (ID3D11Device_GetFeatureLevel(p->device) >= D3D_FEATURE_LEVEL_11_0 &&
p->opts->output_format != DXGI_FORMAT_B8G8R8A8_UNORM)
{
usage |= DXGI_USAGE_UNORDERED_ACCESS;
}
struct d3d11_swapchain_opts scopts = {
.window = vo_w32_hwnd(ctx->vo),
.width = ctx->vo->dwidth,
@ -503,7 +510,7 @@ static bool d3d11_init(struct ra_ctx *ctx)
// Add one frame for the backbuffer and one frame of "slack" to reduce
// contention with the window manager when acquiring the backbuffer
.length = ctx->vo->opts->swapchain_depth + 2,
.usage = DXGI_USAGE_RENDER_TARGET_OUTPUT,
.usage = usage,
};
if (!mp_d3d11_create_swapchain(p->device, ctx->log, &scopts, &p->swapchain))
goto error;