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
842 int dither_depth = opts->dither_depth;842 int dither_depth = opts->dither_depth;
843 if (dither_depth == 0) {843 if (dither_depth == 0) {
844 struct ra_swapchain *sw = p->ra_ctx->swapchain;844 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) {
846 dither_depth = sw->fns->color_depth(sw);846 dither_depth = sw->fns->color_depth(sw);
847 } else if (!pl_color_transfer_is_hdr(target->color.transfer)) {847 } else if (!pl_color_transfer_is_hdr(target->color.transfer)) {
848 dither_depth = 8;848 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
314 return device_name;314 return device_name;
315}315}
316 316
317static 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
317static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)326static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
318{327{
319 struct priv *p = sw->priv;328 struct priv *p = sw->priv;
@@ -363,6 +372,7 @@ static void get_vsync(struct ra_swapchain *sw, · 43 unmodified lines
363}372}
364 373
365static const struct ra_swapchain_fns vulkan_swapchain = {374static const struct ra_swapchain_fns vulkan_swapchain = {
375 .color_depth = color_depth,
366 .start_frame = start_frame,376 .start_frame = start_frame,
367 .submit_frame = submit_frame,377 .submit_frame = submit_frame,
368 .swap_buffers = swap_buffers,378 .swap_buffers = swap_buffers,
video/out/vulkan/context.h+3−0
@@ -13,6 +13,9 @@ struct ra_vk_ctx_params { · 12 unmodified lines
13 13
14 // In case something special needs to be done on the buffer swap.14 // In case something special needs to be done on the buffer swap.
15 void (*swap_buffers)(struct ra_ctx *ctx);15 void (*swap_buffers)(struct ra_ctx *ctx);
16
17 // See ra_swapchain_fns.color_depth.
18 int (*color_depth)(struct ra_ctx *ctx);
16};19};
17 20
18// Helpers for ra_ctx based on ra_vk. These initialize ctx->ra and ctx->swchain.21// 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