summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2021-12-06 21:58:57 +0200
committerJan Ekström <jeebjp@gmail.com>2022-02-02 21:48:01 +0200
commit13d0df7c2156e02a1198ae1913ad29bd65affa77 (patch)
treeaa64162ca525db345937e4742f4c65dbe80fbf8c
parent3c4b8433dc5df1206a8c76e820f8fe01c1b72998 (diff)
downloadmpv-13d0df7c2156e02a1198ae1913ad29bd65affa77.tar.bz2
mpv-13d0df7c2156e02a1198ae1913ad29bd65affa77.tar.xz
vo_gpu/d3d11: enable access to the underlying ra_ctx swap chain
This enables us to utilize it from gpu-next.
-rw-r--r--video/out/d3d11/context.c13
-rw-r--r--video/out/d3d11/context.h9
2 files changed, 22 insertions, 0 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index 72e3447788..bbdf170df1 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -24,6 +24,7 @@
#include "video/out/gpu/d3d11_helpers.h"
#include "video/out/gpu/spirv.h"
#include "video/out/w32_common.h"
+#include "context.h"
#include "ra_d3d11.h"
static int d3d11_validate_adapter(struct mp_log *log,
@@ -526,6 +527,18 @@ error:
return false;
}
+IDXGISwapChain *ra_d3d11_ctx_get_swapchain(struct ra_ctx *ra)
+{
+ if (ra->swapchain->fns != &d3d11_swapchain)
+ return NULL;
+
+ struct priv *p = ra->priv;
+
+ IDXGISwapChain_AddRef(p->swapchain);
+
+ return p->swapchain;
+}
+
const struct ra_ctx_fns ra_ctx_d3d11 = {
.type = "d3d11",
.name = "d3d11",
diff --git a/video/out/d3d11/context.h b/video/out/d3d11/context.h
new file mode 100644
index 0000000000..8a9ef4cc0d
--- /dev/null
+++ b/video/out/d3d11/context.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <dxgi.h>
+
+#include "video/out/gpu/context.h"
+
+// Get the underlying D3D11 swap chain from an RA context. The returned swap chain is
+// refcounted and must be released by the caller.
+IDXGISwapChain *ra_d3d11_ctx_get_swapchain(struct ra_ctx *ra);