1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 12:17:12 +00:00

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.
This commit is contained in:
nanahi 2024-02-16 12:37:10 -05:00 committed by Dudemanguy
parent 095038b1bc
commit e0ddc0f69e

View File

@ -50,6 +50,9 @@ static bool win_init(struct ra_ctx *ctx)
if (!vo_w32_init(ctx->vo)) if (!vo_w32_init(ctx->vo))
goto error; goto error;
if (ctx->opts.want_alpha)
vo_w32_set_transparency(ctx->vo, ctx->opts.want_alpha);
VkWin32SurfaceCreateInfoKHR wininfo = { VkWin32SurfaceCreateInfoKHR wininfo = {
.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR, .sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
.hinstance = HINST_THISCOMPONENT, .hinstance = HINST_THISCOMPONENT,
@ -96,11 +99,17 @@ static int win_control(struct ra_ctx *ctx, int *events, int request, void *arg)
return ret; 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 = { const struct ra_ctx_fns ra_ctx_vulkan_win = {
.type = "vulkan", .type = "vulkan",
.name = "winvk", .name = "winvk",
.reconfig = win_reconfig, .reconfig = win_reconfig,
.control = win_control, .control = win_control,
.init = win_init, .update_render_opts = win_update_render_opts,
.uninit = win_uninit, .init = win_init,
.uninit = win_uninit,
}; };