summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-09-07 20:18:06 +1000
committerJames Ross-Gowan <rossy@jrg.systems>2017-11-07 20:27:13 +1100
commit68eac1a1e7ac931576a8b59dd159a7961189ca48 (patch)
treeef25b97dd381bc5429138f256ae113339a9f353a /options
parent8020a62953926cd6d672e9151290bd4d65e8ee08 (diff)
downloadmpv-68eac1a1e7ac931576a8b59dd159a7961189ca48.tar.bz2
mpv-68eac1a1e7ac931576a8b59dd159a7961189ca48.tar.xz
vo_gpu: d3d11: initial implementation
This is a new RA/vo_gpu backend that uses Direct3D 11. The GLSL generated by vo_gpu is cross-compiled to HLSL with SPIRV-Cross. What works: - All of mpv's internal shaders should work, including compute shaders. - Some external shaders have been tested and work, including RAVU and adaptive-sharpen. - Non-dumb mode works, even on very old hardware. Most features work at feature level 9_3 and all features work at feature level 10_0. Some features also work at feature level 9_1 and 9_2, but without high-bit- depth FBOs, it's not very useful. (Hardware this old is probably not fast enough for advanced features anyway.) Note: This is more compatible than ANGLE, which requires 9_3 to work at all (GLES 2.0,) and 10_1 for non-dumb-mode (GLES 3.0.) - Hardware decoding with D3D11VA, including decoding of 10-bit formats without truncation to 8-bit. What doesn't work / can be improved: - PBO upload and direct rendering does not work yet. Direct rendering requires persistent-mapped PBOs because the decoder needs to be able to read data from images that have already been decoded and uploaded. Unfortunately, it seems like persistent-mapped PBOs are fundamentally incompatible with D3D11, which requires all resources to use driver- managed memory and requires memory to be unmapped (and hence pointers to be invalidated) when a resource is used in a draw or copy operation. However it might be possible to use D3D11's limited multithreading capabilities to emulate some features of PBOs, like asynchronous texture uploading. - The blit() and clear() operations don't have equivalents in the D3D11 API that handle all cases, so in most cases, they have to be emulated with a shader. This is currently done inside ra_d3d11, but ideally it would be done in generic code, so it can take advantage of mpv's shader generation utilities. - SPIRV-Cross is used through a NIH C-compatible wrapper library, since it does not expose a C interface itself. The library is available here: https://github.com/rossy/crossc - The D3D11 context could be made to support more modern DXGI features in future. For example, it should be possible to add support for high-bit-depth and HDR output with DXGI 1.5/1.6.
Diffstat (limited to 'options')
-rw-r--r--options/options.c5
-rw-r--r--options/options.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/options/options.c b/options/options.c
index 22e448d22f..3bf4ee1108 100644
--- a/options/options.c
+++ b/options/options.c
@@ -90,6 +90,7 @@ extern const struct m_obj_list ao_obj_list;
extern const struct m_sub_options opengl_conf;
extern const struct m_sub_options vulkan_conf;
extern const struct m_sub_options spirv_conf;
+extern const struct m_sub_options d3d11_conf;
extern const struct m_sub_options angle_conf;
extern const struct m_sub_options cocoa_conf;
@@ -699,6 +700,10 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("", vulkan_opts, vulkan_conf, 0),
#endif
+#if HAVE_D3D11
+ OPT_SUBSTRUCT("", d3d11_opts, d3d11_conf, 0),
+#endif
+
#if HAVE_EGL_ANGLE_WIN32
OPT_SUBSTRUCT("", angle_opts, angle_conf, 0),
#endif
diff --git a/options/options.h b/options/options.h
index 0d697a717c..47a4622430 100644
--- a/options/options.h
+++ b/options/options.h
@@ -332,6 +332,7 @@ typedef struct MPOpts {
struct opengl_opts *opengl_opts;
struct vulkan_opts *vulkan_opts;
struct spirv_opts *spirv_opts;
+ struct d3d11_opts *d3d11_opts;
struct cocoa_opts *cocoa_opts;
struct dvd_opts *dvd_opts;