summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/ra_gl.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/ra_gl.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/ra_gl.c')
-rw-r--r--video/out/opengl/ra_gl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/opengl/ra_gl.c b/video/out/opengl/ra_gl.c
index f63bbe3ea5..e31948c2b1 100644
--- a/video/out/opengl/ra_gl.c
+++ b/video/out/opengl/ra_gl.c
@@ -15,6 +15,7 @@ struct ra_gl {
// For ra_tex.priv
struct ra_tex_gl {
+ struct ra_buf_pool pbo; // for ra.use_pbo
bool own_objects;
GLenum target;
GLuint texture; // 0 if no texture data associated
@@ -218,6 +219,8 @@ static void gl_tex_destroy(struct ra *ra, struct ra_tex *tex)
GL *gl = ra_gl_get(ra);
struct ra_tex_gl *tex_gl = tex->priv;
+ ra_buf_pool_uninit(ra, &tex_gl->pbo);
+
if (tex_gl->own_objects) {
if (tex_gl->fbo)
gl->DeleteFramebuffers(1, &tex_gl->fbo);
@@ -435,6 +438,9 @@ static bool gl_tex_upload(struct ra *ra,
assert(tex->params.host_mutable);
assert(!params->buf || !params->src);
+ if (ra->use_pbo && !params->buf)
+ return ra_tex_upload_pbo(ra, &tex_gl->pbo, params);
+
const void *src = params->src;
if (buf) {
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, buf_gl->buffer);