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
1 changed files with 15 additions and 6 deletions

View File

@ -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,
};