summaryrefslogtreecommitdiffstats
path: root/video/out/d3d11
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2019-10-12 00:35:22 +0300
committerJames Ross-Gowan <rossy@jrg.systems>2019-10-13 22:31:33 +1100
commit648d7859300562a99f035e06a0d42245c3c46e23 (patch)
treed627852fd319b8e6b3a11b2aef526b6b43712113 /video/out/d3d11
parent4809a3f48d41f5414057e965c0f18e0279cc2abe (diff)
downloadmpv-648d7859300562a99f035e06a0d42245c3c46e23.tar.bz2
mpv-648d7859300562a99f035e06a0d42245c3c46e23.tar.xz
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.
Diffstat (limited to 'video/out/d3d11')
-rw-r--r--video/out/d3d11/context.c9
1 files changed, 9 insertions, 0 deletions
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