1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-19 14:26:57 +00:00

vo_gpu_next: forwards compatibility with pl_cache

Interrim solution, forwards compatible with new and backwards compatible
with old API. Eventually, we will want to discontinue the use of
deprecated pl_icc_params.save/load and pl_renderer_save/load, but that
requires minimum version bump.
This commit is contained in:
Niklas Haas 2023-09-08 16:45:21 +02:00 committed by Niklas Haas
parent 826ce82cad
commit 57a6a16172

View File

@ -147,6 +147,10 @@ struct priv {
pl_tex *sub_tex;
int num_sub_tex;
#if PL_API_VER >= 320
pl_cache cache;
#endif
struct mp_rect src, dst;
struct mp_osd_res osd_res;
struct osd_state osd_state;
@ -1625,6 +1629,15 @@ static int preinit(struct vo *vo)
ra_hwdec_ctx_init(&p->hwdec_ctx, vo->hwdec_devs, gl_opts->hwdec_interop, false);
pthread_mutex_init(&p->dr_lock, NULL);
#if PL_API_VER >= 320
p->cache = pl_cache_create(pl_cache_params(
.log = p->pllog,
.max_object_size = 1 << 20, // 1 MB
.max_total_size = 10 << 20, // 10 MB
));
pl_gpu_set_cache(p->gpu, p->cache);
#endif
p->rr = pl_renderer_create(p->pllog, p->gpu);
p->queue = pl_queue_create(p->gpu);
p->osd_fmt[SUBBITMAP_LIBASS] = pl_find_named_fmt(p->gpu, "r8");