From 13d0df7c2156e02a1198ae1913ad29bd65affa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Mon, 6 Dec 2021 21:58:57 +0200 Subject: vo_gpu/d3d11: enable access to the underlying ra_ctx swap chain This enables us to utilize it from gpu-next. --- video/out/d3d11/context.c | 13 +++++++++++++ video/out/d3d11/context.h | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 video/out/d3d11/context.h 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 + +#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); -- cgit v1.2.3