summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-02-16 12:37:10 -0500
committerDudemanguy <random342@airmail.cc>2024-02-17 16:06:33 +0000
commite0ddc0f69e00277543de5bd5b8b3bbbb82e3c925 (patch)
treeaa6f55fe34a2253d9a87069f4326eab9586ed900
parent095038b1bc0e997846d00bfe32fd4eceeddbedb4 (diff)
downloadmpv-e0ddc0f69e00277543de5bd5b8b3bbbb82e3c925.tar.bz2
mpv-e0ddc0f69e00277543de5bd5b8b3bbbb82e3c925.tar.xz
vulkan/context_win: make --alpha work and runtime changeable
If libplacebo manages to create a vulkan swapchain that allows alpha composition mode to be controlled by the DWM API, this makes it runtime changeable.
-rw-r--r--video/out/vulkan/context_win.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/video/out/vulkan/context_win.c b/video/out/vulkan/context_win.c
index a89c64414b..328753fa69 100644
--- a/video/out/vulkan/context_win.c
+++ b/video/out/vulkan/context_win.c
@@ -50,6 +50,9 @@ static bool win_init(struct ra_ctx *ctx)
if (!vo_w32_init(ctx->vo))
goto error;
+ if (ctx->opts.want_alpha)
+ vo_w32_set_transparency(ctx->vo, ctx->opts.want_alpha);
+
VkWin32SurfaceCreateInfoKHR wininfo = {
.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
.hinstance = HINST_THISCOMPONENT,
@@ -96,11 +99,17 @@ static int win_control(struct ra_ctx *ctx, int *events, int request, void *arg)
return ret;
}
+static void win_update_render_opts(struct ra_ctx *ctx)
+{
+ vo_w32_set_transparency(ctx->vo, ctx->opts.want_alpha);
+}
+
const struct ra_ctx_fns ra_ctx_vulkan_win = {
- .type = "vulkan",
- .name = "winvk",
- .reconfig = win_reconfig,
- .control = win_control,
- .init = win_init,
- .uninit = win_uninit,
+ .type = "vulkan",
+ .name = "winvk",
+ .reconfig = win_reconfig,
+ .control = win_control,
+ .update_render_opts = win_update_render_opts,
+ .init = win_init,
+ .uninit = win_uninit,
};