vulkan/context_win: implement target_ref_luma

This commit is contained in:
Kacper Michajłow
2026-06-27 23:15:26 +02:00
parent be8d1eb3d6
commit a01e391851
2 changed files with 16 additions and 0 deletions
+9
View File
@@ -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,
+7
View File
@@ -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;