On supported APIs. Fixes: https://github.com/mpv-player/mpv/issues/11862
Unified · Split
| @@ -838,10 +838,15 @@ static void apply_target_options(struct priv *p, struct pl_frame *target) · 837 unmodified lines | ||
| 838 | 838 | container = pl_raw_primaries_get(target->color.primaries); |
| 839 | 839 | target->color.hdr.prim = pl_primaries_clip(gamut, container); |
| 840 | 840 | } |
| 841 | − if (opts->dither_depth > 0) { | |
| 841 | + int dither_depth = opts->dither_depth; | |
| 842 | + if (dither_depth == 0) { | |
| 843 | + struct ra_swapchain *sw = p->ra_ctx->swapchain; | |
| 844 | + dither_depth = sw->fns->color_depth ? sw->fns->color_depth(sw) : 0; | |
| 845 | + } | |
| 846 | + if (dither_depth > 0) { | |
| 842 | 847 | struct pl_bit_encoding *tbits = &target->repr.bits; |
| 843 | − tbits->color_depth += opts->dither_depth - tbits->sample_depth; | |
| 844 | − tbits->sample_depth = opts->dither_depth; | |
| 848 | + tbits->color_depth += dither_depth - tbits->sample_depth; | |
| 849 | + tbits->sample_depth = dither_depth; | |
| 845 | 850 | } |
| 846 | 851 | |
| 847 | 852 | if (opts->icc_opts->icc_use_luma) { |