History

vo_gpu_next/vulkan: add mechanism to retrieve color depth in gpu context

der richter committed 2 years ago

Commit 3c76afa1 parent 3d443cb3 files · +14 −1Browse files

Unified · Split

3 files
  1. video/out/vo_gpu_next.c +1 −1
  2. video/out/vulkan/context.c +10 −0
  3. video/out/vulkan/context.h +3 −0
video/out/vo_gpu_next.c+1−1
@@ -842,7 +842,7 @@ static void apply_target_options(struct priv *p, struct pl_frame *target) · 841 unmodified lines
842842 int dither_depth = opts->dither_depth;
843843 if (dither_depth == 0) {
844844 struct ra_swapchain *sw = p->ra_ctx->swapchain;
845− if (sw->fns->color_depth) {
845+ if (sw->fns->color_depth && sw->fns->color_depth(sw) != -1) {
846846 dither_depth = sw->fns->color_depth(sw);
847847 } else if (!pl_color_transfer_is_hdr(target->color.transfer)) {
848848 dither_depth = 8;
video/out/vulkan/context.c+10−0
@@ -314,6 +314,15 @@ char *ra_vk_ctx_get_device_name(struct ra_ctx *ctx) · 313 unmodified lines
314314 return device_name;
315315 }
316316
317+static int color_depth(struct ra_swapchain *sw)
318+{
319+ struct priv *p = sw->priv;
320+ if (p->params.color_depth)
321+ return p->params.color_depth(sw->ctx);
322+
323+ return -1;
324+}
325+
317326 static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
318327 {
319328 struct priv *p = sw->priv;
@@ -363,6 +372,7 @@ static void get_vsync(struct ra_swapchain *sw, · 43 unmodified lines
363372 }
364373
365374 static const struct ra_swapchain_fns vulkan_swapchain = {
375+ .color_depth = color_depth,
366376 .start_frame = start_frame,
367377 .submit_frame = submit_frame,
368378 .swap_buffers = swap_buffers,
video/out/vulkan/context.h+3−0
@@ -13,6 +13,9 @@ struct ra_vk_ctx_params { · 12 unmodified lines
1313
1414 // In case something special needs to be done on the buffer swap.
1515 void (*swap_buffers)(struct ra_ctx *ctx);
16+
17+ // See ra_swapchain_fns.color_depth.
18+ int (*color_depth)(struct ra_ctx *ctx);
1619 };
1720
1821 // Helpers for ra_ctx based on ra_vk. These initialize ctx->ra and ctx->swchain.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t