summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2022-01-20 22:34:45 +1100
committerJan Ekström <jeebjp@gmail.com>2022-02-02 21:48:01 +0200
commit3c4b8433dc5df1206a8c76e820f8fe01c1b72998 (patch)
tree852d7c0317bc89997d863937564d5d9a29000a49
parent65f9a688a4fd282528b0c787db8bc56024d14a75 (diff)
downloadmpv-3c4b8433dc5df1206a8c76e820f8fe01c1b72998.tar.bz2
mpv-3c4b8433dc5df1206a8c76e820f8fe01c1b72998.tar.xz
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.
-rw-r--r--video/out/d3d11/context.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index 3d4bf165fd..72e3447788 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -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;