From 648d7859300562a99f035e06a0d42245c3c46e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Sat, 12 Oct 2019 00:35:22 +0300 Subject: vo_gpu/d3d11: add support for configuring swap chain format Query information on the system output most linked to the swap chain, and either utilize a user-configured format, or either 8bit RGBA or 10bit RGB with 2bit alpha depending on the system output's bit depth. --- video/out/d3d11/context.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'video/out/d3d11/context.c') diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c index 003e3ff173..d2062a5619 100644 --- a/video/out/d3d11/context.c +++ b/video/out/d3d11/context.c @@ -36,6 +36,7 @@ struct d3d11_opts { int flip; int sync_interval; char *adapter_name; + int output_format; }; #define OPT_BASE_STRUCT struct d3d11_opts @@ -59,6 +60,12 @@ const struct m_sub_options d3d11_conf = { OPT_INTRANGE("d3d11-sync-interval", sync_interval, 0, 0, 4), OPT_STRING_VALIDATE("d3d11-adapter", adapter_name, 0, d3d11_validate_adapter), + OPT_CHOICE("d3d11-output-format", output_format, 0, + ({"auto", DXGI_FORMAT_UNKNOWN}, + {"rgba8", DXGI_FORMAT_R8G8B8A8_UNORM}, + {"bgra8", DXGI_FORMAT_B8G8R8A8_UNORM}, + {"rgb10_a2", DXGI_FORMAT_R10G10B10A2_UNORM}, + {"rgba16f", DXGI_FORMAT_R16G16B16A16_FLOAT})), {0} }, .defaults = &(const struct d3d11_opts) { @@ -67,6 +74,7 @@ const struct m_sub_options d3d11_conf = { .flip = 1, .sync_interval = 1, .adapter_name = NULL, + .output_format = DXGI_FORMAT_UNKNOWN, }, .size = sizeof(struct d3d11_opts) }; @@ -372,6 +380,7 @@ static bool d3d11_init(struct ra_ctx *ctx) .window = vo_w32_hwnd(ctx->vo), .width = ctx->vo->dwidth, .height = ctx->vo->dheight, + .format = p->opts->output_format, .flip = p->opts->flip, // Add one frame for the backbuffer and one frame of "slack" to reduce // contention with the window manager when acquiring the backbuffer -- cgit v1.2.3