Skip to content

Commit 37041f9

Browse files
committed
vulkan/context_win: implement target_ref_luma
1 parent f0240d2 commit 37041f9

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

video/out/vulkan/context.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,19 @@ static pl_color_space_t target_csp(struct ra_swapchain *sw)
578578
return (pl_color_space_t){0};
579579
}
580580

581+
static float target_ref_luma(struct ra_swapchain *sw)
582+
{
583+
struct priv *p = sw->priv;
584+
if (p->params.preferred_ref_luma)
585+
return p->params.preferred_ref_luma(sw->ctx);
586+
return 0;
587+
}
588+
581589
static const struct ra_swapchain_fns vulkan_swapchain = {
582590
.color_depth = color_depth,
583591
.set_color = set_color,
584592
.target_csp = target_csp,
593+
.target_ref_luma = target_ref_luma,
585594
.start_frame = start_frame,
586595
.submit_frame = submit_frame,
587596
.swap_buffers = swap_buffers,

video/out/vulkan/context_win.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ static struct pl_color_space preferred_csp(struct ra_ctx *ctx)
6363
return (struct pl_color_space){0};
6464
}
6565

66+
static float preferred_ref_luma(struct ra_ctx *ctx)
67+
{
68+
struct priv *p = ctx->priv;
69+
return mp_dxgi_sdr_white_level_from_hwnd(&p->dxgi_ctx, vo_w32_hwnd(ctx->vo));
70+
}
71+
6672
static bool win_init(struct ra_ctx *ctx)
6773
{
6874
struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);
@@ -87,6 +93,7 @@ static bool win_init(struct ra_ctx *ctx)
8793
struct ra_ctx_params params = {
8894
.color_depth = color_depth,
8995
.preferred_csp = preferred_csp,
96+
.preferred_ref_luma = preferred_ref_luma,
9097
};
9198

9299
VkInstance inst = vk->vkinst->instance;

0 commit comments

Comments
 (0)