diff options
Diffstat (limited to 'video')
-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; }; |