summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/utils.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2016-09-14 13:25:13 +0200
committerwm4 <wm4@nowhere>2016-09-14 14:07:21 +0200
commit8f1a889f75fb9ac385de12ff79b97b1e53cf304c (patch)
treed5c9de02ee981206fe1a136b6abb2704a039bc25 /video/out/opengl/utils.c
parent9b6c93e904e0880dc276885dcad35ff6ed4ccfc2 (diff)
downloadmpv-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/opengl/utils.c')
-rw-r--r--video/out/opengl/utils.c8
1 files changed, 4 insertions, 4 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};
}