summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-08-19 04:33:40 +0200
committerNiklas Haas <git@haasn.xyz>2017-08-22 09:55:49 +0200
commit09c501a40eed7cb05c73fc30ea814d1d256ac0eb (patch)
tree2508bf03c8a22b098d955ddc7b3abc328d089296 /video/out/opengl/video.c
parent371000108acb40a99412316fe1bba2883441c38a (diff)
downloadmpv-09c501a40eed7cb05c73fc30ea814d1d256ac0eb.tar.bz2
mpv-09c501a40eed7cb05c73fc30ea814d1d256ac0eb.tar.xz
vo_opengl: refactor tex_upload to ra_buf_pool
Also refactors the usage of tex_upload to make ra_tex_upload_pbo a RA-internal thing again. ra_buf_pool has the main advantage of being dynamically sized depending on buf_poll, so for OpenGL we'll end up only using one buffer (when not persistently mapping) - while for vulkan we'll use as many as necessary, which depends on the swapchain depth anyway.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index e8ff23f2b4..bb3730022a 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -84,7 +84,6 @@ static const struct ra_renderpass_input vertex_vao[] = {
struct texplane {
struct ra_tex *tex;
- struct tex_upload pbo;
int w, h;
bool flipped;
};
@@ -494,7 +493,7 @@ static void reinit_osd(struct gl_video *p)
mpgl_osd_destroy(p->osd);
p->osd = NULL;
if (p->osd_state)
- p->osd = mpgl_osd_init(p->ra, p->log, p->osd_state, p->opts.pbo);
+ p->osd = mpgl_osd_init(p->ra, p->log, p->osd_state);
}
static void uninit_rendering(struct gl_video *p)
@@ -987,7 +986,6 @@ static void uninit_video(struct gl_video *p)
for (int n = 0; n < p->plane_count; n++) {
struct texplane *plane = &vimg->planes[n];
ra_tex_free(p->ra, &plane->tex);
- tex_upload_uninit(p->ra, &plane->pbo);
}
*vimg = (struct video_image){0};
@@ -3291,7 +3289,7 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t
MP_VERBOSE(p, "DR enabled: %s\n", p->using_dr_path ? "yes" : "no");
}
- if (!tex_upload(p->ra, &plane->pbo, p->opts.pbo, &params)) {
+ if (!p->ra->fns->tex_upload(p->ra, &params)) {
timer_pool_stop(p->upload_timer);
goto error;
}
@@ -3300,7 +3298,9 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t
mapped->mpi = mp_image_new_ref(mpi);
}
timer_pool_stop(p->upload_timer);
- const char *mode = p->using_dr_path ? "DR" : p->opts.pbo ? "PBO" : "naive";
+
+ bool using_pbo = p->ra->use_pbo || !(p->ra->caps & RA_CAP_DIRECT_UPLOAD);
+ const char *mode = p->using_dr_path ? "DR" : using_pbo ? "PBO" : "naive";
pass_describe(p, "upload frame (%s)", mode);
pass_record(p, timer_pool_measure(p->upload_timer));
@@ -3639,6 +3639,7 @@ static void reinit_from_options(struct gl_video *p)
check_gl_features(p);
uninit_rendering(p);
gl_sc_set_cache_dir(p->sc, p->opts.shader_cache_dir);
+ p->ra->use_pbo = p->opts.pbo;
gl_video_setup_hooks(p);
reinit_osd(p);