diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c index d062ea8028..4fcdf11567 100644 --- a/video/out/vulkan/context.c +++ b/video/out/vulkan/context.c @@ -583,10 +583,19 @@ static pl_color_space_t target_csp(struct ra_swapchain *sw) return (pl_color_space_t){0}; } +static float target_ref_luma(struct ra_swapchain *sw) +{ + struct priv *p = sw->priv; + if (p->params.preferred_ref_luma) + return p->params.preferred_ref_luma(sw->ctx); + return 0; +} + static const struct ra_swapchain_fns vulkan_swapchain = { .color_depth = color_depth, .set_color = set_color, .target_csp = target_csp, + .target_ref_luma = target_ref_luma, .start_frame = start_frame, .submit_frame = submit_frame, .swap_buffers = swap_buffers, diff --git a/video/out/vulkan/context_win.c b/video/out/vulkan/context_win.c index 43bdcf2e48..a051243478 100644 --- a/video/out/vulkan/context_win.c +++ b/video/out/vulkan/context_win.c @@ -63,6 +63,12 @@ static struct pl_color_space preferred_csp(struct ra_ctx *ctx) return (struct pl_color_space){0}; } +static float preferred_ref_luma(struct ra_ctx *ctx) +{ + struct priv *p = ctx->priv; + return mp_dxgi_sdr_white_level_from_hwnd(&p->dxgi_ctx, vo_w32_hwnd(ctx->vo)); +} + static bool win_init(struct ra_ctx *ctx) { struct priv *p = ctx->priv = talloc_zero(ctx, struct priv); @@ -87,6 +93,7 @@ static bool win_init(struct ra_ctx *ctx) struct ra_ctx_params params = { .color_depth = color_depth, .preferred_csp = preferred_csp, + .preferred_ref_luma = preferred_ref_luma, }; VkInstance inst = vk->vkinst->instance;