Unified · Split
| @@ -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; |
| @@ -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 | ||
| 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 | |||
| 317 | static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) | 326 | static 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 | ||
| 365 | static const struct ra_swapchain_fns vulkan_swapchain = { | 374 | static 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, |
| @@ -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. |