diff options
author | Niklas Haas <git@haasn.xyz> | 2016-09-14 13:25:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-14 14:07:21 +0200 |
commit | 8f1a889f75fb9ac385de12ff79b97b1e53cf304c (patch) | |
tree | d5c9de02ee981206fe1a136b6abb2704a039bc25 /video/out | |
parent | 9b6c93e904e0880dc276885dcad35ff6ed4ccfc2 (diff) | |
download | mpv-8f1a889f75fb9ac385de12ff79b97b1e53cf304c.tar.bz2 mpv-8f1a889f75fb9ac385de12ff79b97b1e53cf304c.tar.xz |
vo_opengl: make the number of PBOs tunable
Also set the number of PBOs from 2 to 3, which should be better for
pipelining. This makes it easier to add more in the future.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/opengl/utils.c | 8 | ||||
-rw-r--r-- | video/out/opengl/utils.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index c97aebaa88..0bebe1263c 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -1156,15 +1156,15 @@ void gl_pbo_upload_tex(struct gl_pbo_upload *pbo, GL *gl, bool use_pbo, if (!pbo->buffers[0]) { pbo->gl = gl; pbo->buffer_size = buffer_size; - gl->GenBuffers(2, &pbo->buffers[0]); - for (int n = 0; n < 2; n++) { + gl->GenBuffers(NUM_PBO_BUFFERS, &pbo->buffers[0]); + for (int n = 0; n < NUM_PBO_BUFFERS; n++) { gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo->buffers[n]); gl->BufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, NULL, GL_DYNAMIC_COPY); } } - pbo->index = (pbo->index + 1) % 2; + pbo->index = (pbo->index + 1) % NUM_PBO_BUFFERS; gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo->buffers[pbo->index]); void *data = gl->MapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, needed_size, @@ -1192,6 +1192,6 @@ no_pbo: void gl_pbo_upload_uninit(struct gl_pbo_upload *pbo) { if (pbo->gl) - pbo->gl->DeleteBuffers(2, &pbo->buffers[0]); + pbo->gl->DeleteBuffers(NUM_PBO_BUFFERS, &pbo->buffers[0]); *pbo = (struct gl_pbo_upload){0}; } diff --git a/video/out/opengl/utils.h b/video/out/opengl/utils.h index ec54d19b8a..d81599a71f 100644 --- a/video/out/opengl/utils.h +++ b/video/out/opengl/utils.h @@ -182,10 +182,12 @@ uint64_t gl_timer_last_us(struct gl_timer *timer); uint64_t gl_timer_avg_us(struct gl_timer *timer); uint64_t gl_timer_peak_us(struct gl_timer *timer); +#define NUM_PBO_BUFFERS 3 + struct gl_pbo_upload { GL *gl; int index; - GLuint buffers[2]; + GLuint buffers[NUM_PBO_BUFFERS]; size_t buffer_size; }; |